From 5ac95f70fecf1e9ebe5000a8499dd0436f998d9e Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Sat, 8 Jul 2023 11:59:19 -0700 Subject: [PATCH] libsysprof-profile: flush writer when recording stops We need to at least submit this data to the underlying FD from our buffer when we stop recording so that anyone consuming the FD will have access to it. (Such as a SysprofDocumentLoader via FD). --- src/libsysprof-profile/sysprof-recording.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libsysprof-profile/sysprof-recording.c b/src/libsysprof-profile/sysprof-recording.c index c162b5f3..6e0258b1 100644 --- a/src/libsysprof-profile/sysprof-recording.c +++ b/src/libsysprof-profile/sysprof-recording.c @@ -215,6 +215,9 @@ stop_recording: /* Update start/end times to be the "running time" */ _sysprof_capture_writer_set_time_range (self->writer, begin_time, end_time); + /* Clear buffers and ensure the disk layer has access to them */ + sysprof_capture_writer_flush (self->writer); + if (error != NULL) return dex_future_new_for_error (g_steal_pointer (&error));