[sysprof] tests: add median to calculation



commit f1322de9e62957a6e6f63b43fc15c0293d0248dd
Author: Christian Hergert <chergert redhat com>
Date:   Mon Feb 24 15:15:20 2020 -0800

    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 dda7a1d..240687a 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);
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]