mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-ui: add more capture details
This commit is contained in:
@ -221,6 +221,7 @@ sysprof_capture_view_scan_worker (GTask *task,
|
|||||||
SysprofCaptureReader *reader = task_data;
|
SysprofCaptureReader *reader = task_data;
|
||||||
SysprofCaptureFeatures features = {0};
|
SysprofCaptureFeatures features = {0};
|
||||||
SysprofCaptureFrame frame;
|
SysprofCaptureFrame frame;
|
||||||
|
SysprofCaptureStat st_buf = {0};
|
||||||
|
|
||||||
g_assert (SYSPROF_IS_CAPTURE_VIEW (self));
|
g_assert (SYSPROF_IS_CAPTURE_VIEW (self));
|
||||||
g_assert (G_IS_TASK (task));
|
g_assert (G_IS_TASK (task));
|
||||||
@ -235,6 +236,10 @@ sysprof_capture_view_scan_worker (GTask *task,
|
|||||||
gint64 begin_time = frame.time;
|
gint64 begin_time = frame.time;
|
||||||
gint64 end_time = G_MININT64;
|
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)
|
if (frame.type == SYSPROF_CAPTURE_FRAME_MARK)
|
||||||
{
|
{
|
||||||
const SysprofCaptureMark *mark;
|
const SysprofCaptureMark *mark;
|
||||||
@ -265,6 +270,8 @@ sysprof_capture_view_scan_worker (GTask *task,
|
|||||||
features.end_time = end_time;
|
features.end_time = end_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sysprof_capture_reader_set_stat (reader, &st_buf);
|
||||||
|
|
||||||
if (!g_task_return_error_if_cancelled (task))
|
if (!g_task_return_error_if_cancelled (task))
|
||||||
{
|
{
|
||||||
priv->features = features;
|
priv->features = features;
|
||||||
@ -428,6 +435,8 @@ sysprof_capture_view_load_scan_cb (GObject *object,
|
|||||||
g_object_ref (task));
|
g_object_ref (task));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sysprof_details_view_set_reader (priv->details_view, priv->reader);
|
||||||
|
|
||||||
if (state->n_active == 0)
|
if (state->n_active == 0)
|
||||||
g_task_return_boolean (task, TRUE);
|
g_task_return_boolean (task, TRUE);
|
||||||
}
|
}
|
||||||
@ -488,8 +497,6 @@ sysprof_capture_view_real_load_async (SysprofCaptureView *self,
|
|||||||
cancellable,
|
cancellable,
|
||||||
sysprof_capture_view_load_scan_cb,
|
sysprof_capture_view_load_scan_cb,
|
||||||
g_steal_pointer (&task));
|
g_steal_pointer (&task));
|
||||||
|
|
||||||
sysprof_details_view_set_reader (priv->details_view, reader);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
|||||||
@ -26,10 +26,17 @@
|
|||||||
|
|
||||||
#include "sysprof-details-view.h"
|
#include "sysprof-details-view.h"
|
||||||
|
|
||||||
|
#define NSEC_PER_SEC (G_USEC_PER_SEC * 1000L)
|
||||||
|
|
||||||
struct _SysprofDetailsView
|
struct _SysprofDetailsView
|
||||||
{
|
{
|
||||||
GtkBin parent_instance;
|
GtkBin parent_instance;
|
||||||
|
GtkLabel *duration;
|
||||||
GtkLabel *filename;
|
GtkLabel *filename;
|
||||||
|
GtkLabel *forks;
|
||||||
|
GtkLabel *marks;
|
||||||
|
GtkLabel *processes;
|
||||||
|
GtkLabel *samples;
|
||||||
GtkLabel *start_time;
|
GtkLabel *start_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -50,7 +57,12 @@ sysprof_details_view_class_init (SysprofDetailsViewClass *klass)
|
|||||||
object_class->finalize = sysprof_details_view_finalize;
|
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_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, 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);
|
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) dt = NULL;
|
||||||
g_autoptr(GDateTime) local = NULL;
|
g_autoptr(GDateTime) local = NULL;
|
||||||
|
g_autofree gchar *duration_str = NULL;
|
||||||
const gchar *filename;
|
const gchar *filename;
|
||||||
const gchar *capture_at;
|
const gchar *capture_at;
|
||||||
|
SysprofCaptureStat st_buf;
|
||||||
|
gint64 duration;
|
||||||
|
|
||||||
g_return_if_fail (SYSPROF_IS_DETAILS_VIEW (self));
|
g_return_if_fail (SYSPROF_IS_DETAILS_VIEW (self));
|
||||||
|
g_return_if_fail (reader != NULL);
|
||||||
|
|
||||||
if (!(filename = sysprof_capture_reader_get_filename (reader)))
|
if (!(filename = sysprof_capture_reader_get_filename (reader)))
|
||||||
filename = _("Memory Capture");
|
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");
|
g_autofree gchar *str = g_date_time_format (local, "%x %X");
|
||||||
gtk_label_set_label (self->start_time, str);
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,11 +32,6 @@
|
|||||||
<class name="dim-label"/>
|
<class name="dim-label"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
@ -48,17 +43,69 @@
|
|||||||
<class name="dim-label"/>
|
<class name="dim-label"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
</child>
|
||||||
<property name="expand">False</property>
|
<child>
|
||||||
<property name="fill">True</property>
|
<object class="GtkLabel">
|
||||||
<property name="position">1</property>
|
<property name="visible">True</property>
|
||||||
</packing>
|
<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>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="expand">True</property>
|
<property name="pack-type">start</property>
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
<property name="position">0</property>
|
||||||
|
<property name="expand">true</property>
|
||||||
|
<property name="fill">true</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child type="center">
|
<child type="center">
|
||||||
@ -74,11 +121,6 @@
|
|||||||
<property name="ellipsize">start</property>
|
<property name="ellipsize">start</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">0</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="start_time">
|
<object class="GtkLabel" id="start_time">
|
||||||
@ -87,25 +129,50 @@
|
|||||||
<property name="ellipsize">start</property>
|
<property name="ellipsize">start</property>
|
||||||
<property name="xalign">0</property>
|
<property name="xalign">0</property>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
</child>
|
||||||
<property name="expand">False</property>
|
<child>
|
||||||
<property name="fill">True</property>
|
<object class="GtkLabel" id="duration">
|
||||||
<property name="position">1</property>
|
<property name="visible">True</property>
|
||||||
</packing>
|
<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>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
|
||||||
<property name="expand">False</property>
|
|
||||||
<property name="fill">True</property>
|
|
||||||
<property name="position">1</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|||||||
Reference in New Issue
Block a user