From bb4bea0261b824e87a6892dfc144f561ee134cd3 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sat, 18 May 2019 12:39:10 -0700 Subject: [PATCH] libsysprof-ui: add pixels counter --- src/libsysprof-ui/sysprof-visualizer-list.c | 22 +++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/libsysprof-ui/sysprof-visualizer-list.c b/src/libsysprof-ui/sysprof-visualizer-list.c index 0001608a..2e0f1811 100644 --- a/src/libsysprof-ui/sysprof-visualizer-list.c +++ b/src/libsysprof-ui/sysprof-visualizer-list.c @@ -42,6 +42,7 @@ typedef struct SysprofCaptureCursor *cursor; GHashTable *mark_groups; guint fps_counter; + guint pixels_counter; GArray *memory; guint has_cpu : 1; } Discovery; @@ -235,6 +236,9 @@ discover_new_rows_frame_cb (const SysprofCaptureFrame *frame, else if (!state->fps_counter && strstr (ctr->category, "gtk") != NULL && strstr (ctr->name, "fps") != NULL) state->fps_counter = ctr->id; + else if (!state->pixels_counter && + strstr (ctr->category, "gtk") != NULL && strstr (ctr->name, "frame pixels") != NULL) + state->pixels_counter = ctr->id; else if (strcmp ("Memory", ctr->category) == 0 && strcmp ("Used", ctr->name) == 0) { @@ -336,6 +340,24 @@ handle_capture_results (GObject *object, gtk_container_add (GTK_CONTAINER (self), row); } + if (state->pixels_counter) + { + GdkRGBA rgba; + GtkWidget *row = g_object_new (SYSPROF_TYPE_LINE_VISUALIZER_ROW, + /* Translators: amount of pixels drawn per frame. */ + "title", _("Pixel Bandwidth"), + "height-request", 35, + "selectable", FALSE, + "visible", TRUE, + "y-lower", 0.0, + NULL); + gdk_rgba_parse (&rgba, "#ad7fa8"); + sysprof_line_visualizer_row_add_counter (SYSPROF_LINE_VISUALIZER_ROW (row), state->pixels_counter, &rgba); + rgba.alpha = 0.3; + sysprof_line_visualizer_row_set_fill (SYSPROF_LINE_VISUALIZER_ROW (row), state->pixels_counter, &rgba); + gtk_container_add (GTK_CONTAINER (self), row); + } + if (g_hash_table_size (state->mark_groups) < 30) { GHashTableIter iter;