Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix wallclock units #206

Merged
merged 1 commit into from
Oct 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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