libsysprof-profile: update time range for recording

That way we don't have gaps at the edges.
This commit is contained in:
Christian Hergert
2023-05-31 10:16:51 -07:00
parent bff99f1f63
commit e3404dd0ca

View File

@ -75,6 +75,7 @@ sysprof_recording_fiber (gpointer user_data)
g_autoptr(GCancellable) cancellable = NULL;
g_autoptr(DexFuture) record = NULL;
g_autoptr(GError) error = NULL;
gint64 begin_time;
g_assert (SYSPROF_IS_RECORDING (self));
@ -94,6 +95,9 @@ sysprof_recording_fiber (gpointer user_data)
/* Ask instruments to start recording and stop if cancelled. */
record = _sysprof_instruments_record (self->instruments, self, cancellable);
/* Now take our begin time now that all instruments are notified */
begin_time = SYSPROF_CAPTURE_CURRENT_TIME;
/* Wait for messages on our channel or the recording to complete */
for (;;)
{
@ -129,6 +133,9 @@ stop_recording:
*/
g_cancellable_cancel (cancellable);
/* Update start/end times to be the "running time" */
_sysprof_capture_writer_set_time_range (self->writer, begin_time, SYSPROF_CAPTURE_CURRENT_TIME);
if (error != NULL)
return dex_future_new_for_error (g_steal_pointer (&error));