Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
fix(profiling): if count is 0 dont serialize measurements (#205)
Browse files Browse the repository at this point in the history
* fix(profiling): if count is 0 dont serialize measurements

* fix(profiling): remove iostream
  • Loading branch information
JonasBa authored Oct 30, 2023
1 parent 61bd3fe commit b0503be
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions bindings/cpu_profiler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,21 @@ void MeasurementsTicker::remove_heap_listener(std::string& profile_id, const std

// CPU tickers
void MeasurementsTicker::cpu_callback() {
uint64_t ts = uv_hrtime();

uv_cpu_info_t* cpu = &cpu_stats;
int count;
int err = uv_cpu_info(&cpu, &count);
if (err) {
return;
}

uint64_t ts = uv_hrtime();
if(count < 1) {
for(auto cb : cpu_listeners) {
cb.second(ts, 0);
}
return;
}

uint64_t total = 0;
uint64_t idle_total = 0;

Expand Down

0 comments on commit b0503be

Please sign in to comment.