mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
wire up marks reader
This commit is contained in:
@ -5,6 +5,7 @@ libsysprof_ui_public_sources = [
|
||||
'sysprof-empty-state-view.c',
|
||||
'sysprof-failed-state-view.c',
|
||||
'sysprof-line-visualizer-row.c',
|
||||
'sysprof-marks-model.c',
|
||||
'sysprof-marks-view.c',
|
||||
'sysprof-mark-visualizer-row.c',
|
||||
'sysprof-model-filter.c',
|
||||
@ -23,7 +24,6 @@ libsysprof_ui_private_sources = [
|
||||
'pointcache.c',
|
||||
'rectangles.c',
|
||||
'sysprof-cell-renderer-percent.c',
|
||||
'sysprof-marks-model.c',
|
||||
'sysprof-theme-manager.c',
|
||||
'../stackstash.c',
|
||||
]
|
||||
@ -35,6 +35,7 @@ libsysprof_ui_public_headers = [
|
||||
'sysprof-empty-state-view.h',
|
||||
'sysprof-failed-state-view.h',
|
||||
'sysprof-line-visualizer-row.h',
|
||||
'sysprof-marks-model.h',
|
||||
'sysprof-marks-view.h',
|
||||
'sysprof-mark-visualizer-row.h',
|
||||
'sysprof-model-filter.h',
|
||||
|
||||
@ -33,8 +33,10 @@ struct _SysprofMarksModel
|
||||
|
||||
typedef struct
|
||||
{
|
||||
gint64 begin_time;
|
||||
gint64 end_time;
|
||||
gint64 begin_time;
|
||||
gint64 end_time;
|
||||
const gchar *group;
|
||||
const gchar *name;
|
||||
} Item;
|
||||
|
||||
static void
|
||||
@ -84,6 +86,8 @@ cursor_foreach_cb (const SysprofCaptureFrame *frame,
|
||||
|
||||
item.begin_time = frame->time;
|
||||
item.end_time = item.begin_time + mark->duration;
|
||||
item.group = g_string_chunk_insert_const (self->chunks, mark->group);
|
||||
item.name = g_string_chunk_insert_const (self->chunks, mark->name);
|
||||
|
||||
g_array_append_val (self->items, item);
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include "sysprof-marks-model.h"
|
||||
#include "sysprof-marks-view.h"
|
||||
|
||||
typedef struct
|
||||
@ -52,9 +53,33 @@ sysprof_marks_view_new (void)
|
||||
return g_object_new (SYSPROF_TYPE_MARKS_VIEW, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
new_marks_model_cb (GObject *object,
|
||||
GAsyncResult *result,
|
||||
gpointer user_data)
|
||||
{
|
||||
g_autoptr(SysprofMarksView) self = user_data;
|
||||
SysprofMarksViewPrivate *priv = sysprof_marks_view_get_instance_private (self);
|
||||
g_autoptr(SysprofMarksModel) model = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
g_assert (SYSPROF_IS_MARKS_VIEW (self));
|
||||
g_assert (G_IS_ASYNC_RESULT (result));
|
||||
|
||||
if (!(model = sysprof_marks_model_new_finish (result, &error)))
|
||||
g_warning ("Failed to load marks model: %s", error->message);
|
||||
else
|
||||
gtk_tree_view_set_model (priv->tree_view, GTK_TREE_MODEL (model));
|
||||
}
|
||||
|
||||
void
|
||||
sysprof_marks_view_set_reader (SysprofMarksView *self,
|
||||
SysprofCaptureReader *reader)
|
||||
{
|
||||
g_return_if_fail (SYSPROF_IS_MARKS_VIEW (self));
|
||||
|
||||
sysprof_marks_model_new_async (reader,
|
||||
NULL,
|
||||
new_marks_model_cb,
|
||||
g_object_ref (self));
|
||||
}
|
||||
|
||||
@ -32,6 +32,7 @@ G_BEGIN_DECLS
|
||||
# include "sysprof-empty-state-view.h"
|
||||
# include "sysprof-failed-state-view.h"
|
||||
# include "sysprof-line-visualizer-row.h"
|
||||
# include "sysprof-marks-model.h"
|
||||
# include "sysprof-marks-view.h"
|
||||
# include "sysprof-mark-visualizer-row.h"
|
||||
# include "sysprof-model-filter.h"
|
||||
|
||||
@ -269,6 +269,8 @@ sysprof_window_build_profile (SysprofWindow *self)
|
||||
self->refilter_cancellable,
|
||||
sysprof_window_build_profile_cb,
|
||||
g_object_ref (self));
|
||||
|
||||
sysprof_marks_view_set_reader (self->marks_view, self->reader);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -835,6 +837,7 @@ sysprof_window_class_init (SysprofWindowClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, info_bar);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, info_bar_label);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, info_bar_revealer);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, marks_view);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, paned);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, profiler_menu_button);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofWindow, record_button);
|
||||
|
||||
Reference in New Issue
Block a user