mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-12 16:10:54 +00:00
libsysprof-ui: update samples while recording
This commit is contained in:
@ -25,8 +25,9 @@
|
|||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
SysprofProfiler *profiler;
|
SysprofProfiler *profiler;
|
||||||
gulong notify_elapsed_handler;
|
GtkLabel *elapsed;
|
||||||
GtkLabel *elapsed;
|
GtkLabel *samples;
|
||||||
|
gulong notify_elapsed_handler;
|
||||||
} SysprofRecordingStateViewPrivate;
|
} SysprofRecordingStateViewPrivate;
|
||||||
|
|
||||||
G_DEFINE_TYPE_WITH_PRIVATE (SysprofRecordingStateView, sysprof_recording_state_view, GTK_TYPE_BIN)
|
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
|
static void
|
||||||
sysprof_recording_state_view_notify_elapsed (SysprofRecordingStateView *self,
|
sysprof_recording_state_view_notify_elapsed (SysprofRecordingStateView *self,
|
||||||
GParamSpec *pspec,
|
GParamSpec *pspec,
|
||||||
SysprofProfiler *profiler)
|
SysprofProfiler *profiler)
|
||||||
{
|
{
|
||||||
SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
|
SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
|
||||||
g_autofree gchar *str = NULL;
|
g_autofree gchar *str = NULL;
|
||||||
|
SysprofCaptureWriter *writer;
|
||||||
gint64 elapsed;
|
gint64 elapsed;
|
||||||
guint hours;
|
guint hours;
|
||||||
guint minutes;
|
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_RECORDING_STATE_VIEW (self));
|
||||||
g_assert (SYSPROF_IS_PROFILER (profiler));
|
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);
|
elapsed = (gint64)sysprof_profiler_get_elapsed (profiler);
|
||||||
|
|
||||||
hours = elapsed / (60 * 60);
|
hours = elapsed / (60 * 60);
|
||||||
@ -94,9 +106,9 @@ sysprof_recording_state_view_destroy (GtkWidget *widget)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_recording_state_view_get_property (GObject *object,
|
sysprof_recording_state_view_get_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
GValue *value,
|
GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
SysprofRecordingStateView *self = SYSPROF_RECORDING_STATE_VIEW (object);
|
SysprofRecordingStateView *self = SYSPROF_RECORDING_STATE_VIEW (object);
|
||||||
SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
|
SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
|
||||||
@ -114,9 +126,9 @@ sysprof_recording_state_view_get_property (GObject *object,
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
sysprof_recording_state_view_set_property (GObject *object,
|
sysprof_recording_state_view_set_property (GObject *object,
|
||||||
guint prop_id,
|
guint prop_id,
|
||||||
const GValue *value,
|
const GValue *value,
|
||||||
GParamSpec *pspec)
|
GParamSpec *pspec)
|
||||||
{
|
{
|
||||||
SysprofRecordingStateView *self = SYSPROF_RECORDING_STATE_VIEW (object);
|
SysprofRecordingStateView *self = SYSPROF_RECORDING_STATE_VIEW (object);
|
||||||
|
|
||||||
@ -164,7 +176,7 @@ sysprof_recording_state_view_init (SysprofRecordingStateView *self)
|
|||||||
|
|
||||||
void
|
void
|
||||||
sysprof_recording_state_view_set_profiler (SysprofRecordingStateView *self,
|
sysprof_recording_state_view_set_profiler (SysprofRecordingStateView *self,
|
||||||
SysprofProfiler *profiler)
|
SysprofProfiler *profiler)
|
||||||
{
|
{
|
||||||
SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
|
SysprofRecordingStateViewPrivate *priv = sysprof_recording_state_view_get_instance_private (self);
|
||||||
|
|
||||||
|
|||||||
@ -44,17 +44,48 @@
|
|||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton">
|
<object class="GtkBox">
|
||||||
<property name="action-name">display.stop-recording</property>
|
<property name="orientation">horizontal</property>
|
||||||
<property name="margin-top">24</property>
|
<property name="spacing">6</property>
|
||||||
<property name="visible">true</property>
|
<property name="visible">true</property>
|
||||||
<property name="label" translatable="yes">_Stop Recording</property>
|
<child>
|
||||||
<property name="halign">end</property>
|
<object class="GtkLabel">
|
||||||
<property name="width-request">125</property>
|
<property name="label" translatable="yes">Samples</property>
|
||||||
<property name="use-underline">true</property>
|
<property name="xalign">1.0</property>
|
||||||
<style>
|
<property name="valign">baseline</property>
|
||||||
<class name="destructive-action"/>
|
<property name="visible">true</property>
|
||||||
</style>
|
<style>
|
||||||
|
<class name="dim-label"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkLabel" id="samples">
|
||||||
|
<property name="label">0</property>
|
||||||
|
<property name="visible">true</property>
|
||||||
|
<property name="hexpand">true</property>
|
||||||
|
<property name="valign">baseline</property>
|
||||||
|
<property name="xalign">0.0</property>
|
||||||
|
<attributes>
|
||||||
|
<attribute name="font-features" value="font-feature-settings: 'tnum'"/>
|
||||||
|
</attributes>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
|
<child>
|
||||||
|
<object class="GtkButton">
|
||||||
|
<property name="action-name">display.stop-recording</property>
|
||||||
|
<property name="margin-top">24</property>
|
||||||
|
<property name="visible">true</property>
|
||||||
|
<property name="label" translatable="yes">_Stop Recording</property>
|
||||||
|
<property name="halign">end</property>
|
||||||
|
<property name="width-request">125</property>
|
||||||
|
<property name="valign">baseline</property>
|
||||||
|
<property name="use-underline">true</property>
|
||||||
|
<style>
|
||||||
|
<class name="destructive-action"/>
|
||||||
|
</style>
|
||||||
|
</object>
|
||||||
|
</child>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
</object>
|
</object>
|
||||||
|
|||||||
Reference in New Issue
Block a user