From ef6c402b800daf78598080ecd33812730787445c Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sun, 19 May 2019 17:46:55 -0700 Subject: [PATCH] libsysprof-ui: update samples while recording --- .../sysprof-recording-state-view.c | 34 +++++++++---- .../ui/sysprof-recording-state-view.ui | 51 +++++++++++++++---- 2 files changed, 64 insertions(+), 21 deletions(-) diff --git a/src/libsysprof-ui/sysprof-recording-state-view.c b/src/libsysprof-ui/sysprof-recording-state-view.c index 21222b42..1763e720 100644 --- a/src/libsysprof-ui/sysprof-recording-state-view.c +++ b/src/libsysprof-ui/sysprof-recording-state-view.c @@ -25,8 +25,9 @@ typedef struct { SysprofProfiler *profiler; - gulong notify_elapsed_handler; - GtkLabel *elapsed; + GtkLabel *elapsed; + GtkLabel *samples; + gulong notify_elapsed_handler; } SysprofRecordingStateViewPrivate; G_DEFINE_TYPE_WITH_PRIVATE (SysprofRecordingStateView, sysprof_recording_state_view, GTK_TYPE_BIN) @@ -47,11 +48,12 @@ sysprof_recording_state_view_new (void) static void sysprof_recording_state_view_notify_elapsed (SysprofRecordingStateView *self, - GParamSpec *pspec, - SysprofProfiler *profiler) + GParamSpec *pspec, + SysprofProfiler *profiler) { SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self); g_autofree gchar *str = NULL; + SysprofCaptureWriter *writer; gint64 elapsed; guint hours; guint minutes; @@ -60,6 +62,16 @@ sysprof_recording_state_view_notify_elapsed (SysprofRecordingStateView *self, g_assert (SYSPROF_IS_RECORDING_STATE_VIEW (self)); g_assert (SYSPROF_IS_PROFILER (profiler)); + if ((writer = sysprof_profiler_get_writer (profiler))) + { + SysprofCaptureStat st; + g_autofree gchar *samples = NULL; + + sysprof_capture_writer_stat (writer, &st); + samples = g_strdup_printf ("%"G_GINT64_FORMAT, st.frame_count[SYSPROF_CAPTURE_FRAME_SAMPLE]); + gtk_label_set_label (priv->samples, samples); + } + elapsed = (gint64)sysprof_profiler_get_elapsed (profiler); hours = elapsed / (60 * 60); @@ -94,9 +106,9 @@ sysprof_recording_state_view_destroy (GtkWidget *widget) static void sysprof_recording_state_view_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) + guint prop_id, + GValue *value, + GParamSpec *pspec) { SysprofRecordingStateView *self = SYSPROF_RECORDING_STATE_VIEW (object); SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self); @@ -114,9 +126,9 @@ sysprof_recording_state_view_get_property (GObject *object, static void sysprof_recording_state_view_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) + guint prop_id, + const GValue *value, + GParamSpec *pspec) { SysprofRecordingStateView *self = SYSPROF_RECORDING_STATE_VIEW (object); @@ -164,7 +176,7 @@ sysprof_recording_state_view_init (SysprofRecordingStateView *self) void sysprof_recording_state_view_set_profiler (SysprofRecordingStateView *self, - SysprofProfiler *profiler) + SysprofProfiler *profiler) { SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self); diff --git a/src/libsysprof-ui/ui/sysprof-recording-state-view.ui b/src/libsysprof-ui/ui/sysprof-recording-state-view.ui index e9631c94..948ae343 100644 --- a/src/libsysprof-ui/ui/sysprof-recording-state-view.ui +++ b/src/libsysprof-ui/ui/sysprof-recording-state-view.ui @@ -44,17 +44,48 @@ - - display.stop-recording - 24 + + horizontal + 6 true - _Stop Recording - end - 125 - true - + + + Samples + 1.0 + baseline + true + + + + + + 0 + true + true + baseline + 0.0 + + + + + + + + display.stop-recording + 24 + true + _Stop Recording + end + 125 + baseline + true + + +