Skip to content

Commit 39826b1

Browse files
authored
[libc] [gpu] Change Time To Be Per Iteration (llvm#101919)
Previously, the time field was the total time take to run all iterations of the benchmark. This PR changes the value displayed to be the average time take by each iteration.
1 parent 05b26ef commit 39826b1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

libc/benchmarks/gpu/LibcGpuBenchmark.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ void print_results(Benchmark *b) {
115115
cpp::atomic_thread_fence(cpp::MemoryOrder::RELEASE);
116116

117117
LIBC_NAMESPACE::printf(
118-
"%-20s |%8ld |%8ld |%8ld |%11d |%9ld %2s |%9ld |%9d |\n",
118+
"%-20s |%8ld |%8ld |%8ld |%11d |%14ld %2s |%9ld |%9d |\n",
119119
b->get_test_name().data(), result.cycles, result.min, result.max,
120120
result.total_iterations, result.total_time, time_unit,
121121
static_cast<uint64_t>(result.standard_deviation), num_threads);
@@ -126,9 +126,9 @@ void print_header() {
126126
LIBC_NAMESPACE::printf("Running Suite: %-10s\n",
127127
benchmarks[0]->get_suite_name().data());
128128
LIBC_NAMESPACE::printf("%s", RESET);
129-
LIBC_NAMESPACE::printf("Benchmark | Cycles | Min | Max | "
130-
"Iterations | "
131-
"Time | Stddev | Threads |\n");
129+
LIBC_NAMESPACE::printf(
130+
"Benchmark | Cycles | Min | Max | "
131+
"Iterations | Time / Iteration | Stddev | Threads |\n");
132132
LIBC_NAMESPACE::printf(
133133
"---------------------------------------------------------------------"
134134
"--------------------------------\n");
@@ -222,7 +222,7 @@ BenchmarkResult benchmark(const BenchmarkOptions &options,
222222
result.max = max;
223223
result.samples = samples;
224224
result.total_iterations = total_iterations;
225-
result.total_time = total_time;
225+
result.total_time = total_time / total_iterations;
226226
return result;
227227
};
228228

0 commit comments

Comments
 (0)