Skip to content

Commit

Permalink
Easy getter for StatKeeper
Browse files Browse the repository at this point in the history
  • Loading branch information
rroelke committed Jan 31, 2025
1 parent 340a067 commit b23205b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions test/performance/tiledb_submit_a_b.cc
Original file line number Diff line number Diff line change
Expand Up @@ -167,27 +167,28 @@ struct StatKeeper {
std::map<std::string, std::map<std::string, std::map<std::string, StatValue>>>
statistics;

StatValue& get(const StatKey& stat) {
return statistics[stat.uri_][stat.qlabel_][stat.configname_];
}

Timer start_timer(const StatKey& stat) {
return tiledb::sm::stats::DurationInstrument<StatKeeper, StatKey>(
*this, stat);
}

void report_duration(
const StatKey& stat, const std::chrono::duration<double> duration) {
auto& stats = statistics[stat.uri_][stat.qlabel_][stat.configname_];
stats.durations.push_back(duration.count());
get(stat).durations.push_back(duration.count());
}

void report_metric(
const StatKey& stat, const std::string& name, const json& value) {
auto& stats = statistics[stat.uri_][stat.qlabel_][stat.configname_];
stats.metrics[name] = value;
get(stat).metrics[name] = value;
}

void report_timer(
const StatKey& stat, const std::string& name, const json& value) {
auto& stats = statistics[stat.uri_][stat.qlabel_][stat.configname_];
stats.metrics[name] = value;
get(stat).metrics[name] = value;
}

/**
Expand Down

0 comments on commit b23205b

Please sign in to comment.