mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-ui: track how many counters matched
This commit is contained in:
@ -68,7 +68,7 @@ sysprof_battery_aid_new (void)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_battery_aid_prepare (SysprofAid *self,
|
sysprof_battery_aid_prepare (SysprofAid *self,
|
||||||
SysprofProfiler *profiler)
|
SysprofProfiler *profiler)
|
||||||
{
|
{
|
||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
g_autoptr(SysprofSource) source = NULL;
|
g_autoptr(SysprofSource) source = NULL;
|
||||||
@ -175,6 +175,7 @@ sysprof_battery_aid_present_finish (SysprofAid *aid,
|
|||||||
{
|
{
|
||||||
g_autoptr(SysprofColorCycle) cycle = sysprof_color_cycle_new ();
|
g_autoptr(SysprofColorCycle) cycle = sysprof_color_cycle_new ();
|
||||||
SysprofVisualizerGroup *group;
|
SysprofVisualizerGroup *group;
|
||||||
|
guint found = 0;
|
||||||
|
|
||||||
group = g_object_new (SYSPROF_TYPE_VISUALIZER_GROUP,
|
group = g_object_new (SYSPROF_TYPE_VISUALIZER_GROUP,
|
||||||
"can-focus", TRUE,
|
"can-focus", TRUE,
|
||||||
@ -209,10 +210,12 @@ sysprof_battery_aid_present_finish (SysprofAid *aid,
|
|||||||
SYSPROF_VISUALIZER (row),
|
SYSPROF_VISUALIZER (row),
|
||||||
is_combined ? 0 : -1,
|
is_combined ? 0 : -1,
|
||||||
!is_combined);
|
!is_combined);
|
||||||
|
|
||||||
|
found++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counters->len > 0)
|
if (found > 0)
|
||||||
sysprof_display_add_group (present->display, group);
|
sysprof_display_add_group (present->display, group);
|
||||||
else
|
else
|
||||||
gtk_widget_destroy (GTK_WIDGET (group));
|
gtk_widget_destroy (GTK_WIDGET (group));
|
||||||
|
|||||||
@ -167,6 +167,7 @@ sysprof_rapl_aid_present_finish (SysprofAid *aid,
|
|||||||
g_autoptr(GHashTable) cat_to_row = g_hash_table_new (g_str_hash, g_str_equal);
|
g_autoptr(GHashTable) cat_to_row = g_hash_table_new (g_str_hash, g_str_equal);
|
||||||
SysprofVisualizerGroup *energy;
|
SysprofVisualizerGroup *energy;
|
||||||
SysprofVisualizer *all;
|
SysprofVisualizer *all;
|
||||||
|
guint found = 0;
|
||||||
|
|
||||||
energy = g_object_new (SYSPROF_TYPE_VISUALIZER_GROUP,
|
energy = g_object_new (SYSPROF_TYPE_VISUALIZER_GROUP,
|
||||||
"can-focus", TRUE,
|
"can-focus", TRUE,
|
||||||
@ -195,6 +196,7 @@ sysprof_rapl_aid_present_finish (SysprofAid *aid,
|
|||||||
|
|
||||||
sysprof_color_cycle_next (cycle, &rgba);
|
sysprof_color_cycle_next (cycle, &rgba);
|
||||||
sysprof_line_visualizer_add_counter (SYSPROF_LINE_VISUALIZER (all), ctr->id, &rgba);
|
sysprof_line_visualizer_add_counter (SYSPROF_LINE_VISUALIZER (all), ctr->id, &rgba);
|
||||||
|
found++;
|
||||||
}
|
}
|
||||||
else if (g_str_has_prefix (ctr->category, "RAPL "))
|
else if (g_str_has_prefix (ctr->category, "RAPL "))
|
||||||
{
|
{
|
||||||
@ -218,10 +220,14 @@ sysprof_rapl_aid_present_finish (SysprofAid *aid,
|
|||||||
|
|
||||||
sysprof_color_cycle_next (cycle, &rgba);
|
sysprof_color_cycle_next (cycle, &rgba);
|
||||||
sysprof_line_visualizer_add_counter (SYSPROF_LINE_VISUALIZER (row), ctr->id, &rgba);
|
sysprof_line_visualizer_add_counter (SYSPROF_LINE_VISUALIZER (row), ctr->id, &rgba);
|
||||||
|
found++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
sysprof_display_add_group (present->display, energy);
|
if (found > 0)
|
||||||
|
sysprof_display_add_group (present->display, energy);
|
||||||
|
else
|
||||||
|
gtk_widget_destroy (GTK_WIDGET (energy));
|
||||||
}
|
}
|
||||||
|
|
||||||
return counters != NULL;
|
return counters != NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user