From bc21b47315ac24023117a1de5b00925d2c30b9ac Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Wed, 22 May 2019 11:37:56 -0700 Subject: [PATCH] libsysprof-ui: add section for counter values --- src/libsysprof-ui/sysprof-capture-view.c | 16 ++++++++++++++++ src/libsysprof-ui/sysprof-marks-model.c | 3 ++- src/libsysprof-ui/ui/sysprof-capture-view.ui | 13 +++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/libsysprof-ui/sysprof-capture-view.c b/src/libsysprof-ui/sysprof-capture-view.c index 5992660f..a457ea17 100644 --- a/src/libsysprof-ui/sysprof-capture-view.c +++ b/src/libsysprof-ui/sysprof-capture-view.c @@ -56,6 +56,7 @@ typedef struct GtkStack *stack; SysprofCallgraphView *callgraph_view; SysprofDetailsView *details_view; + SysprofMarksView *counters_view; SysprofMarksView *marks_view; SysprofVisualizerView *visualizer_view; SysprofZoomManager *zoom_manager; @@ -455,6 +456,9 @@ sysprof_capture_view_scan_finish (SysprofCaptureView *self, if (!priv->features.has_marks) gtk_widget_hide (GTK_WIDGET (priv->marks_view)); + if (!priv->features.has_counters) + gtk_widget_hide (GTK_WIDGET (priv->counters_view)); + g_clear_pointer (&priv->mark_stats, g_hash_table_unref); if ((stats = g_object_get_data (G_OBJECT (result), "MARK_STAT"))) priv->mark_stats = g_hash_table_ref (stats); @@ -576,6 +580,17 @@ sysprof_capture_view_load_scan_cb (GObject *object, sysprof_visualizer_view_set_reader (priv->visualizer_view, state->reader); + if (priv->features.has_counters) + { + state->n_active++; + sysprof_marks_view_load_async (priv->counters_view, + state->reader, + state->selection, + g_task_get_cancellable (task), + sysprof_capture_view_load_marks_cb, + g_object_ref (task)); + } + state->n_active++; sysprof_marks_view_load_async (priv->marks_view, state->reader, @@ -774,6 +789,7 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass) gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-capture-view.ui"); gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, callgraph_view); gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, details_view); + gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, counters_view); gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, marks_view); gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, stack); gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, stack_switcher); diff --git a/src/libsysprof-ui/sysprof-marks-model.c b/src/libsysprof-ui/sysprof-marks-model.c index e3f2c213..c013489d 100644 --- a/src/libsysprof-ui/sysprof-marks-model.c +++ b/src/libsysprof-ui/sysprof-marks-model.c @@ -361,10 +361,11 @@ cursor_foreach_cb (const SysprofCaptureFrame *frame, item.end_time = frame->time; item.group = ctr->category; item.name = ctr->name; - item.value = values->values[j]; item.is_counter = TRUE; item.counter_type = ctr->type; + memcpy (&item.value, &values->values[j], sizeof item.value); + g_array_append_val (self->items, item); } } diff --git a/src/libsysprof-ui/ui/sysprof-capture-view.ui b/src/libsysprof-ui/ui/sysprof-capture-view.ui index 096b361b..1605e7ea 100644 --- a/src/libsysprof-ui/ui/sysprof-capture-view.ui +++ b/src/libsysprof-ui/ui/sysprof-capture-view.ui @@ -131,6 +131,7 @@ + marks zoom_manager true @@ -140,6 +141,18 @@ timings + + + counters + zoom_manager + true + + + + _Counters + counters + + true