add scripts
authorLaurent MAZET <laurent.mazet@thalesgroup.com>
Wed, 1 Oct 2025 12:02:21 +0000 (14:02 +0200)
committerLaurent MAZET <laurent.mazet@thalesgroup.com>
Wed, 1 Oct 2025 12:02:21 +0000 (14:02 +0200)
gettable.awk [new file with mode: 0755]
test.c
test.sh [new file with mode: 0755]

diff --git a/gettable.awk b/gettable.awk
new file mode 100755 (executable)
index 0000000..bfb9175
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/awk -f
+
+BEGIN {
+    OFS=" & "
+    print "Test", "Load", "Minimum", "Average", "Maximun", "Standard Dev.", "25th %", "Median", "75th %"
+}
+
+/Test:/ {
+    sub (/^[^ ]* /, "")
+    test=$0
+}
+
+/Minimum/ { min=$3 }
+/Maximum/ { max=$3 }
+/Average/ { avg=$3 }
+/Standard/ { std=$4 }
+
+/25th/ { p25=$4 }
+/Median/ { med=$3 }
+/75th/ { p75=$4 }
+
+/Histogram/ {
+    print test, COMMENT, min, avg, max, std, p25, med, p75
+}
+# for p in 0 100; do ./gettable.awk -v COMMENT=$p% test-$p%.log; done > result.csv
diff --git a/test.c b/test.c
index 48e6407bca8356b45b9bf7469b6d507fce9ac417..838698fe0758dcb929fe2e6f162f2879cf89604a 100644 (file)
--- a/test.c
+++ b/test.c
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #include "stat.h"
 #include "test.h"
 /* static variables */
 
 char *progname = NULL;
-char *version = "1.1";
+char *version = "1.2";
 
 double abe_per = 0;
+int delay = 0;
 int do_stat = 0;
 int excl_first = 0;
 int hist_bin = 10;
@@ -32,8 +34,9 @@ extern int (*parse_arg_ext) (char *);
 int usage (int ret)
 {
     FILE *fd = ret ? stderr : stdout;
-    fprintf (fd, "usage: %s [-b int] [-h] [-n int] [-o file] [-s]\n", progname);
+    fprintf (fd, "usage: %s [-a int] [-b int] [-d int] [-e int] [-h] [-n int] [-o file] [-s]\n", progname);
     fprintf (fd, " -a: avoid aberrand valies (%g%%)\n", abe_per);
+    fprintf (fd, " -d: delay process start for (%ds)\n", delay);
     fprintf (fd, " -b: nb bins for histogram (%d)\n", hist_bin);
     fprintf (fd, " -e: exclude %d first tests\n", excl_first);
     fprintf (fd, " -h: help message\n");
@@ -93,6 +96,14 @@ int main (int argc, char *argv[])
             }
             hist_bin = atoi (arg);
             break;
+        case 'd':
+            arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
+            if (arg == NULL) {
+                fprintf (stderr, "%s: no delay specified\n", progname);
+                return usage (1);
+            }
+            delay = atoi (arg);
+            break;
         case 'e':
             arg = (arg[2]) ? arg + 2 : (--argc > 0) ? *(++argv) : NULL;
             if (arg == NULL) {
@@ -148,6 +159,13 @@ int main (int argc, char *argv[])
     dts_t *buffer = (dts_t *) calloc (nb, sizeof (dts_t));
     assert (buffer);
 
+    if (delay > 0) {
+        printf ("Delay start for %ds\n", delay);
+        for (int i = 0; i < 100 * delay; i++) {
+            usleep (10 * 1000);
+        }
+    }
+
     printf ("Test: %s\n", (message) ? message : "unknown");
 
     if (test (buffer, nb)) {
diff --git a/test.sh b/test.sh
new file mode 100755 (executable)
index 0000000..3e158a3
--- /dev/null
+++ b/test.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+export pid
+
+function run() {
+  for test in mutex semaphore thread mq pipe udp; do
+    ./getinfo.sh
+    pid=-1
+    { ./$test.exe -d 1 -n 10000 -s -o $test-$1.dat; \
+      kill -2 $(ps -e | awk '/[h]ackbench/ || /[s]leep/ { print $1 }') 2>/dev/null; } &
+    case "$1" in
+    0%) sleep 60;;
+    50%) ./hackbench -p -g 1 -f 1 -T 1 -P 1 -s $((100 * 1000)) -l $((2 * 1000 * 1000));;
+    100%) ./hackbench -p -g 20 -l $((100 * 1000));;
+    esac
+    echo "Cleaning..."
+    sleep 1
+  done
+}
+
+for p in 0 50 100; do
+  run $p% | tee test-$p%.log
+done