testgtk: More GTimeVal eradication

This commit is contained in:
Matthias Clasen 2020-07-31 13:37:29 -04:00
parent e0d1aac8a5
commit f136a6f51f

View File

@ -6029,7 +6029,7 @@ bench_iteration (GtkWidget *widget, void (* fn) (GtkWidget *widget))
static void
do_real_bench (GtkWidget *widget, void (* fn) (GtkWidget *widget), const char *name, int num)
{
GTimeVal tv0, tv1;
gint64 t0, t1;
double dt_first;
double dt;
int n;
@ -6041,19 +6041,17 @@ do_real_bench (GtkWidget *widget, void (* fn) (GtkWidget *widget), const char *n
printed_headers = TRUE;
}
g_get_current_time (&tv0);
bench_iteration (widget, fn);
g_get_current_time (&tv1);
t0 = g_get_monotonic_time ();
bench_iteration (widget, fn);
t1 = g_get_monotonic_time ();
dt_first = ((double)tv1.tv_sec - tv0.tv_sec) * 1000.0
+ (tv1.tv_usec - tv0.tv_usec) / 1000.0;
dt_first = ((double)(t1 - t0)) / 1000.0;
g_get_current_time (&tv0);
t0 = g_get_monotonic_time ();
for (n = 0; n < num - 1; n++)
bench_iteration (widget, fn);
g_get_current_time (&tv1);
dt = ((double)tv1.tv_sec - tv0.tv_sec) * 1000.0
+ (tv1.tv_usec - tv0.tv_usec) / 1000.0;
bench_iteration (widget, fn);
t1 = g_get_monotonic_time ();
dt = ((double)(t1 - t0)) / 1000.0;
g_print ("%s %5d ", pad (name, 20), num);
if (num > 1)