diff --git a/src/backends/extrae/extrae_value_stack.cpp b/src/backends/extrae/extrae_value_stack.cpp index 90cef232f2cf98e10d0378d11b16558077a1792e..c90d7ccae3fabdb272f4972bcdbb670c436e3f48 100644 --- a/src/backends/extrae/extrae_value_stack.cpp +++ b/src/backends/extrae/extrae_value_stack.cpp @@ -2,15 +2,61 @@ void ExtraeValueStackStrategy::region_start( const SITRegionInformation ®ion) const noexcept { - // TODO + + extrae_value_t event_number; + extrae_type_t event_type = 7000; + char myExtrae_descriptio[] = "OpenFOAM Extrae Profiling"; + + // Check if there is already an event with that name + auto iter = event_history.find(region.name); + if (iter != event_history.end()) + { + event_number = iter->second; + } + else + { + // Update extrae defined events + + event_number = static_cast(event_history.size()); + event_history.insert(std::make_pair(name, event_number)); + + unsigned numEvents = event_history.size(); + + for (const auto& iter : event_history) + { + eventDescriptions.push_back(const_cast(iter.first.data())); + eventValues.push_back(iter.second); + } + +// Extrae_define_event_type +// ( +// &event_type, +// myExtrae_description, +// &numEvents, +// eventValues.data(), +// eventDescriptions.data() +// ); + } + + Extrae_event(event_type, event_number); + } void ExtraeValueStackStrategy::region_stop( const SITRegionInformation ®ion) const noexcept { // TODO + extrae_type_t event_type = 7000; + Extrae_event(event_type, 0); } void ExtraeValueStackStrategy::init() const noexcept { - // TODO + + //myExtrae_descriptio[] = "OpenFOAM Extrae Profiling"; + //event_type = 7000; + + if (event_history.empty()) // it has to be empty... + { + event_history.insert(std::make_pair("End", 0)); + } } void ExtraeValueStackStrategy::finalize() const noexcept { // TODO diff --git a/src/backends/extrae/extrae_value_stack.hpp b/src/backends/extrae/extrae_value_stack.hpp index 039c674c51dfbf7c2405703b3b14bc8357b951d3..7fa7a77539a2b8554f5fda20caa4a6c102378b2b 100644 --- a/src/backends/extrae/extrae_value_stack.hpp +++ b/src/backends/extrae/extrae_value_stack.hpp @@ -1,8 +1,18 @@ #include "sit_strategy.hpp" +#include "extrae.h" +#include +#include + +static std::map event_history; +static std::vector eventValues; +static std::vector eventDescriptions; class ExtraeValueStackStrategy : public SITProfilingStrategy { + //char *myExtrae_description = NULL; + extrae_type_t event_type; public: + inline static const std::string_view name = "Extrae::ValueStack"; void region_start(const SITRegionInformation ®ion) const noexcept override; void region_stop(const SITRegionInformation ®ion) const noexcept override;