Skip to content

Commit

Permalink
adjust logging
Browse files Browse the repository at this point in the history
  • Loading branch information
copperlight committed Aug 30, 2024
1 parent 8f8a343 commit 390dc79
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bin/atlas-agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -243,27 +243,29 @@ void collect_system_metrics(TaggingRegistry* registry, std::unique_ptr<atlasagen
// the first call to this gather function takes >1 second, so it must
// be done before we start calculating times to wait for peak metrics
gather_slow_system_metrics(&proc, &disk, &ethtool, &ntp, &pressureStall, &aws);
Logger()->info("First publish");
Logger()->info("Published slow system metrics (first iteration)");

auto now = system_clock::now();
auto next_run = now;
auto next_slow_run = now + seconds(60);
std::chrono::nanoseconds time_to_sleep;

do {
auto start = system_clock::now();
gather_peak_system_metrics(&proc);
gather_scaling_metrics(&cpufreq);
auto start = system_clock::now();

if (start >= next_slow_run) {
gather_slow_system_metrics(&proc, &disk, &ethtool, &ntp, &pressureStall, &aws);
auto elapsed = duration_cast<milliseconds>(system_clock::now() - start);
Logger()->info("Published system metrics (delay={})", elapsed);
perf_metrics.collect();
if (gpu) {
gpu->gpu_metrics();
}
auto elapsed = duration_cast<milliseconds>(system_clock::now() - start);
Logger()->info("Published system metrics (delay={})", elapsed);
next_slow_run += seconds(60);
}

next_run += seconds(1);
time_to_sleep = next_run - system_clock::now();
} while (runner.wait_for(time_to_sleep));
Expand Down

0 comments on commit 390dc79

Please sign in to comment.