mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-11 15:40:53 +00:00
libsysprof-ui: add callgraph loading dialog
This can lag a bit on big profiles, so add a loading page while we generate the callgraph in a thread.
This commit is contained in:
@ -60,6 +60,7 @@ typedef struct
|
|||||||
GQueue *history;
|
GQueue *history;
|
||||||
|
|
||||||
guint profile_size;
|
guint profile_size;
|
||||||
|
guint loading;
|
||||||
} SysprofCallgraphViewPrivate;
|
} SysprofCallgraphViewPrivate;
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (SysprofCallgraphView, sysprof_callgraph_view, GTK_TYPE_BIN)
|
G_DEFINE_TYPE_WITH_PRIVATE (SysprofCallgraphView, sysprof_callgraph_view, GTK_TYPE_BIN)
|
||||||
@ -1203,3 +1204,22 @@ sysprof_callgraph_view_get_n_functions (SysprofCallgraphView *self)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_sysprof_callgraph_view_set_loading (SysprofCallgraphView *self,
|
||||||
|
gboolean loading)
|
||||||
|
{
|
||||||
|
SysprofCallgraphViewPrivate *priv = sysprof_callgraph_view_get_instance_private (self);
|
||||||
|
|
||||||
|
g_return_if_fail (SYSPROF_IS_CALLGRAPH_VIEW (self));
|
||||||
|
|
||||||
|
if (loading)
|
||||||
|
priv->loading++;
|
||||||
|
else
|
||||||
|
priv->loading--;
|
||||||
|
|
||||||
|
if (priv->loading)
|
||||||
|
gtk_stack_set_visible_child_name (priv->stack, "loading");
|
||||||
|
else
|
||||||
|
gtk_stack_set_visible_child_name (priv->stack, "callgraph");
|
||||||
|
}
|
||||||
|
|||||||
@ -254,6 +254,7 @@ sysprof_capture_view_generate_callgraph_async (SysprofCaptureView *self,
|
|||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
|
SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (self);
|
||||||
g_autoptr(SysprofCaptureReader) copy = NULL;
|
g_autoptr(SysprofCaptureReader) copy = NULL;
|
||||||
g_autoptr(SysprofProfile) callgraph = NULL;
|
g_autoptr(SysprofProfile) callgraph = NULL;
|
||||||
g_autoptr(GTask) task = NULL;
|
g_autoptr(GTask) task = NULL;
|
||||||
@ -267,6 +268,8 @@ sysprof_capture_view_generate_callgraph_async (SysprofCaptureView *self,
|
|||||||
g_task_set_source_tag (task, sysprof_capture_view_generate_callgraph_async);
|
g_task_set_source_tag (task, sysprof_capture_view_generate_callgraph_async);
|
||||||
sysprof_capture_view_monitor_task (self, task);
|
sysprof_capture_view_monitor_task (self, task);
|
||||||
|
|
||||||
|
_sysprof_callgraph_view_set_loading (priv->callgraph_view, TRUE);
|
||||||
|
|
||||||
copy = sysprof_capture_reader_copy (reader);
|
copy = sysprof_capture_reader_copy (reader);
|
||||||
callgraph = sysprof_callgraph_profile_new_with_selection (selection);
|
callgraph = sysprof_callgraph_profile_new_with_selection (selection);
|
||||||
sysprof_profile_set_reader (callgraph, copy);
|
sysprof_profile_set_reader (callgraph, copy);
|
||||||
@ -281,9 +284,13 @@ sysprof_capture_view_generate_callgraph_finish (SysprofCaptureView *self,
|
|||||||
GAsyncResult *result,
|
GAsyncResult *result,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
|
SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (self);
|
||||||
|
|
||||||
g_assert (SYSPROF_IS_CAPTURE_VIEW (self));
|
g_assert (SYSPROF_IS_CAPTURE_VIEW (self));
|
||||||
g_assert (G_IS_TASK (result));
|
g_assert (G_IS_TASK (result));
|
||||||
|
|
||||||
|
_sysprof_callgraph_view_set_loading (priv->callgraph_view, FALSE);
|
||||||
|
|
||||||
return g_task_propagate_boolean (G_TASK (result), error);
|
return g_task_propagate_boolean (G_TASK (result), error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -50,6 +50,8 @@ void _sysprof_rounded_rectangle (cairo_t
|
|||||||
gint y_radius);
|
gint y_radius);
|
||||||
gchar *_sysprof_format_duration (gint64 duration);
|
gchar *_sysprof_format_duration (gint64 duration);
|
||||||
void _sysprof_callgraph_view_set_failed (SysprofCallgraphView *self);
|
void _sysprof_callgraph_view_set_failed (SysprofCallgraphView *self);
|
||||||
|
void _sysprof_callgraph_view_set_loading (SysprofCallgraphView *self,
|
||||||
|
gboolean loading);
|
||||||
void _sysprof_display_focus_record (SysprofDisplay *self);
|
void _sysprof_display_focus_record (SysprofDisplay *self);
|
||||||
void _sysprof_profiler_assistant_focus_record (SysprofProfilerAssistant *self);
|
void _sysprof_profiler_assistant_focus_record (SysprofProfilerAssistant *self);
|
||||||
|
|
||||||
|
|||||||
@ -207,6 +207,17 @@
|
|||||||
<property name="name">callgraph</property>
|
<property name="name">callgraph</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="SysprofEmptyStateView">
|
||||||
|
<property name="icon-name">content-loading-symbolic</property>
|
||||||
|
<property name="title" translatable="yes">Generating Callgraph</property>
|
||||||
|
<property name="subtitle" translatable="yes">Sysprof is busy creating the selected callgraph.</property>
|
||||||
|
<property name="visible">true</property>
|
||||||
|
</object>
|
||||||
|
<packing>
|
||||||
|
<property name="name">loading</property>
|
||||||
|
</packing>
|
||||||
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="SysprofEmptyStateView">
|
<object class="SysprofEmptyStateView">
|
||||||
<property name="icon-name">computer-fail-symbolic</property>
|
<property name="icon-name">computer-fail-symbolic</property>
|
||||||
|
|||||||
Reference in New Issue
Block a user