mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-analyze: add key property to counters
this can be handy for filtering.
This commit is contained in:
@ -44,6 +44,7 @@ enum {
|
||||
PROP_CATEGORY,
|
||||
PROP_DESCRIPTION,
|
||||
PROP_ID,
|
||||
PROP_KEY,
|
||||
PROP_MAX_VALUE,
|
||||
PROP_MIN_VALUE,
|
||||
PROP_NAME,
|
||||
@ -133,6 +134,10 @@ sysprof_document_counter_get_property (GObject *object,
|
||||
g_value_set_string (value, sysprof_document_counter_get_name (self));
|
||||
break;
|
||||
|
||||
case PROP_KEY:
|
||||
g_value_take_string (value, sysprof_document_counter_dup_key (self));
|
||||
break;
|
||||
|
||||
case PROP_ID:
|
||||
g_value_set_uint (value, sysprof_document_counter_get_id (self));
|
||||
break;
|
||||
@ -165,6 +170,11 @@ sysprof_document_counter_class_init (SysprofDocumentCounterClass *klass)
|
||||
NULL,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
properties [PROP_KEY] =
|
||||
g_param_spec_string ("key", NULL, NULL,
|
||||
NULL,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
properties [PROP_NAME] =
|
||||
g_param_spec_string ("name", NULL, NULL,
|
||||
NULL,
|
||||
@ -400,3 +410,11 @@ sysprof_document_counter_get_min_value (SysprofDocumentCounter *self)
|
||||
|
||||
return self->min_value;
|
||||
}
|
||||
|
||||
char *
|
||||
sysprof_document_counter_dup_key (SysprofDocumentCounter *self)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_DOCUMENT_COUNTER (self), NULL);
|
||||
|
||||
return g_strdup_printf ("%s/%s", self->category, self->name);
|
||||
}
|
||||
|
||||
@ -31,6 +31,8 @@ G_BEGIN_DECLS
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
G_DECLARE_FINAL_TYPE (SysprofDocumentCounter, sysprof_document_counter, SYSPROF, DOCUMENT_COUNTER, GObject)
|
||||
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
char *sysprof_document_counter_dup_key (SysprofDocumentCounter *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
const char *sysprof_document_counter_get_category (SysprofDocumentCounter *self);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
|
||||
Reference in New Issue
Block a user