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 printf specifier warnings when profiler enabled #2335

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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
13 changes: 7 additions & 6 deletions hwy/profiler.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,11 @@ class Results {
const char* string_origin = StringOrigin();
for (size_t i = 0; i < num_zones_; ++i) {
const Accumulator& r = zones_[i];
const uint64_t num_calls = r.NumCalls();
printf("%-40s: %10zu x %15zu = %9.6f\n", string_origin + r.BiasedOffset(),
num_calls, r.Duration() / num_calls,
static_cast<double>(r.Duration()) * inv_freq);
const size_t num_calls = r.NumCalls();
const double duration = static_cast<double>(r.Duration());
printf("%-40s: %10zu x %15.0f = %9.6f\n",
string_origin + r.BiasedOffset(), num_calls, duration / num_calls,
duration * inv_freq);
}

const uint64_t t1 = hn::timer::Stop();
Expand Down Expand Up @@ -592,7 +593,7 @@ inline void ThreadSpecific::ComputeOverhead() {
robust_statistics::CountingSort(samples, kNumSamples);
self_overhead = samples[kNumSamples / 2];
if (PROFILER_PRINT_OVERHEAD) {
printf("Overhead: %zu\n", self_overhead);
printf("Overhead: %.0f\n", static_cast<double>(self_overhead));
}
results_.SetSelfOverhead(self_overhead);
}
Expand Down Expand Up @@ -628,7 +629,7 @@ inline void ThreadSpecific::ComputeOverhead() {
robust_statistics::CountingSort(samples, kNumSamples);
const uint64_t child_overhead = samples[9 * kNumSamples / 10];
if (PROFILER_PRINT_OVERHEAD) {
printf("Child overhead: %zu\n", child_overhead);
printf("Child overhead: %.0f\n", static_cast<double>(child_overhead));
}
results_.SetChildOverhead(child_overhead);
}
Expand Down
Loading