mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 07:00:53 +00:00
sysprof: sample items for mark chart row
This ensures that the row itself is filtered. I thought we had got this done earlier but it did not apply to the marks in the series.
This commit is contained in:
@ -21,6 +21,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include "sysprof-mark-chart-item-private.h"
|
#include "sysprof-mark-chart-item-private.h"
|
||||||
|
#include "sysprof-sampled-model.h"
|
||||||
#include "sysprof-time-filter-model.h"
|
#include "sysprof-time-filter-model.h"
|
||||||
|
|
||||||
struct _SysprofMarkChartItem
|
struct _SysprofMarkChartItem
|
||||||
@ -29,11 +30,14 @@ struct _SysprofMarkChartItem
|
|||||||
SysprofSession *session;
|
SysprofSession *session;
|
||||||
SysprofMarkCatalog *catalog;
|
SysprofMarkCatalog *catalog;
|
||||||
SysprofTimeFilterModel *filtered;
|
SysprofTimeFilterModel *filtered;
|
||||||
|
SysprofSampledModel *sampled;
|
||||||
SysprofSeries *series;
|
SysprofSeries *series;
|
||||||
|
guint max_items;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
PROP_MAX_ITEMS,
|
||||||
PROP_SESSION,
|
PROP_SESSION,
|
||||||
PROP_CATALOG,
|
PROP_CATALOG,
|
||||||
PROP_SERIES,
|
PROP_SERIES,
|
||||||
@ -54,7 +58,7 @@ sysprof_mark_chart_item_constructed (GObject *object)
|
|||||||
if (self->catalog == NULL || self->session == NULL)
|
if (self->catalog == NULL || self->session == NULL)
|
||||||
g_return_if_reached ();
|
g_return_if_reached ();
|
||||||
|
|
||||||
sysprof_time_filter_model_set_model (self->filtered, G_LIST_MODEL (self->catalog));
|
sysprof_sampled_model_set_model (self->sampled, G_LIST_MODEL (self->catalog));
|
||||||
|
|
||||||
g_object_bind_property (self->session, "selected-time",
|
g_object_bind_property (self->session, "selected-time",
|
||||||
self->filtered, "time-span",
|
self->filtered, "time-span",
|
||||||
@ -69,6 +73,7 @@ sysprof_mark_chart_item_dispose (GObject *object)
|
|||||||
g_clear_object (&self->session);
|
g_clear_object (&self->session);
|
||||||
g_clear_object (&self->catalog);
|
g_clear_object (&self->catalog);
|
||||||
g_clear_object (&self->filtered);
|
g_clear_object (&self->filtered);
|
||||||
|
g_clear_object (&self->sampled);
|
||||||
g_clear_object (&self->series);
|
g_clear_object (&self->series);
|
||||||
|
|
||||||
G_OBJECT_CLASS (sysprof_mark_chart_item_parent_class)->dispose (object);
|
G_OBJECT_CLASS (sysprof_mark_chart_item_parent_class)->dispose (object);
|
||||||
@ -88,6 +93,10 @@ sysprof_mark_chart_item_get_property (GObject *object,
|
|||||||
g_value_set_object (value, sysprof_mark_chart_item_get_catalog (self));
|
g_value_set_object (value, sysprof_mark_chart_item_get_catalog (self));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_MAX_ITEMS:
|
||||||
|
g_value_set_uint (value, self->max_items);
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_SESSION:
|
case PROP_SESSION:
|
||||||
g_value_set_object (value, sysprof_mark_chart_item_get_session (self));
|
g_value_set_object (value, sysprof_mark_chart_item_get_session (self));
|
||||||
break;
|
break;
|
||||||
@ -119,6 +128,11 @@ sysprof_mark_chart_item_set_property (GObject *object,
|
|||||||
self->session = g_value_dup_object (value);
|
self->session = g_value_dup_object (value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_MAX_ITEMS:
|
||||||
|
self->max_items = g_value_get_uint (value);
|
||||||
|
sysprof_sampled_model_set_max_items (self->sampled, self->max_items);
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
@ -139,6 +153,12 @@ sysprof_mark_chart_item_class_init (SysprofMarkChartItemClass *klass)
|
|||||||
SYSPROF_TYPE_MARK_CATALOG,
|
SYSPROF_TYPE_MARK_CATALOG,
|
||||||
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
(G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
properties[PROP_MAX_ITEMS] =
|
||||||
|
g_param_spec_uint ("max-items", NULL, NULL,
|
||||||
|
1, G_MAXUINT-1, 1000,
|
||||||
|
(G_PARAM_READWRITE |
|
||||||
|
G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties[PROP_SESSION] =
|
properties[PROP_SESSION] =
|
||||||
g_param_spec_object ("session", NULL, NULL,
|
g_param_spec_object ("session", NULL, NULL,
|
||||||
SYSPROF_TYPE_SESSION,
|
SYSPROF_TYPE_SESSION,
|
||||||
@ -155,7 +175,13 @@ sysprof_mark_chart_item_class_init (SysprofMarkChartItemClass *klass)
|
|||||||
static void
|
static void
|
||||||
sysprof_mark_chart_item_init (SysprofMarkChartItem *self)
|
sysprof_mark_chart_item_init (SysprofMarkChartItem *self)
|
||||||
{
|
{
|
||||||
|
self->max_items = 1000;
|
||||||
|
|
||||||
self->filtered = sysprof_time_filter_model_new (NULL, NULL);
|
self->filtered = sysprof_time_filter_model_new (NULL, NULL);
|
||||||
|
self->sampled = sysprof_sampled_model_new (NULL, self->max_items);
|
||||||
|
|
||||||
|
sysprof_time_filter_model_set_model (self->filtered,
|
||||||
|
G_LIST_MODEL (self->sampled));
|
||||||
|
|
||||||
self->series = sysprof_time_series_new (NULL,
|
self->series = sysprof_time_series_new (NULL,
|
||||||
g_object_ref (G_LIST_MODEL (self->filtered)),
|
g_object_ref (G_LIST_MODEL (self->filtered)),
|
||||||
|
|||||||
Reference in New Issue
Block a user