48 typedef unsigned extrae_type_t;
49 typedef unsigned long long extrae_value_t;
53 void Extrae_define_event_type
56 char *type_description,
59 char **values_description
60 ) __attribute__((weak));
67 ) __attribute__((weak));
73 static char myExtrae_description[] =
"OpenFOAM Extrae Profiling";
75 static void open_extrae_region(
const std::string&
name)
78 static std::map<std::string, extrae_value_t> event_history;
85 if (event_history.empty())
87 event_history.insert(std::make_pair(
"End", 0));
90 extrae_type_t event_type = 7000;
91 extrae_value_t event_name;
94 auto iter = event_history.
find(
name);
95 if (iter != event_history.end())
97 event_name = iter->second;
103 event_name =
static_cast<extrae_value_t
>(event_history.size());
104 event_history.insert(std::make_pair(
name, event_name));
106 unsigned numEvents = event_history.size();
108 const Foam::label len(numEvents);
114 for (
const auto& iter : event_history)
116 eventNames[i] =
const_cast<char*
>(iter.first.data());
117 eventValues[i] = iter.second;
121 Extrae_define_event_type
124 myExtrae_description,
131 Extrae_event(event_type, event_name);
135 static void close_extrae_region()
137 Extrae_event(7000, 0);
162 if (Extrae_event) open_extrae_region(std::string(
name));
186 if (Extrae_event) close_extrae_region();
bool running() const noexcept
True if the triggered profiling is active.
T * data() noexcept
Return pointer to the underlying array serving as data storage.
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tf1, const word &name, const dimensionSet &dimensions, const bool initCopy=false)
Global function forwards to reuseTmpDimensionedField::New.
~profilingTrigger()
Destructor.
Triggers for starting/stopping code profiling.
static void unstack(const profilingInformation *info)
Remove the information from the top of the stack.
List< T > values(const HashTable< T, Key, Hash > &tbl, const bool doSort=false)
List of values from HashTable, optionally sorted.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
void stop()
Stop triggered profiling.
label find(const T &val) const
Find index of the first occurrence of the value.
profilingTrigger() noexcept
Default construct, no profiling trigger.
void resize_nocopy(const label len)
Alter addressable list size, allocating new space if required without necessarily recovering old cont...
A class for handling character strings derived from std::string.