mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
marks: add group to visualizer row
This will allow us to filter events that we do not care about for a given row. We add a visualizer row per-group.
This commit is contained in:
@ -27,6 +27,13 @@ typedef struct
|
|||||||
*/
|
*/
|
||||||
SpCaptureReader *reader;
|
SpCaptureReader *reader;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The group we care about for displaying marks. The idea is that we only
|
||||||
|
* show one group per-row, so tooling from separate systems can either be
|
||||||
|
* displayed together or not, based on usefulness.
|
||||||
|
*/
|
||||||
|
gchar *group;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A sorted array of MarkInfo about marks we care to render.
|
* A sorted array of MarkInfo about marks we care to render.
|
||||||
*/
|
*/
|
||||||
@ -46,6 +53,7 @@ typedef struct
|
|||||||
|
|
||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
|
PROP_GROUP,
|
||||||
PROP_TITLE,
|
PROP_TITLE,
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
@ -189,6 +197,7 @@ sp_mark_visualizer_row_finalize (GObject *object)
|
|||||||
SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)object;
|
SpMarkVisualizerRow *self = (SpMarkVisualizerRow *)object;
|
||||||
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
|
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
|
||||||
|
|
||||||
|
g_clear_pointer (&priv->group, g_free);
|
||||||
g_clear_pointer (&priv->marks, g_array_unref);
|
g_clear_pointer (&priv->marks, g_array_unref);
|
||||||
|
|
||||||
G_OBJECT_CLASS (sp_mark_visualizer_row_parent_class)->finalize (object);
|
G_OBJECT_CLASS (sp_mark_visualizer_row_parent_class)->finalize (object);
|
||||||
@ -205,6 +214,10 @@ sp_mark_visualizer_row_get_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_GROUP:
|
||||||
|
g_value_set_string (value, sp_mark_visualizer_row_get_group (self));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_TITLE:
|
case PROP_TITLE:
|
||||||
g_value_set_string (value, gtk_label_get_label (priv->label));
|
g_value_set_string (value, gtk_label_get_label (priv->label));
|
||||||
break;
|
break;
|
||||||
@ -225,6 +238,10 @@ sp_mark_visualizer_row_set_property (GObject *object,
|
|||||||
|
|
||||||
switch (prop_id)
|
switch (prop_id)
|
||||||
{
|
{
|
||||||
|
case PROP_GROUP:
|
||||||
|
sp_mark_visualizer_row_set_group (self, g_value_get_string (value));
|
||||||
|
break;
|
||||||
|
|
||||||
case PROP_TITLE:
|
case PROP_TITLE:
|
||||||
gtk_label_set_label (priv->label, g_value_get_string (value));
|
gtk_label_set_label (priv->label, g_value_get_string (value));
|
||||||
break;
|
break;
|
||||||
@ -249,6 +266,13 @@ sp_mark_visualizer_row_class_init (SpMarkVisualizerRowClass *klass)
|
|||||||
|
|
||||||
visualizer_class->set_reader = sp_mark_visualizer_row_set_reader;
|
visualizer_class->set_reader = sp_mark_visualizer_row_set_reader;
|
||||||
|
|
||||||
|
properties [PROP_GROUP] =
|
||||||
|
g_param_spec_string ("group",
|
||||||
|
"Group",
|
||||||
|
"The group of the row",
|
||||||
|
NULL,
|
||||||
|
(G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
properties [PROP_TITLE] =
|
properties [PROP_TITLE] =
|
||||||
g_param_spec_string ("title",
|
g_param_spec_string ("title",
|
||||||
"Title",
|
"Title",
|
||||||
@ -286,14 +310,28 @@ sp_mark_visualizer_row_new (void)
|
|||||||
return g_object_new (SP_TYPE_MARK_VISUALIZER_ROW, NULL);
|
return g_object_new (SP_TYPE_MARK_VISUALIZER_ROW, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
const gchar *
|
||||||
sp_mark_visualizer_row_add_mark (SpMarkVisualizerRow *self,
|
sp_mark_visualizer_row_get_group (SpMarkVisualizerRow *self)
|
||||||
GPid pid,
|
|
||||||
GPid tid,
|
|
||||||
const gchar *name,
|
|
||||||
const GdkRGBA *color)
|
|
||||||
{
|
{
|
||||||
g_return_if_fail (SP_IS_MARK_VISUALIZER_ROW (self));
|
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
|
||||||
g_return_if_fail (name != NULL);
|
|
||||||
|
|
||||||
|
g_return_val_if_fail (SP_IS_MARK_VISUALIZER_ROW (self), NULL);
|
||||||
|
|
||||||
|
return priv->group;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
sp_mark_visualizer_row_set_group (SpMarkVisualizerRow *self,
|
||||||
|
const gchar *group)
|
||||||
|
{
|
||||||
|
SpMarkVisualizerRowPrivate *priv = sp_mark_visualizer_row_get_instance_private (self);
|
||||||
|
|
||||||
|
g_return_if_fail (SP_IS_MARK_VISUALIZER_ROW (self));
|
||||||
|
|
||||||
|
if (g_strcmp0 (priv->group, group) != 0)
|
||||||
|
{
|
||||||
|
g_free (priv->group);
|
||||||
|
priv->group = g_strdup (group);
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties [PROP_GROUP]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,11 +34,9 @@ struct _SpMarkVisualizerRowClass
|
|||||||
gpointer _reserved[16];
|
gpointer _reserved[16];
|
||||||
};
|
};
|
||||||
|
|
||||||
GtkWidget *sp_mark_visualizer_row_new (void);
|
GtkWidget *sp_mark_visualizer_row_new (void);
|
||||||
void sp_mark_visualizer_row_add_mark (SpMarkVisualizerRow *self,
|
const gchar *sp_mark_visualizer_row_get_group (SpMarkVisualizerRow *self);
|
||||||
GPid pid,
|
void sp_mark_visualizer_row_set_group (SpMarkVisualizerRow *self,
|
||||||
GPid tid,
|
const gchar *group);
|
||||||
const gchar *name,
|
|
||||||
const GdkRGBA *color);
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|||||||
@ -270,6 +270,7 @@ handle_capture_results (GObject *object,
|
|||||||
while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
|
while (g_hash_table_iter_next (&iter, (gpointer *)&key, NULL))
|
||||||
{
|
{
|
||||||
GtkWidget *row = g_object_new (SP_TYPE_MARK_VISUALIZER_ROW,
|
GtkWidget *row = g_object_new (SP_TYPE_MARK_VISUALIZER_ROW,
|
||||||
|
"group", key,
|
||||||
"title", key,
|
"title", key,
|
||||||
"height-request", 75,
|
"height-request", 75,
|
||||||
"selectable", FALSE,
|
"selectable", FALSE,
|
||||||
|
|||||||
Reference in New Issue
Block a user