mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2025-12-31 20:36:25 +00:00
libsysprof-ui: use threegrid for details
This allows us to tweak the design of the marks.
This commit is contained in:
@ -145,6 +145,8 @@ static void
|
||||
add_marks_to_details (SysprofCaptureView *self)
|
||||
{
|
||||
SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (self);
|
||||
PangoAttrList *attrs;
|
||||
PangoAttrList *dim_attrs;
|
||||
GHashTableIter iter;
|
||||
gpointer k, v;
|
||||
guint count = 0;
|
||||
@ -157,46 +159,78 @@ add_marks_to_details (SysprofCaptureView *self)
|
||||
if (g_hash_table_size (priv->mark_stats) == 0)
|
||||
return;
|
||||
|
||||
attrs = pango_attr_list_new ();
|
||||
pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
|
||||
pango_attr_list_insert (attrs, pango_attr_foreground_alpha_new (65535/2));
|
||||
|
||||
dim_attrs = pango_attr_list_new ();
|
||||
pango_attr_list_insert (dim_attrs, pango_attr_foreground_alpha_new (65535/2));
|
||||
|
||||
g_hash_table_iter_init (&iter, priv->mark_stats);
|
||||
while (count < 100 && g_hash_table_iter_next (&iter, &k, &v))
|
||||
{
|
||||
g_autofree gchar *str = NULL;
|
||||
SysprofMarkStat *st = v;
|
||||
GtkLabel *left_label;
|
||||
GtkLabel *center_label;
|
||||
g_autofree gchar *minstr = _sysprof_format_duration (st->min);
|
||||
g_autofree gchar *maxstr = _sysprof_format_duration (st->max);
|
||||
g_autofree gchar *avgstr = _sysprof_format_duration (st->avg);
|
||||
|
||||
if (st->avg == 0)
|
||||
continue;
|
||||
|
||||
left_label = g_object_new (GTK_TYPE_LABEL,
|
||||
"selectable", TRUE,
|
||||
"visible", TRUE,
|
||||
"xalign", 1.0f,
|
||||
"label", st->name,
|
||||
"ellipsize", PANGO_ELLIPSIZE_START,
|
||||
NULL);
|
||||
gtk_style_context_add_class (gtk_widget_get_style_context (GTK_WIDGET (left_label)),
|
||||
GTK_STYLE_CLASS_DIM_LABEL);
|
||||
str = g_strdup_printf ("<span fgalpha='32767'>Min:</span> %.4lf "
|
||||
"<span fgalpha='32767'>Max:</span> %.4lf "
|
||||
"<span fgalpha='32767'>Ø:</span> %.4lf",
|
||||
st->min / (gdouble)NSEC_PER_SEC,
|
||||
st->max / (gdouble)NSEC_PER_SEC,
|
||||
st->avg / (gdouble)NSEC_PER_SEC);
|
||||
center_label = g_object_new (GTK_TYPE_LABEL,
|
||||
"label", str,
|
||||
"selectable", TRUE,
|
||||
"use-markup", TRUE,
|
||||
"visible", TRUE,
|
||||
"xalign", 0.0f,
|
||||
NULL);
|
||||
sysprof_details_view_add_item (priv->details_view,
|
||||
g_object_new (GTK_TYPE_LABEL,
|
||||
"margin-top", 6,
|
||||
"label", st->name,
|
||||
"attributes", attrs,
|
||||
"xalign", 1.0f,
|
||||
"visible", TRUE,
|
||||
NULL),
|
||||
NULL);
|
||||
|
||||
sysprof_details_view_add_item (priv->details_view,
|
||||
GTK_WIDGET (left_label),
|
||||
GTK_WIDGET (center_label));
|
||||
g_object_new (GTK_TYPE_LABEL,
|
||||
"attributes", dim_attrs,
|
||||
"label", "Min",
|
||||
"xalign", 1.0f,
|
||||
"visible", TRUE,
|
||||
NULL),
|
||||
g_object_new (GTK_TYPE_LABEL,
|
||||
"label", minstr,
|
||||
"xalign", 0.0f,
|
||||
"visible", TRUE,
|
||||
NULL));
|
||||
|
||||
sysprof_details_view_add_item (priv->details_view,
|
||||
g_object_new (GTK_TYPE_LABEL,
|
||||
"attributes", dim_attrs,
|
||||
"label", "Max",
|
||||
"xalign", 1.0f,
|
||||
"visible", TRUE,
|
||||
NULL),
|
||||
g_object_new (GTK_TYPE_LABEL,
|
||||
"label", maxstr,
|
||||
"xalign", 0.0f,
|
||||
"visible", TRUE,
|
||||
NULL));
|
||||
|
||||
sysprof_details_view_add_item (priv->details_view,
|
||||
g_object_new (GTK_TYPE_LABEL,
|
||||
"attributes", dim_attrs,
|
||||
"label", "Ø",
|
||||
"xalign", 1.0f,
|
||||
"visible", TRUE,
|
||||
NULL),
|
||||
g_object_new (GTK_TYPE_LABEL,
|
||||
"label", avgstr,
|
||||
"xalign", 0.0f,
|
||||
"visible", TRUE,
|
||||
NULL));
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
pango_attr_list_unref (attrs);
|
||||
pango_attr_list_unref (dim_attrs);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -961,8 +995,6 @@ sysprof_capture_view_fit_to_width (SysprofCaptureView *self)
|
||||
|
||||
duration = priv->features.end_time - priv->features.begin_time;
|
||||
|
||||
g_print ("DURATION: %ld\n", duration);
|
||||
|
||||
if (duration <= 0)
|
||||
return;
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#include <dazzle.h>
|
||||
#include <glib/gi18n.h>
|
||||
|
||||
#include "sysprof-details-view.h"
|
||||
@ -30,19 +31,19 @@
|
||||
|
||||
struct _SysprofDetailsView
|
||||
{
|
||||
GtkBin parent_instance;
|
||||
GtkBin parent_instance;
|
||||
|
||||
/* Template Objects */
|
||||
GtkBox *left_box;
|
||||
GtkBox *center_box;
|
||||
GtkLabel *duration;
|
||||
GtkLabel *filename;
|
||||
GtkLabel *forks;
|
||||
GtkLabel *marks;
|
||||
GtkLabel *processes;
|
||||
GtkLabel *samples;
|
||||
GtkLabel *start_time;
|
||||
GtkBox *vbox;
|
||||
DzlThreeGrid *three_grid;
|
||||
GtkLabel *duration;
|
||||
GtkLabel *filename;
|
||||
GtkLabel *forks;
|
||||
GtkLabel *marks;
|
||||
GtkLabel *processes;
|
||||
GtkLabel *samples;
|
||||
GtkLabel *start_time;
|
||||
|
||||
guint next_row;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (SysprofDetailsView, sysprof_details_view, GTK_TYPE_BIN)
|
||||
@ -92,15 +93,17 @@ sysprof_details_view_class_init (SysprofDetailsViewClass *klass)
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, processes);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, samples);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, start_time);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, vbox);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, left_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, center_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, three_grid);
|
||||
|
||||
g_type_ensure (DZL_TYPE_THREE_GRID);
|
||||
}
|
||||
|
||||
static void
|
||||
sysprof_details_view_init (SysprofDetailsView *self)
|
||||
{
|
||||
gtk_widget_init_template (GTK_WIDGET (self));
|
||||
|
||||
self->next_row = 7;
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
@ -165,13 +168,20 @@ sysprof_details_view_add_item (SysprofDetailsView *self,
|
||||
GtkWidget *center)
|
||||
{
|
||||
g_return_if_fail (SYSPROF_IS_DETAILS_VIEW (self));
|
||||
g_return_if_fail (GTK_IS_WIDGET (left));
|
||||
g_return_if_fail (GTK_IS_WIDGET (center));
|
||||
g_return_if_fail (!left || GTK_IS_WIDGET (left));
|
||||
g_return_if_fail (!center || GTK_IS_WIDGET (center));
|
||||
|
||||
gtk_container_add_with_properties (GTK_CONTAINER (self->left_box), left,
|
||||
"pack-type", GTK_PACK_START,
|
||||
"expand", TRUE,
|
||||
"fill", TRUE,
|
||||
NULL);
|
||||
gtk_container_add (GTK_CONTAINER (self->center_box), center);
|
||||
if (left)
|
||||
gtk_container_add_with_properties (GTK_CONTAINER (self->three_grid), left,
|
||||
"row", self->next_row,
|
||||
"column", DZL_THREE_GRID_COLUMN_LEFT,
|
||||
NULL);
|
||||
|
||||
if (center)
|
||||
gtk_container_add_with_properties (GTK_CONTAINER (self->three_grid), center,
|
||||
"row", self->next_row,
|
||||
"column", DZL_THREE_GRID_COLUMN_CENTER,
|
||||
NULL);
|
||||
|
||||
self->next_row++;
|
||||
}
|
||||
|
||||
@ -10,176 +10,197 @@
|
||||
<property name="propagate-natural-height">true</property>
|
||||
<property name="visible">true</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="vbox">
|
||||
<object class="DzlThreeGrid" id="three_grid">
|
||||
<property name="margin">36</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="column-spacing">12</property>
|
||||
<property name="row-spacing">6</property>
|
||||
<property name="visible">true</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">true</property>
|
||||
<property name="label" translatable="yes">Filename</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">left</property>
|
||||
<property name="row">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">true</property>
|
||||
<property name="label" translatable="yes">Captured at</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">left</property>
|
||||
<property name="row">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="spacing">12</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="left_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Filename</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Captured At</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Duration</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="margin-top">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Samples Captured</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Marks Captured</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="label" translatable="yes">Processes Captured</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="label" translatable="yes">Forks Captured</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="pack-type">start</property>
|
||||
<property name="position">0</property>
|
||||
<property name="expand">true</property>
|
||||
<property name="fill">true</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child type="center">
|
||||
<object class="GtkBox" id="center_box">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="filename">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="start_time">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="duration">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="samples">
|
||||
<property name="margin-top">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="marks">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="processes">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="forks">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<property name="label" translatable="yes">Duration</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">left</property>
|
||||
<property name="row">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="margin-top">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Samples Captured</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">left</property>
|
||||
<property name="row">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Marks Captured</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">left</property>
|
||||
<property name="row">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Processes Captured</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">left</property>
|
||||
<property name="row">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel">
|
||||
<property name="visible">True</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="label" translatable="yes">Forks Captured</property>
|
||||
<property name="xalign">1</property>
|
||||
<style>
|
||||
<class name="dim-label"/>
|
||||
</style>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">left</property>
|
||||
<property name="row">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="filename">
|
||||
<property name="width-chars">35</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">1</property>
|
||||
<property name="row">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="start_time">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">center</property>
|
||||
<property name="row">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="duration">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">center</property>
|
||||
<property name="row">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="samples">
|
||||
<property name="margin-top">12</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">center</property>
|
||||
<property name="row">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="marks">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">center</property>
|
||||
<property name="row">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="processes">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">center</property>
|
||||
<property name="row">5</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="forks">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="ellipsize">start</property>
|
||||
<property name="margin-bottom">12</property>
|
||||
<property name="xalign">0</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="column">center</property>
|
||||
<property name="row">6</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
||||
Reference in New Issue
Block a user