12 #ifndef SST_CORE_PROFILE_CLOCKHANDLERPROFILETOOL_H 13 #define SST_CORE_PROFILE_CLOCKHANDLERPROFILETOOL_H 15 #include "sst/core/clock.h" 16 #include "sst/core/eli/elementinfo.h" 17 #include "sst/core/profile/profiletool.h" 18 #include "sst/core/sst_types.h" 19 #include "sst/core/ssthandler.h" 20 #include "sst/core/warnmacros.h" 34 SST_ELI_DOCUMENT_PARAMS(
35 {
"level",
"Level at which to track profile (global, type, component, subcomponent)",
"type" },
38 enum class Profile_Level { Global, Type,
Component, Subcomponent };
44 void beforeHandler(uintptr_t UNUSED(key),
const Cycle_t& UNUSED(cycle))
override {}
45 void afterHandler(uintptr_t UNUSED(key),
const bool& UNUSED(
remove))
override {}
50 Profile_Level profile_level_;
61 SST_ELI_REGISTER_PROFILETOOL(
65 "profile.handler.clock.count",
66 SST_ELI_ELEMENT_VERSION(0, 1, 0),
67 "Profiler that will count calls to handler functions" 76 void beforeHandler(uintptr_t key,
const Cycle_t& cycle)
override;
78 void outputData(FILE* fp)
override;
81 std::map<std::string, uint64_t> counts_;
109 void beforeHandler(uintptr_t UNUSED(key),
const Cycle_t& UNUSED(cycle))
override { start_time_ = T::now(); }
111 void afterHandler(uintptr_t key,
const bool& UNUSED(
remove))
override 113 auto total_time = T::now() - start_time_;
114 clock_data_t* entry =
reinterpret_cast<clock_data_t*
>(key);
115 entry->time += std::chrono::duration_cast<std::chrono::nanoseconds>(total_time).count();
119 void outputData(FILE* fp)
override;
122 typename T::time_point start_time_;
123 std::map<std::string, clock_data_t> times_;
128 #endif // SST_CORE_PROFILE_CLOCKHANDLERPROFILETOOL_H
Main component object for the simulation.
Definition: component.h:30
Attach Point to get notified when a handler starts and stops.
Definition: ssthandler.h:117
Parameter store.
Definition: params.h:63