mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-analyze: sort counter values by time
This commit is contained in:
@ -325,6 +325,22 @@ value_as_double (guint type,
|
|||||||
return .0;
|
return .0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
sort_by_time (gconstpointer aptr,
|
||||||
|
gconstpointer bptr)
|
||||||
|
{
|
||||||
|
const SysprofDocumentTimedValue *a = aptr;
|
||||||
|
const SysprofDocumentTimedValue *b = bptr;
|
||||||
|
|
||||||
|
if (a->time < b->time)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (a->time > b->time)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
_sysprof_document_counter_calculate_range (SysprofDocumentCounter *self)
|
_sysprof_document_counter_calculate_range (SysprofDocumentCounter *self)
|
||||||
{
|
{
|
||||||
@ -340,6 +356,8 @@ _sysprof_document_counter_calculate_range (SysprofDocumentCounter *self)
|
|||||||
if (self->values->len == 0)
|
if (self->values->len == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
g_array_sort (self->values, sort_by_time);
|
||||||
|
|
||||||
values = &g_array_index (self->values, SysprofDocumentTimedValue, 0);
|
values = &g_array_index (self->values, SysprofDocumentTimedValue, 0);
|
||||||
n_values = self->values->len;
|
n_values = self->values->len;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user