This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository expedite.

View the commit online.

commit 3e295541f9ef3339b16f62e9c6ca79ab8aebac40
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Aug 2 16:39:54 2026 -0600

    add --cpu to pin the benchmark to a single CPU
    
    On a big.LITTLE machine the scheduler is free to move expedite between
    cluster types mid-run, and the two differ enough that results are not
    comparable. On an RK3399 (4x Cortex-A53 at 1.4GHz, 2x Cortex-A72 at
    1.8GHz) the same test measured 2.62 on an A53 and 4.53 on an A72.
    
    That is large enough to invent or hide an effect entirely: comparing two
    builds, or two configurations of the same build, can report a difference
    that is purely which cluster each run happened to land on.
    
        expedite -e buffer -t 74 -m --cpu=5
    
    Linux only; sched_setaffinity has no portable equivalent, so elsewhere
    the option reports that and exits rather than silently doing nothing.
    
    Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
---
 src/bin/main.c | 34 +++++++++++++++++++++++++++++++++-
 1 file changed, 33 insertions(+), 1 deletion(-)

diff --git a/src/bin/main.c b/src/bin/main.c
index 5d3ace8..d3a44f5 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -1,3 +1,10 @@
+#ifdef __linux__
+# ifndef _GNU_SOURCE
+#  define _GNU_SOURCE 1
+# endif
+# include <sched.h>
+#endif
+
 #include "main.h"
 
 #include <Ecore_Getopt.h>
@@ -1119,6 +1126,10 @@ static const Ecore_Getopt optdesc = {
     ECORE_GETOPT_STORE_TRUE('y', "async", "Enable async output"),
     ECORE_GETOPT_STORE_TRUE('a', "all", "Run all tests"),
     ECORE_GETOPT_STORE_FALSE('i', "tick", "Follow output animator tick"),
+    ECORE_GETOPT_STORE_INT('u', "cpu", "Pin the benchmark to one CPU, by number "
+                           "(see /proc/cpuinfo). On big.LITTLE the two cluster "
+                           "types differ enough that unpinned results are not "
+                           "comparable between runs"),
     ECORE_GETOPT_LICENSE('L', "license"),
     ECORE_GETOPT_COPYRIGHT('C', "copyright"),
     ECORE_GETOPT_VERSION('V', "version"),
@@ -1245,6 +1256,7 @@ main(int argc, char **argv)
    Eina_Bool async = EINA_FALSE;
    Eina_Bool all_tests = EINA_FALSE;
    Eina_Bool quit_option = EINA_FALSE;
+   int cpu = -1;
    Ecore_Getopt_Value values[] = {
      ECORE_GETOPT_VALUE_STR(engine),
      ECORE_GETOPT_VALUE_BOOL(quit_option),
@@ -1260,6 +1272,7 @@ main(int argc, char **argv)
      ECORE_GETOPT_VALUE_BOOL(async),
      ECORE_GETOPT_VALUE_BOOL(all_tests),
      ECORE_GETOPT_VALUE_BOOL(tick),
+     ECORE_GETOPT_VALUE_INT(cpu),
      ECORE_GETOPT_VALUE_BOOL(quit_option),
      ECORE_GETOPT_VALUE_BOOL(quit_option),
      ECORE_GETOPT_VALUE_BOOL(quit_option),
@@ -1284,7 +1297,26 @@ main(int argc, char **argv)
      {
         return 0;
      }
-   else if (resolution_list)
+
+   if (cpu >= 0)
+     {
+#ifdef __linux__
+        cpu_set_t set;
+
+        CPU_ZERO(&set);
+        CPU_SET(cpu, &set);
+        if (sched_setaffinity(0, sizeof(set), &set) != 0)
+          {
+             fprintf(stderr, "Could not pin to CPU %i.\n", cpu);
+             return -1;
+          }
+#else
+        fprintf(stderr, "--cpu is only implemented on Linux.\n");
+        return -1;
+#endif
+     }
+
+   if (resolution_list)
      {
         unsigned int i;
 

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to