mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-analyze: add n-items property to callgraph frame
Also add a ==0 helper in is_leaf().
This commit is contained in:
@ -44,6 +44,7 @@ enum {
|
||||
PROP_0,
|
||||
PROP_CALLGRAPH,
|
||||
PROP_SYMBOL,
|
||||
PROP_N_ITEMS,
|
||||
N_PROPS
|
||||
};
|
||||
|
||||
@ -122,6 +123,10 @@ sysprof_callgraph_frame_get_property (GObject *object,
|
||||
g_value_set_object (value, self->callgraph);
|
||||
break;
|
||||
|
||||
case PROP_N_ITEMS:
|
||||
g_value_set_uint (value, g_list_model_get_n_items (G_LIST_MODEL (self)));
|
||||
break;
|
||||
|
||||
case PROP_SYMBOL:
|
||||
g_value_set_object (value, sysprof_callgraph_frame_get_symbol (self));
|
||||
break;
|
||||
@ -144,6 +149,11 @@ sysprof_callgraph_frame_class_init (SysprofCallgraphFrameClass *klass)
|
||||
SYSPROF_TYPE_CALLGRAPH,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
properties [PROP_N_ITEMS] =
|
||||
g_param_spec_uint ("n-items", NULL, NULL,
|
||||
0, G_MAXUINT, 0,
|
||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||
|
||||
properties [PROP_SYMBOL] =
|
||||
g_param_spec_object ("symbol", NULL, NULL,
|
||||
SYSPROF_TYPE_SYMBOL,
|
||||
@ -457,3 +467,11 @@ sysprof_callgraph_frame_list_traceables_finish (SysprofCallgraphFrame *self,
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
gboolean
|
||||
sysprof_callgraph_frame_is_leaf (SysprofCallgraphFrame *self)
|
||||
{
|
||||
g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_FRAME (self), 0);
|
||||
|
||||
return self->n_children == 0;
|
||||
}
|
||||
|
||||
@ -48,5 +48,7 @@ SYSPROF_AVAILABLE_IN_ALL
|
||||
GListModel *sysprof_callgraph_frame_list_traceables_finish (SysprofCallgraphFrame *self,
|
||||
GAsyncResult *result,
|
||||
GError **error);
|
||||
SYSPROF_AVAILABLE_IN_ALL
|
||||
gboolean sysprof_callgraph_frame_is_leaf (SysprofCallgraphFrame *self);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
Reference in New Issue
Block a user