mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-analyze: add value-type for counter
This commit is contained in:
@ -25,6 +25,7 @@
|
|||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
SysprofDocumentCounter *_sysprof_document_counter_new (guint id,
|
SysprofDocumentCounter *_sysprof_document_counter_new (guint id,
|
||||||
|
guint type,
|
||||||
GRefString *category,
|
GRefString *category,
|
||||||
GRefString *name,
|
GRefString *name,
|
||||||
GRefString *description);
|
GRefString *description);
|
||||||
|
|||||||
@ -29,6 +29,7 @@ struct _SysprofDocumentCounter
|
|||||||
GRefString *description;
|
GRefString *description;
|
||||||
GRefString *name;
|
GRefString *name;
|
||||||
guint id;
|
guint id;
|
||||||
|
guint type;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@ -95,6 +96,26 @@ sysprof_document_counter_class_init (SysprofDocumentCounterClass *klass)
|
|||||||
object_class->finalize = sysprof_document_counter_finalize;
|
object_class->finalize = sysprof_document_counter_finalize;
|
||||||
object_class->get_property = sysprof_document_counter_get_property;
|
object_class->get_property = sysprof_document_counter_get_property;
|
||||||
|
|
||||||
|
properties [PROP_ID] =
|
||||||
|
g_param_spec_uint ("id", NULL, NULL,
|
||||||
|
0, G_MAXUINT, 0,
|
||||||
|
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
properties [PROP_CATEGORY] =
|
||||||
|
g_param_spec_string ("category", NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
properties [PROP_DESCRIPTION] =
|
||||||
|
g_param_spec_string ("description", NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
properties [PROP_NAME] =
|
||||||
|
g_param_spec_string ("name", NULL, NULL,
|
||||||
|
NULL,
|
||||||
|
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,6 +126,7 @@ sysprof_document_counter_init (SysprofDocumentCounter *self)
|
|||||||
|
|
||||||
SysprofDocumentCounter *
|
SysprofDocumentCounter *
|
||||||
_sysprof_document_counter_new (guint id,
|
_sysprof_document_counter_new (guint id,
|
||||||
|
guint type,
|
||||||
GRefString *category,
|
GRefString *category,
|
||||||
GRefString *name,
|
GRefString *name,
|
||||||
GRefString *description)
|
GRefString *description)
|
||||||
@ -113,6 +135,7 @@ _sysprof_document_counter_new (guint id,
|
|||||||
|
|
||||||
self = g_object_new (SYSPROF_TYPE_DOCUMENT_COUNTER, NULL);
|
self = g_object_new (SYSPROF_TYPE_DOCUMENT_COUNTER, NULL);
|
||||||
self->id = id;
|
self->id = id;
|
||||||
|
self->type = type;
|
||||||
self->category = category;
|
self->category = category;
|
||||||
self->name = name;
|
self->name = name;
|
||||||
self->description = description;
|
self->description = description;
|
||||||
@ -151,3 +174,17 @@ sysprof_document_counter_get_id (SysprofDocumentCounter *self)
|
|||||||
|
|
||||||
return self->id;
|
return self->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GType
|
||||||
|
sysprof_document_counter_get_value_type (SysprofDocumentCounter *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_DOCUMENT_COUNTER (self), G_TYPE_INVALID);
|
||||||
|
|
||||||
|
if (self->type == SYSPROF_CAPTURE_COUNTER_INT64)
|
||||||
|
return G_TYPE_INT64;
|
||||||
|
|
||||||
|
if (self->type == SYSPROF_CAPTURE_COUNTER_DOUBLE)
|
||||||
|
return G_TYPE_DOUBLE;
|
||||||
|
|
||||||
|
return G_TYPE_INVALID;
|
||||||
|
}
|
||||||
|
|||||||
@ -39,5 +39,7 @@ SYSPROF_AVAILABLE_IN_ALL
|
|||||||
const char *sysprof_document_counter_get_name (SysprofDocumentCounter *self);
|
const char *sysprof_document_counter_get_name (SysprofDocumentCounter *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
guint sysprof_document_counter_get_id (SysprofDocumentCounter *self);
|
guint sysprof_document_counter_get_id (SysprofDocumentCounter *self);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
GType sysprof_document_counter_get_value_type (SysprofDocumentCounter *self);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
Reference in New Issue
Block a user