[sysprof/wip/chergert/sysprof-3] libsysprof-ui: add more capture details
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof/wip/chergert/sysprof-3] libsysprof-ui: add more capture details
- Date: Wed, 15 May 2019 23:40:01 +0000 (UTC)
commit 80e0d3a6576f346dd4b2ebcf57db2bba4f091766
Author: Christian Hergert <chergert redhat com>
Date: Wed May 15 16:39:02 2019 -0700
libsysprof-ui: add more capture details
src/libsysprof-ui/sysprof-capture-view.c | 11 ++-
src/libsysprof-ui/sysprof-details-view.c | 38 ++++++++
src/libsysprof-ui/ui/sysprof-details-view.ui | 131 ++++++++++++++++++++-------
3 files changed, 146 insertions(+), 34 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-capture-view.c b/src/libsysprof-ui/sysprof-capture-view.c
index 325b673..794091c 100644
--- a/src/libsysprof-ui/sysprof-capture-view.c
+++ b/src/libsysprof-ui/sysprof-capture-view.c
@@ -221,6 +221,7 @@ sysprof_capture_view_scan_worker (GTask *task,
SysprofCaptureReader *reader = task_data;
SysprofCaptureFeatures features = {0};
SysprofCaptureFrame frame;
+ SysprofCaptureStat st_buf = {0};
g_assert (SYSPROF_IS_CAPTURE_VIEW (self));
g_assert (G_IS_TASK (task));
@@ -235,6 +236,10 @@ sysprof_capture_view_scan_worker (GTask *task,
gint64 begin_time = frame.time;
gint64 end_time = G_MININT64;
+ g_assert (frame.type < G_N_ELEMENTS (st_buf.frame_count));
+
+ st_buf.frame_count[frame.type]++;
+
if (frame.type == SYSPROF_CAPTURE_FRAME_MARK)
{
const SysprofCaptureMark *mark;
@@ -265,6 +270,8 @@ sysprof_capture_view_scan_worker (GTask *task,
features.end_time = end_time;
}
+ sysprof_capture_reader_set_stat (reader, &st_buf);
+
if (!g_task_return_error_if_cancelled (task))
{
priv->features = features;
@@ -428,6 +435,8 @@ sysprof_capture_view_load_scan_cb (GObject *object,
g_object_ref (task));
}
+ sysprof_details_view_set_reader (priv->details_view, priv->reader);
+
if (state->n_active == 0)
g_task_return_boolean (task, TRUE);
}
@@ -488,8 +497,6 @@ sysprof_capture_view_real_load_async (SysprofCaptureView *self,
cancellable,
sysprof_capture_view_load_scan_cb,
g_steal_pointer (&task));
-
- sysprof_details_view_set_reader (priv->details_view, reader);
}
static gboolean
diff --git a/src/libsysprof-ui/sysprof-details-view.c b/src/libsysprof-ui/sysprof-details-view.c
index d216563..4ed629e 100644
--- a/src/libsysprof-ui/sysprof-details-view.c
+++ b/src/libsysprof-ui/sysprof-details-view.c
@@ -26,10 +26,17 @@
#include "sysprof-details-view.h"
+#define NSEC_PER_SEC (G_USEC_PER_SEC * 1000L)
+
struct _SysprofDetailsView
{
GtkBin parent_instance;
+ GtkLabel *duration;
GtkLabel *filename;
+ GtkLabel *forks;
+ GtkLabel *marks;
+ GtkLabel *processes;
+ GtkLabel *samples;
GtkLabel *start_time;
};
@@ -50,7 +57,12 @@ sysprof_details_view_class_init (SysprofDetailsViewClass *klass)
object_class->finalize = sysprof_details_view_finalize;
gtk_widget_class_set_template_from_resource (widget_class,
"/org/gnome/sysprof/ui/sysprof-details-view.ui");
+ gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, duration);
gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, filename);
+ gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, forks);
+ gtk_widget_class_bind_template_child (widget_class, SysprofDetailsView, marks);
+ 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);
}
@@ -72,10 +84,14 @@ sysprof_details_view_set_reader (SysprofDetailsView *self,
{
g_autoptr(GDateTime) dt = NULL;
g_autoptr(GDateTime) local = NULL;
+ g_autofree gchar *duration_str = NULL;
const gchar *filename;
const gchar *capture_at;
+ SysprofCaptureStat st_buf;
+ gint64 duration;
g_return_if_fail (SYSPROF_IS_DETAILS_VIEW (self));
+ g_return_if_fail (reader != NULL);
if (!(filename = sysprof_capture_reader_get_filename (reader)))
filename = _("Memory Capture");
@@ -88,4 +104,26 @@ sysprof_details_view_set_reader (SysprofDetailsView *self,
g_autofree gchar *str = g_date_time_format (local, "%x %X");
gtk_label_set_label (self->start_time, str);
}
+
+ duration = sysprof_capture_reader_get_end_time (reader) -
+ sysprof_capture_reader_get_start_time (reader);
+ duration_str = g_strdup_printf (_("%0.4lf seconds"), duration / (gdouble)NSEC_PER_SEC);
+ gtk_label_set_label (self->duration, duration_str);
+
+ if (sysprof_capture_reader_get_stat (reader, &st_buf))
+ {
+#define SET_FRAME_COUNT(field, TYPE) \
+ G_STMT_START { \
+ g_autofree gchar *str = NULL; \
+ str = g_strdup_printf ("%"G_GSIZE_FORMAT, st_buf.frame_count[TYPE]); \
+ gtk_label_set_label (self->field, str); \
+ } G_STMT_END
+
+ SET_FRAME_COUNT (samples, SYSPROF_CAPTURE_FRAME_SAMPLE);
+ SET_FRAME_COUNT (marks, SYSPROF_CAPTURE_FRAME_MARK);
+ SET_FRAME_COUNT (processes, SYSPROF_CAPTURE_FRAME_PROCESS);
+ SET_FRAME_COUNT (forks, SYSPROF_CAPTURE_FRAME_FORK);
+
+#undef SET_FRAME_COUNT
+ }
}
diff --git a/src/libsysprof-ui/ui/sysprof-details-view.ui b/src/libsysprof-ui/ui/sysprof-details-view.ui
index a828c28..f4863a4 100644
--- a/src/libsysprof-ui/ui/sysprof-details-view.ui
+++ b/src/libsysprof-ui/ui/sysprof-details-view.ui
@@ -32,11 +32,6 @@
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel">
@@ -48,17 +43,69 @@
<class name="dim-label"/>
</style>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
+ </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="label" translatable="yes">Forks Captured</property>
+ <property name="xalign">1</property>
+ <style>
+ <class name="dim-label"/>
+ </style>
+ </object>
</child>
</object>
<packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
+ <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">
@@ -74,11 +121,6 @@
<property name="ellipsize">start</property>
<property name="xalign">0</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
</child>
<child>
<object class="GtkLabel" id="start_time">
@@ -87,25 +129,50 @@
<property name="ellipsize">start</property>
<property name="xalign">0</property>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">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>
+ </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="xalign">0</property>
+ </object>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
</child>
</object>
</child>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]