mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 15:10:53 +00:00
libsysprof-profile: add property for event count
So we can bind this to the recording pad and update it with each pass through the loop.
This commit is contained in:
@ -40,6 +40,9 @@ struct _SysprofRecording
|
|||||||
gint64 start_time;
|
gint64 start_time;
|
||||||
gint64 end_time;
|
gint64 end_time;
|
||||||
|
|
||||||
|
/* Used to calculate event count */
|
||||||
|
SysprofCaptureStat stat;
|
||||||
|
|
||||||
/* Diagnostics that may be added by instruments during the recording.
|
/* Diagnostics that may be added by instruments during the recording.
|
||||||
* Some may be fatal, meaning that they stop the recording when the
|
* Some may be fatal, meaning that they stop the recording when the
|
||||||
* diagnostic is submitted. That can happen in situations like
|
* diagnostic is submitted. That can happen in situations like
|
||||||
@ -76,6 +79,7 @@ struct _SysprofRecording
|
|||||||
enum {
|
enum {
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_DURATION,
|
PROP_DURATION,
|
||||||
|
PROP_EVENT_COUNT,
|
||||||
N_PROPS
|
N_PROPS
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -175,6 +179,10 @@ sysprof_recording_fiber (gpointer user_data)
|
|||||||
|
|
||||||
/* Update duration each pass through the loop */
|
/* Update duration each pass through the loop */
|
||||||
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DURATION]);
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_DURATION]);
|
||||||
|
|
||||||
|
/* Update event count each pass through the loop */
|
||||||
|
sysprof_capture_writer_stat (self->writer, &self->stat);
|
||||||
|
g_object_notify_by_pspec (G_OBJECT (self), properties[PROP_EVENT_COUNT]);
|
||||||
}
|
}
|
||||||
|
|
||||||
stop_recording:
|
stop_recording:
|
||||||
@ -243,6 +251,10 @@ sysprof_recording_get_property (GObject *object,
|
|||||||
g_value_set_int64 (value, sysprof_recording_get_duration (self));
|
g_value_set_int64 (value, sysprof_recording_get_duration (self));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case PROP_EVENT_COUNT:
|
||||||
|
g_value_set_int64 (value, sysprof_recording_get_event_count (self));
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
}
|
}
|
||||||
@ -261,6 +273,11 @@ sysprof_recording_class_init (SysprofRecordingClass *klass)
|
|||||||
0, G_MAXINT64, 0,
|
0, G_MAXINT64, 0,
|
||||||
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
|
properties [PROP_EVENT_COUNT] =
|
||||||
|
g_param_spec_int64 ("event-count", NULL, NULL,
|
||||||
|
0, G_MAXINT64, 0,
|
||||||
|
(G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
||||||
|
|
||||||
g_object_class_install_properties (object_class, N_PROPS, properties);
|
g_object_class_install_properties (object_class, N_PROPS, properties);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,3 +676,17 @@ sysprof_recording_get_duration (SysprofRecording *self)
|
|||||||
|
|
||||||
return end_time - start_time;
|
return end_time - start_time;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gint64
|
||||||
|
sysprof_recording_get_event_count (SysprofRecording *self)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (SYSPROF_IS_RECORDING (self), 0);
|
||||||
|
|
||||||
|
return self->stat.frame_count[SYSPROF_CAPTURE_FRAME_SAMPLE]
|
||||||
|
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_ALLOCATION]
|
||||||
|
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_FORK]
|
||||||
|
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_EXIT]
|
||||||
|
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_CTRSET]
|
||||||
|
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_MARK]
|
||||||
|
+ self->stat.frame_count[SYSPROF_CAPTURE_FRAME_LOG];
|
||||||
|
}
|
||||||
|
|||||||
@ -36,6 +36,8 @@ GListModel *sysprof_recording_list_diagnostics (SysprofRecording *self);
|
|||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
gint64 sysprof_recording_get_duration (SysprofRecording *self);
|
gint64 sysprof_recording_get_duration (SysprofRecording *self);
|
||||||
SYSPROF_AVAILABLE_IN_ALL
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
|
gint64 sysprof_recording_get_event_count (SysprofRecording *self);
|
||||||
|
SYSPROF_AVAILABLE_IN_ALL
|
||||||
void sysprof_recording_wait_async (SysprofRecording *self,
|
void sysprof_recording_wait_async (SysprofRecording *self,
|
||||||
GCancellable *cancellable,
|
GCancellable *cancellable,
|
||||||
GAsyncReadyCallback callback,
|
GAsyncReadyCallback callback,
|
||||||
|
|||||||
Reference in New Issue
Block a user