gobject/performance: support sub-seconds test lengths on the command line

One test round aims to run for 8msec (TARGET_ROUND_TIME).

As the "--seconds" parameter previously took whole integer numbers, that
meant that we would run at least 125 rounds.

For a quick run, we should also support even faster runs, e.g. to select
only 0.5 seconds.
This commit is contained in:
Thomas Haller 2025-02-26 18:45:38 +01:00
parent a88a58a23a
commit fa66978cd5

View File

@ -33,7 +33,7 @@
static gboolean verbose = FALSE; static gboolean verbose = FALSE;
static gboolean quiet = FALSE; static gboolean quiet = FALSE;
static int test_length = DEFAULT_TEST_TIME; static double test_length = DEFAULT_TEST_TIME;
static double test_factor = 0; static double test_factor = 0;
static GTimer *global_timer = NULL; static GTimer *global_timer = NULL;
@ -42,7 +42,7 @@ static GOptionEntry cmd_entries[] = {
"Print extra information", NULL}, "Print extra information", NULL},
{"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet, {"quiet", 'q', 0, G_OPTION_ARG_NONE, &quiet,
"Print extra information", NULL}, "Print extra information", NULL},
{"seconds", 's', 0, G_OPTION_ARG_INT, &test_length, {"seconds", 's', 0, G_OPTION_ARG_DOUBLE, &test_length,
"Time to run each test in seconds", NULL}, "Time to run each test in seconds", NULL},
{"factor", 'f', 0, G_OPTION_ARG_DOUBLE, &test_factor, {"factor", 'f', 0, G_OPTION_ARG_DOUBLE, &test_factor,
"Use a fixed factor for sample runs (also $GLIB_PERFORMANCE_FACTOR)", NULL}, "Use a fixed factor for sample runs (also $GLIB_PERFORMANCE_FACTOR)", NULL},