[sysprof/wip/chergert/mem-preload] memprof: add mode for visualizer



commit 85ecdb1e6b23b91ef1d433877a0a71bd2927870e
Author: Christian Hergert <chergert redhat com>
Date:   Fri Feb 7 12:36:41 2020 -0800

    memprof: add mode for visualizer
    
    We'll use this to render data differently later

 src/libsysprof-ui/sysprof-memprof-aid.c        |  6 +-----
 src/libsysprof-ui/sysprof-memprof-visualizer.c | 18 +++++++++++++++---
 src/libsysprof-ui/sysprof-memprof-visualizer.h |  2 +-
 3 files changed, 17 insertions(+), 9 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-memprof-aid.c b/src/libsysprof-ui/sysprof-memprof-aid.c
index 5b9fbda..4670b2c 100644
--- a/src/libsysprof-ui/sysprof-memprof-aid.c
+++ b/src/libsysprof-ui/sysprof-memprof-aid.c
@@ -183,11 +183,7 @@ sysprof_memprof_aid_present_finish (SysprofAid    *aid,
                             "visible", TRUE,
                             NULL);
 
-      row = g_object_new (SYSPROF_TYPE_MEMPROF_VISUALIZER,
-                          "title", _("Memory Allocations"),
-                          "height-request", 35,
-                          "visible", TRUE,
-                          NULL);
+      row = sysprof_memprof_visualizer_new (FALSE);
       sysprof_visualizer_group_insert (group, row, 0, FALSE);
 
       page = g_object_new (SYSPROF_TYPE_MEMPROF_PAGE,
diff --git a/src/libsysprof-ui/sysprof-memprof-visualizer.c b/src/libsysprof-ui/sysprof-memprof-visualizer.c
index 675019f..89d1b86 100644
--- a/src/libsysprof-ui/sysprof-memprof-visualizer.c
+++ b/src/libsysprof-ui/sysprof-memprof-visualizer.c
@@ -22,6 +22,7 @@
 
 #define G_LOG_DOMAIN "sysprof-memprof-visualizer"
 
+#include <glib/gi18n.h>
 #include <math.h>
 #include <stddef.h>
 
@@ -57,6 +58,8 @@ struct _SysprofMemprofVisualizer
 
   gint64                begin_time;
   gint64                duration;
+
+  guint                 mode : 1;
 };
 
 G_DEFINE_TYPE (SysprofMemprofVisualizer, sysprof_memprof_visualizer, SYSPROF_TYPE_VISUALIZER)
@@ -91,10 +94,19 @@ sysprof_memprof_visualizer_set_reader (SysprofVisualizer    *visualizer,
   gtk_widget_queue_draw (GTK_WIDGET (self));
 }
 
-SysprofMemprofVisualizer *
-sysprof_memprof_visualizer_new (void)
+SysprofVisualizer *
+sysprof_memprof_visualizer_new (gboolean total_allocs)
 {
-  return g_object_new (SYSPROF_TYPE_MEMPROF_VISUALIZER, NULL);
+  SysprofMemprofVisualizer *self;
+
+  self = g_object_new (SYSPROF_TYPE_MEMPROF_VISUALIZER,
+                       "title", _("Memory Allocations"),
+                       "height-request", 35,
+                       "visible", TRUE,
+                       NULL);
+  self->mode = !!total_allocs;
+
+  return SYSPROF_VISUALIZER (self);
 }
 
 static guint64
diff --git a/src/libsysprof-ui/sysprof-memprof-visualizer.h b/src/libsysprof-ui/sysprof-memprof-visualizer.h
index 1262bfd..04f078c 100644
--- a/src/libsysprof-ui/sysprof-memprof-visualizer.h
+++ b/src/libsysprof-ui/sysprof-memprof-visualizer.h
@@ -28,6 +28,6 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (SysprofMemprofVisualizer, sysprof_memprof_visualizer, SYSPROF, MEMPROF_VISUALIZER, 
SysprofVisualizer)
 
-SysprofMemprofVisualizer *sysprof_memprof_visualizer_new (void);
+SysprofVisualizer *sysprof_memprof_visualizer_new (gboolean total_allocs);
 
 G_END_DECLS


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