Skip to content

Commit

Permalink
Fix wallclock units (#206)
Browse files Browse the repository at this point in the history
After the transition to the parameter value class
the wallclock monitor now stores values internally
in seconds, not in clock ticks. This lead to a wrong
comparison for the short wallclock warning.

In addition to fixing the test, the method is renamed
to avoid confusion.
  • Loading branch information
graeme-a-stewart authored Oct 7, 2021
1 parent 057e268 commit ffb699b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
6 changes: 2 additions & 4 deletions package/src/prmon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ int ProcessMonitor(const pid_t mpid, const std::string filename,
}
}
for (const auto& monitor : monitors) {
auto wallclock_time = wallclock_monitor_p->get_wallclock_clock_t();
auto wallclock_time = wallclock_monitor_p->get_wallclock_t();
for (const auto& stat :
monitor.second->get_json_average_stats(wallclock_time)) {
// We will limit the decimal place accuracy here as it doesn't
Expand Down Expand Up @@ -221,9 +221,7 @@ int ProcessMonitor(const pid_t mpid, const std::string filename,
file.close();

// Check that we ran for a reasonable number of iterations
if (wallclock_monitor_p->get_wallclock_clock_t() /
(interval * sysconf(_SC_CLK_TCK)) <
1) {
if (wallclock_monitor_p->get_wallclock_t() < prmon::mon_value(interval)) {
spdlog::warn(
"Wallclock time of monitored process was less than the monitoring "
"interval, so average statistics will be unreliable");
Expand Down
2 changes: 1 addition & 1 deletion package/src/wallmon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ void wallmon::update_stats(const std::vector<pid_t>& pids,
walltime_stats.at("wtime").set_value(uptime_sec);
}

prmon::mon_value const wallmon::get_wallclock_clock_t() {
prmon::mon_value const wallmon::get_wallclock_t() {
// Just ensure we never return a zero
return (walltime_stats.at("wtime").get_value()
? walltime_stats.at("wtime").get_value()
Expand Down
4 changes: 2 additions & 2 deletions package/src/wallmon.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ class wallmon final : public Imonitor, public MessageBase {
void const get_hardware_info(nlohmann::json& hw_json);
void const get_unit_info(nlohmann::json& unit_json);

// Class specific method to retrieve wallclock time in clock ticks
unsigned long long const get_wallclock_clock_t();
// Class specific method to retrieve wallclock time (in seconds)
unsigned long long const get_wallclock_t();

bool const is_valid() { return true; }
};
Expand Down

0 comments on commit ffb699b

Please sign in to comment.