33 trie.add_unset<
Time>(
"start_time");
34 trie.add_unset<
Time>(
"end_time").validator([
this](
const Time& end) {
35 const auto start_time_ptr = trie.find<
Time>(
"start_time");
36 return start_time_ptr !=
nullptr && end > start_time_ptr->value();
38 trie.add<std::string>(
"module_match_regex",
".*");
39 trie.add<std::string>(
"dump_path",
"statistics.yaml");
49 const auto start_time = parameters.
get<
Time>(
"start_time")->value();
50 const auto end_time = parameters.
get<
Time>(
"end_time")->value();
51 dump_path = parameters.
get<std::string>(
"dump_path")->value();
52 sim_ctx().schedule_at(start_time, [
this] { open_window(); });
53 sim_ctx().schedule_at(end_time, [
this] { close_window(); });
54 const auto module_regex =
55 parameters.
get<std::string>(
"module_match_regex")->value();
56 sim_ctx().foreach_module([
this, &module_regex](
const Module& m) {
57 if (std::regex_match(std::string(m.name()), std::regex(module_regex))) {
58 add_module(
const_cast<Module*
>(&m));
61 return InitializationStatus::ok(
this);
64 void add_module(
Module* module) { modules.push_back(module); }
67 if (!searched_statistics) {
68 for (
const auto& module : modules) {
69 mapper.emplace_back(*module);
71 searched_statistics =
true;
77 for (
const auto& mod_mapper : mapper) {
84 auto out_stream = Statistics::StatOutStream();
85 out_stream.output_path(dump_path);
86 for (
auto& mod_mapper : mapper) {
87 for (
const auto& stat_ptr : mod_mapper.compute_diff()) {
88 out_stream << *stat_ptr;
91 out_stream.generate();
95 std::vector<Module*> modules;
96 bool searched_statistics =
false;
97 std::vector<Statistics::ModuleStatMapper> mapper;
98 std::filesystem::path dump_path;