tests/performance: add "--quiet" argument to performance

The default output is annoyingly verbose. You see

  Running test simple-construction
  simple-construction: Millions of constructed objects per second: 33.498
  Running test simple-construction1
  simple-construction1: Millions of constructed objects per second: 142.493
  Running test complex-construction
  complex-construction: Millions of constructed objects per second: 14.304
  Running test complex-construction1
  ...

where the "Running test" lines just clutter the output. In fact so much
so, that my terminal fills up and I don't see the output of all tests in
one page. The "Running test" line is not so useful, because I mostly
care about the test result, and that line already contains the test
name.

Add an option to silence this.
This commit is contained in:
Thomas Haller 2024-03-08 09:39:01 +01:00 committed by Philip Withnall
parent 65a59bde57
commit e5e3c37d22

View File

@ -31,11 +31,14 @@
#define TARGET_ROUND_TIME 0.008
static gboolean verbose = FALSE;
static gboolean quiet = FALSE;
static int test_length = DEFAULT_TEST_TIME;
static GOptionEntry cmd_entries[] = {
{"verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
"Print extra information", NULL},
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet,
"Print extra information", NULL},
{"seconds", 's', 0, G_OPTION_ARG_INT, &test_length,
"Time to run each test in seconds", NULL},
G_OPTION_ENTRY_NULL
@ -69,6 +72,7 @@ run_test (PerformanceTest *test)
double elapsed, min_elapsed, max_elapsed, avg_elapsed, factor;
GTimer *timer;
if (verbose || !quiet)
g_print ("Running test %s\n", test->name);
/* Set up test */