mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 15:10:53 +00:00
libsysprof-gtk: give session a copy of document time
This way we don't have to constantly route through the document for it to determine relative axis information.
This commit is contained in:
@ -38,6 +38,7 @@ struct _SysprofSession
|
|||||||
SysprofAxis *visible_time_axis;
|
SysprofAxis *visible_time_axis;
|
||||||
SysprofAxis *selected_time_axis;
|
SysprofAxis *selected_time_axis;
|
||||||
|
|
||||||
|
SysprofTimeSpan document_time;
|
||||||
SysprofTimeSpan selected_time;
|
SysprofTimeSpan selected_time;
|
||||||
SysprofTimeSpan visible_time;
|
SysprofTimeSpan visible_time;
|
||||||
|
|
||||||
@ -48,6 +49,7 @@ struct _SysprofSession
|
|||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DOCUMENT,
|
PROP_DOCUMENT,
|
||||||
|
PROP_DOCUMENT_TIME,
|
||||||
PROP_FILTER,
|
PROP_FILTER,
|
||||||
PROP_HIDE_SYSTEM_LIBRARIES,
|
PROP_HIDE_SYSTEM_LIBRARIES,
|
||||||
PROP_INCLUDE_THREADS,
|
PROP_INCLUDE_THREADS,
|
||||||
@ -93,8 +95,7 @@ sysprof_session_set_document (SysprofSession *self,
|
|||||||
|
|
||||||
/* Select/show the entire document time span */
|
/* Select/show the entire document time span */
|
||||||
time_span = sysprof_document_get_time_span (document);
|
time_span = sysprof_document_get_time_span (document);
|
||||||
memcpy (&self->visible_time, time_span, sizeof *time_span);
|
self->selected_time = self->visible_time = self->document_time = *time_span;
|
||||||
memcpy (&self->selected_time, time_span, sizeof *time_span);
|
|
||||||
sysprof_session_update_axis (self);
|
sysprof_session_update_axis (self);
|
||||||
|
|
||||||
/* Discover tracks to show from the document */
|
/* Discover tracks to show from the document */
|
||||||
@ -129,6 +130,10 @@ sysprof_session_get_property (GObject *object,
|
|||||||
g_value_set_object (value, sysprof_session_get_document (self));
|
g_value_set_object (value, sysprof_session_get_document (self));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_DOCUMENT_TIME:
|
||||||
|
g_value_set_boxed (value, sysprof_session_get_document_time (self));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_FILTER:
|
case PROP_FILTER:
|
||||||
g_value_set_object (value, sysprof_session_get_filter (self));
|
g_value_set_object (value, sysprof_session_get_filter (self));
|
||||||
break;
|
break;
|
||||||
@ -207,6 +212,11 @@ sysprof_session_class_init (SysprofSessionClass *klass)
|
|||||||
SYSPROF_TYPE_DOCUMENT,
|
SYSPROF_TYPE_DOCUMENT,
|
||||||
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
properties [PROP_DOCUMENT_TIME] =
|
||||||
|
g_param_spec_boxed ("document-time", NULL, NULL,
|
||||||
|
SYSPROF_TYPE_TIME_SPAN,
|
||||||
|
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties [PROP_FILTER] =
|
properties [PROP_FILTER] =
|
||||||
g_param_spec_object ("filter", NULL, NULL,
|
g_param_spec_object ("filter", NULL, NULL,
|
||||||
GTK_TYPE_FILTER,
|
GTK_TYPE_FILTER,
|
||||||
@ -316,6 +326,14 @@ sysprof_session_get_visible_time (SysprofSession *self)
|
|||||||
return &self->visible_time;
|
return &self->visible_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SysprofTimeSpan *
|
||||||
|
sysprof_session_get_document_time (SysprofSession *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_SESSION (self), NULL);
|
||||||
|
|
||||||
|
return &self->document_time;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
sysprof_session_select_time (SysprofSession *self,
|
sysprof_session_select_time (SysprofSession *self,
|
||||||
const SysprofTimeSpan *time_span)
|
const SysprofTimeSpan *time_span)
|
||||||
|
|||||||
@ -39,6 +39,8 @@ SysprofSession *sysprof_session_new (SysprofDocument
|
|||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
SysprofDocument *sysprof_session_get_document (SysprofSession *self);
|
SysprofDocument *sysprof_session_get_document (SysprofSession *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
const SysprofTimeSpan *sysprof_session_get_document_time (SysprofSession *self);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
GtkFilter *sysprof_session_get_filter (SysprofSession *self);
|
GtkFilter *sysprof_session_get_filter (SysprofSession *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
const SysprofTimeSpan *sysprof_session_get_selected_time (SysprofSession *self);
|
const SysprofTimeSpan *sysprof_session_get_selected_time (SysprofSession *self);
|
||||||
|
|||||||
Reference in New Issue
Block a user