From e5e3c37d22f90597713af2dfa8c88c0647f7f24f Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 8 Mar 2024 09:39:01 +0100 Subject: [PATCH] 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. --- gobject/tests/performance/performance.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gobject/tests/performance/performance.c b/gobject/tests/performance/performance.c index 6e0570b61..c584f99ed 100644 --- a/gobject/tests/performance/performance.c +++ b/gobject/tests/performance/performance.c @@ -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,7 +72,8 @@ run_test (PerformanceTest *test) double elapsed, min_elapsed, max_elapsed, avg_elapsed, factor; GTimer *timer; - g_print ("Running test %s\n", test->name); + if (verbose || !quiet) + g_print ("Running test %s\n", test->name); /* Set up test */ timer = g_timer_new ();