[sysprof] tests: ensure we sort by time after pid/tid



commit 4fd20683672c4b05934a3aa0597274602b4d5a0f
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 18 12:00:08 2020 -0800

    tests: ensure we sort by time after pid/tid

 src/tests/find-temp-allocs.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/tests/find-temp-allocs.c b/src/tests/find-temp-allocs.c
index f2115e9..4a8e300 100644
--- a/src/tests/find-temp-allocs.c
+++ b/src/tests/find-temp-allocs.c
@@ -32,6 +32,7 @@ typedef struct
 {
   gint                  pid;
   gint                  tid;
+  gint64                time;
   SysprofCaptureAddress addr;
   gint64                size;
 } Alloc;
@@ -53,6 +54,11 @@ compare_alloc (gconstpointer a,
   else if (aptr->tid > bptr->tid)
     return 1;
 
+  if (aptr->time < bptr->time)
+    return -1;
+  else if (aptr->time > bptr->time)
+    return 1;
+
   if (aptr->addr < bptr->addr)
     return -1;
   else if (aptr->addr > bptr->addr)
@@ -84,6 +90,7 @@ find_temp_allocs (SysprofCaptureReader *reader)
 
           a.pid = ev->frame.pid;
           a.tid = ev->tid;
+          a.time = ev->frame.time;
           a.addr = ev->alloc_addr;
           a.size = ev->alloc_size;
 


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