[sysprof] rapl: add counters for additonal core/cpu pairs



commit 98fd2fe35d8857a186c4da654c9bc00cf73fb19a
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jul 31 15:25:41 2019 -0700

    rapl: add counters for additonal core/cpu pairs

 src/libsysprof-ui/sysprof-rapl-aid.c | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
---
diff --git a/src/libsysprof-ui/sysprof-rapl-aid.c b/src/libsysprof-ui/sysprof-rapl-aid.c
index 398a020..beaa436 100644
--- a/src/libsysprof-ui/sysprof-rapl-aid.c
+++ b/src/libsysprof-ui/sysprof-rapl-aid.c
@@ -164,6 +164,7 @@ sysprof_rapl_aid_present_finish (SysprofAid    *aid,
   if ((counters = g_task_propagate_pointer (G_TASK (result), error)))
     {
       g_autoptr(SysprofColorCycle) cycle = sysprof_color_cycle_new ();
+      g_autoptr(GHashTable) cat_to_row = g_hash_table_new (g_str_hash, g_str_equal);
       SysprofVisualizerGroup *energy;
       SysprofVisualizer *all;
 
@@ -194,6 +195,28 @@ sysprof_rapl_aid_present_finish (SysprofAid    *aid,
               sysprof_color_cycle_next (cycle, &rgba);
               sysprof_line_visualizer_add_counter (SYSPROF_LINE_VISUALIZER (all), ctr->id, &rgba);
             }
+          else if (g_str_has_prefix (ctr->category, "RAPL "))
+            {
+              SysprofVisualizer *row;
+              GdkRGBA rgba;
+
+              row = g_hash_table_lookup (cat_to_row, ctr->category);
+
+              if (row == NULL)
+                {
+                  row = g_object_new (SYSPROF_TYPE_LINE_VISUALIZER,
+                                      "title", ctr->category,
+                                      "height-request", 20,
+                                      "visible", FALSE,
+                                      "y-lower", 0.0,
+                                      NULL);
+                  g_hash_table_insert (cat_to_row, (gchar *)ctr->category, row);
+                  sysprof_visualizer_group_insert (energy, SYSPROF_VISUALIZER (row), -1, TRUE);
+                }
+
+              sysprof_color_cycle_next (cycle, &rgba);
+              sysprof_line_visualizer_add_counter (SYSPROF_LINE_VISUALIZER (row), ctr->id, &rgba);
+            }
         }
 
       sysprof_display_add_group (present->display, energy);


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