mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-analyze: create arrays for counter values
And assign them to the SysprofDocumentCounter so that they can pick them up once we index/add them during counter loading of ctrset.
This commit is contained in:
@ -28,6 +28,7 @@ SysprofDocumentCounter *_sysprof_document_counter_new (guint id,
|
||||
guint type,
|
||||
GRefString *category,
|
||||
GRefString *name,
|
||||
GRefString *description);
|
||||
GRefString *description,
|
||||
GArray *values);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
@ -28,6 +28,7 @@ struct _SysprofDocumentCounter
|
||||
GRefString *category;
|
||||
GRefString *description;
|
||||
GRefString *name;
|
||||
GArray *values;
|
||||
guint id;
|
||||
guint type;
|
||||
};
|
||||
@ -53,6 +54,7 @@ sysprof_document_counter_finalize (GObject *object)
|
||||
g_clear_pointer (&self->category, g_ref_string_release);
|
||||
g_clear_pointer (&self->description, g_ref_string_release);
|
||||
g_clear_pointer (&self->name, g_ref_string_release);
|
||||
g_clear_pointer (&self->values, g_array_unref);
|
||||
|
||||
G_OBJECT_CLASS (sysprof_document_counter_parent_class)->finalize (object);
|
||||
}
|
||||
@ -129,7 +131,8 @@ _sysprof_document_counter_new (guint id,
|
||||
guint type,
|
||||
GRefString *category,
|
||||
GRefString *name,
|
||||
GRefString *description)
|
||||
GRefString *description,
|
||||
GArray *values)
|
||||
{
|
||||
SysprofDocumentCounter *self;
|
||||
|
||||
@ -139,6 +142,7 @@ _sysprof_document_counter_new (guint id,
|
||||
self->category = category;
|
||||
self->name = name;
|
||||
self->description = description;
|
||||
self->values = values;
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
@ -52,7 +52,9 @@ struct _SysprofDocument
|
||||
GArray *frames;
|
||||
GMappedFile *mapped_file;
|
||||
const guint8 *base;
|
||||
|
||||
GListStore *counters;
|
||||
GHashTable *counter_id_to_values;
|
||||
|
||||
SysprofStrings *strings;
|
||||
|
||||
@ -212,6 +214,8 @@ sysprof_document_finalize (GObject *object)
|
||||
g_clear_pointer (&self->traceables, gtk_bitset_unref);
|
||||
|
||||
g_clear_object (&self->counters);
|
||||
g_clear_pointer (&self->counter_id_to_values, g_hash_table_unref);
|
||||
|
||||
g_clear_object (&self->mount_namespace);
|
||||
g_clear_object (&self->symbols);
|
||||
|
||||
@ -235,6 +239,8 @@ sysprof_document_init (SysprofDocument *self)
|
||||
self->frames = g_array_new (FALSE, FALSE, sizeof (SysprofDocumentFramePointer));
|
||||
|
||||
self->counters = g_list_store_new (SYSPROF_TYPE_DOCUMENT_COUNTER);
|
||||
self->counter_id_to_values = g_hash_table_new_full (NULL, NULL, NULL,
|
||||
(GDestroyNotify)g_array_unref);
|
||||
|
||||
self->ctrdefs = gtk_bitset_new_empty ();
|
||||
self->file_chunks = gtk_bitset_new_empty ();
|
||||
@ -453,6 +459,7 @@ sysprof_document_load_counters (SysprofDocument *self)
|
||||
|
||||
for (guint j = 0; j < n_counters; j++)
|
||||
{
|
||||
g_autoptr(GArray) values = g_array_new (FALSE, FALSE, 8);
|
||||
const char *category;
|
||||
const char *name;
|
||||
const char *description;
|
||||
@ -461,12 +468,17 @@ sysprof_document_load_counters (SysprofDocument *self)
|
||||
|
||||
sysprof_document_ctrdef_get_counter (ctrdef, j, &id, &type, &category, &name, &description);
|
||||
|
||||
g_hash_table_insert (self->counter_id_to_values,
|
||||
GUINT_TO_POINTER (id),
|
||||
g_array_ref (values));
|
||||
|
||||
g_ptr_array_add (counters,
|
||||
_sysprof_document_counter_new (id,
|
||||
type,
|
||||
sysprof_strings_get (self->strings, category),
|
||||
sysprof_strings_get (self->strings, name),
|
||||
sysprof_strings_get (self->strings, description)));
|
||||
sysprof_strings_get (self->strings, description),
|
||||
g_steal_pointer (&values)));
|
||||
}
|
||||
}
|
||||
while (gtk_bitset_iter_next (&iter, &i));
|
||||
|
||||
Reference in New Issue
Block a user