mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
cpu-visualizer-row: stop after locating counters
In practice, we do a single counter definition for the CPU definitions. So we can stop iterating the samples after we successfully locate an item.
This commit is contained in:
@ -35,19 +35,26 @@ sp_cpu_visualizer_counter_found (const SpCaptureFrame *frame,
|
||||
{
|
||||
const SpCaptureFrameCounterDefine *def = (SpCaptureFrameCounterDefine *)frame;
|
||||
GArray *counters = user_data;
|
||||
gboolean found = FALSE;
|
||||
|
||||
g_assert (frame->type == SP_CAPTURE_FRAME_CTRDEF);
|
||||
|
||||
/*
|
||||
* In practice, all the CPU counters are defined at once, so we can avoid
|
||||
* walking the rest of the capture by returning after we find our CTRDEF.
|
||||
*/
|
||||
|
||||
for (guint i = 0; i < def->n_counters; i++)
|
||||
{
|
||||
if (g_str_equal (def->counters[i].category, "CPU Percent"))
|
||||
{
|
||||
guint id = def->counters[i].id;
|
||||
g_array_append_val (counters, id);
|
||||
found = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
return !found;
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in New Issue
Block a user