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/sst_types.h" 18 #include "sst/core/ssthandler.h" 19 #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 };
45 Profile_Level profile_level_;
56 SST_ELI_REGISTER_PROFILETOOL(
60 "profile.handler.clock.count",
61 SST_ELI_ELEMENT_VERSION(0, 1, 0),
62 "Profiler that will count calls to handler functions" 71 void handlerStart(uintptr_t key)
override;
73 void outputData(FILE* fp)
override;
76 std::map<std::string, uint64_t> counts_;
91 clock_data_t() : time(0), count(0) {}
101 void handlerStart(uintptr_t UNUSED(key))
override { start_time_ = T::now(); }
103 void handlerEnd(uintptr_t key)
override 105 auto total_time = T::now() - start_time_;
106 clock_data_t* entry =
reinterpret_cast<clock_data_t*
>(key);
107 entry->time += std::chrono::duration_cast<std::chrono::nanoseconds>(total_time).count();
111 void outputData(FILE* fp)
override;
114 typename T::time_point start_time_;
115 std::map<std::string, clock_data_t> times_;
121 #endif // SST_CORE_PROFILE_CLOCKHANDLERPROFILETOOL_H
Main component object for the simulation.
Definition: component.h:30
Parameter store.
Definition: params.h:55