summaryrefslogtreecommitdiff
path: root/mknes_bench.c
diff options
context:
space:
mode:
authorPeter Fors <peter.fors@mindkiller.com>2025-11-14 22:17:03 +0100
committerPeter Fors <peter.fors@mindkiller.com>2025-11-14 22:17:03 +0100
commit2174b3f369e59286ccd10348117a16e08c412508 (patch)
tree8ff6c7d02da221aad45fcdb03b22f09080a9c9aa /mknes_bench.c
parent46d0f6aeb1588b85852487e581a8b4c9c2401646 (diff)
Rearranged the ppu_state to be even more cacheline aware, gained another 1% performance
Diffstat (limited to 'mknes_bench.c')
-rw-r--r--mknes_bench.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/mknes_bench.c b/mknes_bench.c
index b064266..e7d53fa 100644
--- a/mknes_bench.c
+++ b/mknes_bench.c
@@ -333,17 +333,17 @@ static void run_benchmark(struct nes_state *nstate, uint32_t num_runs, uint32_t
// Calculate per-frame statistics using static storage
double *cycles_per_frame = &per_frame_storage[0];
- double *insn_per_frame = &per_frame_storage[num_runs];
+ double *ipc_per_run = &per_frame_storage[num_runs];
double *time_ms = &per_frame_storage[num_runs * 2];
for(uint32_t i = 0; i < num_runs; i++) {
cycles_per_frame[i] = (double)runs[i].cycles / frames_per_run;
- insn_per_frame[i] = (double)runs[i].instructions / frames_per_run;
+ ipc_per_run[i] = (double)runs[i].instructions / (double)runs[i].cycles;
time_ms[i] = (double)runs[i].time_ns / 1000000.0;
}
struct bench_stats cycles_stats = calculate_stats(cycles_per_frame, num_runs);
- struct bench_stats insn_stats = calculate_stats(insn_per_frame, num_runs);
+ struct bench_stats ipc_stats = calculate_stats(ipc_per_run, num_runs);
struct bench_stats time_stats = calculate_stats(time_ms, num_runs);
// Print results
@@ -368,7 +368,7 @@ static void run_benchmark(struct nes_state *nstate, uint32_t num_runs, uint32_t
printf("Throughput: %.2f MIPS, %.2f Mcycles/sec\n", mips, mcps);
printf("\n");
printf("cycles/frame mean=%9.0f sd=%6.0f relSD=%.3f%% n=%d\n", cycles_stats.mean, cycles_stats.sd, cycles_stats.rel_sd, cycles_stats.n);
- printf("insn/frame mean=%9.0f sd=%6.0f relSD=%.3f%% n=%d\n", insn_stats.mean, insn_stats.sd, insn_stats.rel_sd, insn_stats.n);
+ printf("IPC mean=%9.3f sd=%6.3f relSD=%.3f%% n=%d\n", ipc_stats.mean, ipc_stats.sd, ipc_stats.rel_sd, ipc_stats.n);
printf("time (ms) mean=%9.3f sd=%6.3f relSD=%.3f%% n=%d\n", time_stats.mean, time_stats.sd, time_stats.rel_sd, time_stats.n);
double fps = (double)frames_per_run / (time_stats.mean / 1000.0);