From d8aa1203334d174e8862f28b6c17b9be8ca62930 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jo=C3=A3o=20Magalh=C3=A3es?= <joamag@gmail.com>
Date: Mon, 5 Jun 2023 08:32:15 +0100
Subject: [PATCH] chore: better benchmark options

---
 frontends/sdl/src/main.rs | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/frontends/sdl/src/main.rs b/frontends/sdl/src/main.rs
index 276782a8..fd54138e 100644
--- a/frontends/sdl/src/main.rs
+++ b/frontends/sdl/src/main.rs
@@ -44,11 +44,11 @@ pub struct Benchmark {
 }
 
 impl Benchmark {
-    pub fn new(count: usize, cpu_only: Option<bool>, chunk_size: Option<usize>) -> Self {
+    pub fn new(count: usize, chunk_size: Option<usize>, cpu_only: Option<bool>) -> Self {
         Self {
             count,
-            cpu_only,
             chunk_size,
+            cpu_only,
         }
     }
 }
@@ -660,10 +660,17 @@ struct Args {
         default_value_t = 500000000,
         help = "The size of the benchmark in clock ticks"
     )]
-    bench_count: usize,
+    benchmark_count: usize,
+
+    #[arg(
+        long,
+        default_value_t = 1,
+        help = "The size of the benchmark in chunks"
+    )]
+    benchmark_chunk: usize,
 
     #[arg(long, default_value_t = false, help = "Run benchmark only for the CPU")]
-    cpu_only: bool,
+    benchmark_cpu: bool,
 
     #[arg(
         long,
@@ -736,7 +743,11 @@ fn main() {
     // not and runs it accordingly, note that if running in headless
     // mode the number of cycles to be run may be specified
     if args.benchmark {
-        emulator.run_benchmark(&Benchmark::new(args.bench_count, Some(args.cpu_only), None));
+        emulator.run_benchmark(&Benchmark::new(
+            args.benchmark_count,
+            Some(args.benchmark_chunk),
+            Some(args.benchmark_cpu),
+        ));
     } else if args.headless {
         emulator.run_headless(if args.cycles > 0 {
             Some(args.cycles)
-- 
GitLab