mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 07:00:53 +00:00
@ -459,8 +459,25 @@ sort_by_symbol_name (gconstpointer a,
|
|||||||
return g_utf8_collate (node_a->summary->symbol->name, node_b->summary->symbol->name);
|
return g_utf8_collate (node_a->summary->symbol->name, node_b->summary->symbol->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
sort_by_count (gconstpointer a,
|
||||||
|
gconstpointer b)
|
||||||
|
{
|
||||||
|
const SysprofCallgraphNode *node_a = *(const SysprofCallgraphNode * const *)a;
|
||||||
|
const SysprofCallgraphNode *node_b = *(const SysprofCallgraphNode * const *)b;
|
||||||
|
|
||||||
|
if (node_a->count > node_b->count)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (node_a->count < node_b->count)
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sort_children (SysprofCallgraphNode *node)
|
sort_children (SysprofCallgraphNode *node,
|
||||||
|
SysprofCallgraphFlags flags)
|
||||||
{
|
{
|
||||||
SysprofCallgraphNode **children;
|
SysprofCallgraphNode **children;
|
||||||
guint n_children = 0;
|
guint n_children = 0;
|
||||||
@ -471,7 +488,7 @@ sort_children (SysprofCallgraphNode *node)
|
|||||||
|
|
||||||
for (SysprofCallgraphNode *child = node->children; child; child = child->next)
|
for (SysprofCallgraphNode *child = node->children; child; child = child->next)
|
||||||
{
|
{
|
||||||
sort_children (child);
|
sort_children (child, flags);
|
||||||
n_children++;
|
n_children++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -480,7 +497,10 @@ sort_children (SysprofCallgraphNode *node)
|
|||||||
children[i++] = child;
|
children[i++] = child;
|
||||||
children[i] = NULL;
|
children[i] = NULL;
|
||||||
|
|
||||||
qsort (children, n_children, sizeof (SysprofCallgraphNode *), sort_by_symbol_name);
|
if (flags & SYSPROF_CALLGRAPH_FLAGS_LEFT_HEAVY)
|
||||||
|
qsort (children, n_children, sizeof (SysprofCallgraphNode *), sort_by_count);
|
||||||
|
else
|
||||||
|
qsort (children, n_children, sizeof (SysprofCallgraphNode *), sort_by_symbol_name);
|
||||||
|
|
||||||
node->children = children[0];
|
node->children = children[0];
|
||||||
node->children->prev = NULL;
|
node->children->prev = NULL;
|
||||||
@ -526,7 +546,7 @@ sysprof_callgraph_new_worker (GTask *task,
|
|||||||
/* Sort callgraph nodes alphabetically so that we can use them in the
|
/* Sort callgraph nodes alphabetically so that we can use them in the
|
||||||
* flamegraph without any further processing.
|
* flamegraph without any further processing.
|
||||||
*/
|
*/
|
||||||
sort_children (&self->root);
|
sort_children (&self->root, self->flags);
|
||||||
|
|
||||||
g_task_return_pointer (task, g_object_ref (self), g_object_unref);
|
g_task_return_pointer (task, g_object_ref (self), g_object_unref);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -99,6 +99,7 @@ typedef enum _SysprofCallgraphFlags
|
|||||||
SYSPROF_CALLGRAPH_FLAGS_BOTTOM_UP = 1 << 3,
|
SYSPROF_CALLGRAPH_FLAGS_BOTTOM_UP = 1 << 3,
|
||||||
SYSPROF_CALLGRAPH_FLAGS_CATEGORIZE_FRAMES = 1 << 4,
|
SYSPROF_CALLGRAPH_FLAGS_CATEGORIZE_FRAMES = 1 << 4,
|
||||||
SYSPROF_CALLGRAPH_FLAGS_IGNORE_PROCESS_0 = 1 << 5,
|
SYSPROF_CALLGRAPH_FLAGS_IGNORE_PROCESS_0 = 1 << 5,
|
||||||
|
SYSPROF_CALLGRAPH_FLAGS_LEFT_HEAVY = 1 << 6,
|
||||||
} SysprofCallgraphFlags;
|
} SysprofCallgraphFlags;
|
||||||
|
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
|||||||
@ -57,6 +57,7 @@ struct _SysprofCallgraphView
|
|||||||
guint hide_system_libraries : 1;
|
guint hide_system_libraries : 1;
|
||||||
guint ignore_process_0 : 1;
|
guint ignore_process_0 : 1;
|
||||||
guint include_threads : 1;
|
guint include_threads : 1;
|
||||||
|
guint left_heavy : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _SysprofCallgraphViewClass
|
struct _SysprofCallgraphViewClass
|
||||||
|
|||||||
@ -38,6 +38,7 @@ enum {
|
|||||||
PROP_HIDE_SYSTEM_LIBRARIES,
|
PROP_HIDE_SYSTEM_LIBRARIES,
|
||||||
PROP_IGNORE_PROCESS_0,
|
PROP_IGNORE_PROCESS_0,
|
||||||
PROP_INCLUDE_THREADS,
|
PROP_INCLUDE_THREADS,
|
||||||
|
PROP_LEFT_HEAVY,
|
||||||
PROP_TRACEABLES,
|
PROP_TRACEABLES,
|
||||||
PROP_UTILITY_SUMMARY,
|
PROP_UTILITY_SUMMARY,
|
||||||
PROP_UTILITY_TRACEABLES,
|
PROP_UTILITY_TRACEABLES,
|
||||||
@ -394,6 +395,10 @@ sysprof_callgraph_view_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, sysprof_callgraph_view_get_include_threads (self));
|
g_value_set_boolean (value, sysprof_callgraph_view_get_include_threads (self));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_LEFT_HEAVY:
|
||||||
|
g_value_set_boolean (value, sysprof_callgraph_view_get_left_heavy (self));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_TRACEABLES:
|
case PROP_TRACEABLES:
|
||||||
g_value_set_object (value, sysprof_callgraph_view_get_traceables (self));
|
g_value_set_object (value, sysprof_callgraph_view_get_traceables (self));
|
||||||
break;
|
break;
|
||||||
@ -445,6 +450,10 @@ sysprof_callgraph_view_set_property (GObject *object,
|
|||||||
sysprof_callgraph_view_set_include_threads (self, g_value_get_boolean (value));
|
sysprof_callgraph_view_set_include_threads (self, g_value_get_boolean (value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_LEFT_HEAVY:
|
||||||
|
sysprof_callgraph_view_set_left_heavy (self, g_value_get_boolean (value));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_TRACEABLES:
|
case PROP_TRACEABLES:
|
||||||
sysprof_callgraph_view_set_traceables (self, g_value_get_object (value));
|
sysprof_callgraph_view_set_traceables (self, g_value_get_object (value));
|
||||||
break;
|
break;
|
||||||
@ -499,6 +508,11 @@ sysprof_callgraph_view_class_init (SysprofCallgraphViewClass *klass)
|
|||||||
FALSE,
|
FALSE,
|
||||||
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
properties[PROP_LEFT_HEAVY] =
|
||||||
|
g_param_spec_boolean ("left-heavy", NULL, NULL,
|
||||||
|
FALSE,
|
||||||
|
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties[PROP_TRACEABLES] =
|
properties[PROP_TRACEABLES] =
|
||||||
g_param_spec_object ("traceables", NULL, NULL,
|
g_param_spec_object ("traceables", NULL, NULL,
|
||||||
G_TYPE_LIST_MODEL,
|
G_TYPE_LIST_MODEL,
|
||||||
@ -680,6 +694,9 @@ sysprof_callgraph_view_reload (SysprofCallgraphView *self)
|
|||||||
if (self->categorize_frames)
|
if (self->categorize_frames)
|
||||||
flags |= SYSPROF_CALLGRAPH_FLAGS_CATEGORIZE_FRAMES;
|
flags |= SYSPROF_CALLGRAPH_FLAGS_CATEGORIZE_FRAMES;
|
||||||
|
|
||||||
|
if (self->left_heavy)
|
||||||
|
flags |= SYSPROF_CALLGRAPH_FLAGS_LEFT_HEAVY;
|
||||||
|
|
||||||
sysprof_document_callgraph_async (self->document,
|
sysprof_document_callgraph_async (self->document,
|
||||||
flags,
|
flags,
|
||||||
self->traceables,
|
self->traceables,
|
||||||
@ -933,3 +950,27 @@ sysprof_callgraph_view_set_ignore_process_0 (SysprofCallgraphView *self,
|
|||||||
sysprof_callgraph_view_queue_reload (self);
|
sysprof_callgraph_view_queue_reload (self);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
sysprof_callgraph_view_get_left_heavy (SysprofCallgraphView *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self), FALSE);
|
||||||
|
|
||||||
|
return self->left_heavy;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sysprof_callgraph_view_set_left_heavy (SysprofCallgraphView *self,
|
||||||
|
gboolean left_heavy)
|
||||||
|
{
|
||||||
|
g_return_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self));
|
||||||
|
|
||||||
|
left_heavy = !!left_heavy;
|
||||||
|
|
||||||
|
if (self->left_heavy != left_heavy)
|
||||||
|
{
|
||||||
|
self->left_heavy = left_heavy;
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_LEFT_HEAVY]);
|
||||||
|
sysprof_callgraph_view_queue_reload (self);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -58,6 +58,9 @@ void sysprof_callgraph_view_set_include_threads (SysprofCallg
|
|||||||
gboolean sysprof_callgraph_view_get_hide_system_libraries (SysprofCallgraphView *self);
|
gboolean sysprof_callgraph_view_get_hide_system_libraries (SysprofCallgraphView *self);
|
||||||
void sysprof_callgraph_view_set_hide_system_libraries (SysprofCallgraphView *self,
|
void sysprof_callgraph_view_set_hide_system_libraries (SysprofCallgraphView *self,
|
||||||
gboolean hide_system_libraries);
|
gboolean hide_system_libraries);
|
||||||
|
gboolean sysprof_callgraph_view_get_left_heavy (SysprofCallgraphView *self);
|
||||||
|
void sysprof_callgraph_view_set_left_heavy (SysprofCallgraphView *self,
|
||||||
|
gboolean left_heavy);
|
||||||
|
|
||||||
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofCallgraphView, g_object_unref)
|
G_DEFINE_AUTOPTR_CLEANUP_FUNC (SysprofCallgraphView, g_object_unref)
|
||||||
|
|
||||||
|
|||||||
@ -94,6 +94,11 @@
|
|||||||
<lookup name="session">SysprofSamplesSection</lookup>
|
<lookup name="session">SysprofSamplesSection</lookup>
|
||||||
</lookup>
|
</lookup>
|
||||||
</binding>
|
</binding>
|
||||||
|
<binding name="left-heavy">
|
||||||
|
<lookup name="left-heavy" type="SysprofSession">
|
||||||
|
<lookup name="session">SysprofSamplesSection</lookup>
|
||||||
|
</lookup>
|
||||||
|
</binding>
|
||||||
<binding name="hide-system-libraries">
|
<binding name="hide-system-libraries">
|
||||||
<lookup name="hide-system-libraries" type="SysprofSession">
|
<lookup name="hide-system-libraries" type="SysprofSession">
|
||||||
<lookup name="session">SysprofSamplesSection</lookup>
|
<lookup name="session">SysprofSamplesSection</lookup>
|
||||||
|
|||||||
@ -43,6 +43,7 @@ struct _SysprofSession
|
|||||||
guint categorize_frames : 1;
|
guint categorize_frames : 1;
|
||||||
guint ignore_process_0 : 1;
|
guint ignore_process_0 : 1;
|
||||||
guint include_threads : 1;
|
guint include_threads : 1;
|
||||||
|
guint left_heavy : 1;
|
||||||
guint hide_system_libraries : 1;
|
guint hide_system_libraries : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -52,6 +53,7 @@ enum {
|
|||||||
PROP_DOCUMENT,
|
PROP_DOCUMENT,
|
||||||
PROP_DOCUMENT_TIME,
|
PROP_DOCUMENT_TIME,
|
||||||
PROP_FILTER,
|
PROP_FILTER,
|
||||||
|
PROP_LEFT_HEAVY,
|
||||||
PROP_HIDE_SYSTEM_LIBRARIES,
|
PROP_HIDE_SYSTEM_LIBRARIES,
|
||||||
PROP_IGNORE_PROCESS_0,
|
PROP_IGNORE_PROCESS_0,
|
||||||
PROP_INCLUDE_THREADS,
|
PROP_INCLUDE_THREADS,
|
||||||
@ -156,6 +158,10 @@ sysprof_session_get_property (GObject *object,
|
|||||||
g_value_set_boolean (value, self->include_threads);
|
g_value_set_boolean (value, self->include_threads);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_LEFT_HEAVY:
|
||||||
|
g_value_set_boolean (value, self->left_heavy);
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_SELECTED_TIME:
|
case PROP_SELECTED_TIME:
|
||||||
g_value_set_boxed (value, sysprof_session_get_selected_time (self));
|
g_value_set_boxed (value, sysprof_session_get_selected_time (self));
|
||||||
break;
|
break;
|
||||||
@ -211,6 +217,10 @@ sysprof_session_set_property (GObject *object,
|
|||||||
self->include_threads = g_value_get_boolean (value);
|
self->include_threads = g_value_get_boolean (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_LEFT_HEAVY:
|
||||||
|
self->left_heavy = g_value_get_boolean (value);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
@ -265,6 +275,11 @@ sysprof_session_class_init (SysprofSessionClass *klass)
|
|||||||
FALSE,
|
FALSE,
|
||||||
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
properties [PROP_LEFT_HEAVY] =
|
||||||
|
g_param_spec_boolean ("left-heavy", NULL, NULL,
|
||||||
|
FALSE,
|
||||||
|
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties [PROP_SELECTED_TIME] =
|
properties [PROP_SELECTED_TIME] =
|
||||||
g_param_spec_boxed ("selected-time", NULL, NULL,
|
g_param_spec_boxed ("selected-time", NULL, NULL,
|
||||||
SYSPROF_TYPE_TIME_SPAN,
|
SYSPROF_TYPE_TIME_SPAN,
|
||||||
|
|||||||
@ -224,6 +224,7 @@ sysprof_window_set_document (SysprofWindow *self,
|
|||||||
"hide-system-libraries",
|
"hide-system-libraries",
|
||||||
"ignore-process-0",
|
"ignore-process-0",
|
||||||
"include-threads",
|
"include-threads",
|
||||||
|
"left-heavy",
|
||||||
};
|
};
|
||||||
g_autofree char *title = NULL;
|
g_autofree char *title = NULL;
|
||||||
g_autofree char *full_title = NULL;
|
g_autofree char *full_title = NULL;
|
||||||
|
|||||||
@ -382,5 +382,12 @@
|
|||||||
<attribute name="action">win.callgraph.ignore-process-0</attribute>
|
<attribute name="action">win.callgraph.ignore-process-0</attribute>
|
||||||
</item>
|
</item>
|
||||||
</section>
|
</section>
|
||||||
|
<section>
|
||||||
|
<attribute name="label" translatable="yes">Flamegraph</attribute>
|
||||||
|
<item>
|
||||||
|
<attribute name="label" translatable="yes">Left Heavy</attribute>
|
||||||
|
<attribute name="action">win.callgraph.left-heavy</attribute>
|
||||||
|
</item>
|
||||||
|
</section>
|
||||||
</menu>
|
</menu>
|
||||||
</interface>
|
</interface>
|
||||||
|
|||||||
Reference in New Issue
Block a user