From f1322de9e62957a6e6f63b43fc15c0293d0248dd Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Mon, 24 Feb 2020 15:15:20 -0800 Subject: [PATCH] tests: add median to calculation --- src/tests/allocs-within-mark.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tests/allocs-within-mark.c b/src/tests/allocs-within-mark.c index dda7a1d2..240687a6 100644 --- a/src/tests/allocs-within-mark.c +++ b/src/tests/allocs-within-mark.c @@ -163,17 +163,18 @@ allocs_within_mark (SysprofCaptureReader *reader, t1 = (iv->begin - begin) / (gdouble)SYSPROF_NSEC_PER_SEC; t2 = (iv->end - begin) / (gdouble)SYSPROF_NSEC_PER_SEC; - g_print ("%lf-%lf: %s\n", - t1, t2, size); + g_print ("%lf-%lf: %s\n", t1, t2, size); } if (intervals->len) { + const Interval *iv = &g_array_index (intervals, Interval, intervals->len/2); g_autofree gchar *minstr = g_format_size_full (st.min, G_FORMAT_SIZE_IEC_UNITS); g_autofree gchar *maxstr = g_format_size_full (st.max, G_FORMAT_SIZE_IEC_UNITS); g_autofree gchar *avgstr = g_format_size_full (st.total/(gdouble)intervals->len, G_FORMAT_SIZE_IEC_UNITS); + g_autofree gchar *medstr = g_format_size_full (iv->allocated, G_FORMAT_SIZE_IEC_UNITS); - g_print ("Min: %s, Max: %s, Avg: %s\n", minstr, maxstr, avgstr); + g_print ("Min: %s, Max: %s, Avg: %s, Median: %s\n", minstr, maxstr, avgstr, medstr); } }