summaryrefslogtreecommitdiff
path: root/mknes_bench.c
diff options
context:
space:
mode:
authorPeter Fors <peter.fors@mindkiller.com>2025-10-26 19:28:53 +0100
committerPeter Fors <peter.fors@mindkiller.com>2025-10-26 19:28:53 +0100
commit3b7621981b56a51756badac70034f68366878df9 (patch)
treee85e0b3f2558ea1ec15d9cec319499b0ca55eb9d /mknes_bench.c
parentb2f646d9f99dd272f3b3a9d045b5039e6fc1dc50 (diff)
Changes to layout
Diffstat (limited to 'mknes_bench.c')
-rw-r--r--mknes_bench.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/mknes_bench.c b/mknes_bench.c
index fcc7aae..12fb642 100644
--- a/mknes_bench.c
+++ b/mknes_bench.c
@@ -34,8 +34,7 @@ struct bench_stats {
int n;
};
-static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid,
- int cpu, int group_fd, unsigned long flags) {
+static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags) {
return syscall(__NR_perf_event_open, hw_event, pid, cpu, group_fd, flags);
}
@@ -228,8 +227,7 @@ static void run_benchmark(struct nes_state *nstate, uint32_t num_runs, uint32_t
clock_gettime(CLOCK_MONOTONIC, &end_time);
// Calculate elapsed time in nanoseconds
- uint64_t elapsed_ns = (end_time.tv_sec - start_time.tv_sec) * 1000000000ULL +
- (end_time.tv_nsec - start_time.tv_nsec);
+ uint64_t elapsed_ns = (end_time.tv_sec - start_time.tv_sec) * 1000000000ULL + (end_time.tv_nsec - start_time.tv_nsec);
// Store results
runs[run].time_ns = elapsed_ns;
@@ -299,13 +297,13 @@ static void run_benchmark(struct nes_state *nstate, uint32_t num_runs, uint32_t
double mcps = (double)total_cycles / total_time_s / 1000000.0;
printf("\n");
- printf("%20llu instructions # %.2f insn per cycle \n", (unsigned long long)total_instructions, ipc);
- printf("%67s# %.2f stalled cycles per insn \n", "", stalled_per_insn);
- printf("%20llu cycles # %.3f GHz \n", (unsigned long long)total_cycles, ghz);
- printf("%20llu stalled-cycles-frontend # %.2f%% frontend cycles idle \n", (unsigned long long)total_stalled_frontend, stalled_frontend_pct);
- printf("%20llu stalled-cycles-backend # %.2f%% backend cycles idle \n", (unsigned long long)total_stalled_backend, stalled_backend_pct);
- printf("%20llu branches # %.3f G/sec \n", (unsigned long long)total_branches, branches_per_sec / 1000000000.0);
- printf("%20llu branch-misses # %.2f%% of all branches \n", (unsigned long long)total_branch_misses, branch_miss_rate);
+ printf("%20llu instructions # %.2f insn per cycle \n", (unsigned long long)total_instructions, ipc);
+ printf("%56s# %.2f stalled cycles per insn \n", "", stalled_per_insn);
+ printf("%20llu cycles # %.3f GHz \n", (unsigned long long)total_cycles, ghz);
+ printf("%20llu stalled-cycles-frontend # %.2f%% frontend cycles idle \n", (unsigned long long)total_stalled_frontend, stalled_frontend_pct);
+ printf("%20llu stalled-cycles-backend # %.2f%% backend cycles idle \n", (unsigned long long)total_stalled_backend, stalled_backend_pct);
+ printf("%20llu branches # %.3f G/sec \n", (unsigned long long)total_branches, branches_per_sec / 1000000000.0);
+ printf("%20llu branch-misses # %.2f%% of all branches \n", (unsigned long long)total_branch_misses, branch_miss_rate);
printf("\n");
printf("Throughput: %.2f MIPS, %.2f Mcycles/sec\n", mips, mcps);
printf("\n");