From 800c32e303f3f3bab9a092c0c59453aa32b9406c Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Fri, 26 May 2023 15:37:39 -0700 Subject: [PATCH] libsysprof-profile: add private API to get recording spawnable This will still need to be set by the profiler eventually, but this gets the readback API in place so we can use it from instruments. --- src/libsysprof-profile/sysprof-recording-private.h | 12 +++++++----- src/libsysprof-profile/sysprof-recording.c | 13 +++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/libsysprof-profile/sysprof-recording-private.h b/src/libsysprof-profile/sysprof-recording-private.h index 67852820..38f0354d 100644 --- a/src/libsysprof-profile/sysprof-recording-private.h +++ b/src/libsysprof-profile/sysprof-recording-private.h @@ -22,13 +22,15 @@ #include "sysprof-instrument.h" #include "sysprof-recording.h" +#include "sysprof-spawnable.h" G_BEGIN_DECLS -SysprofRecording *_sysprof_recording_new (SysprofCaptureWriter *writer, - SysprofInstrument **instruments, - guint n_instruments); -void _sysprof_recording_start (SysprofRecording *self); -SysprofCaptureWriter *_sysprof_recording_writer (SysprofRecording *self); +SysprofRecording *_sysprof_recording_new (SysprofCaptureWriter *writer, + SysprofInstrument **instruments, + guint n_instruments); +void _sysprof_recording_start (SysprofRecording *self); +SysprofCaptureWriter *_sysprof_recording_writer (SysprofRecording *self); +SysprofSpawnable *_sysprof_recording_get_spawnable (SysprofRecording *self); G_END_DECLS diff --git a/src/libsysprof-profile/sysprof-recording.c b/src/libsysprof-profile/sysprof-recording.c index 20c427dd..e0a753a9 100644 --- a/src/libsysprof-profile/sysprof-recording.c +++ b/src/libsysprof-profile/sysprof-recording.c @@ -35,6 +35,11 @@ struct _SysprofRecording { GObject parent_instance; + /* If we are spawning a process as part of this recording, this + * is the SysprofSpawnable used to spawn the process. + */ + SysprofSpawnable *spawnable; + /* This is where all of the instruments will write to. They are * expected to do this from the main-thread only. To work from * additional threads they need to proxy that state to the @@ -247,3 +252,11 @@ sysprof_recording_wait_finish (SysprofRecording *self, return dex_async_result_propagate_boolean (DEX_ASYNC_RESULT (result), error); } + +SysprofSpawnable * +_sysprof_recording_get_spawnable (SysprofRecording *self) +{ + g_return_val_if_fail (SYSPROF_IS_RECORDING (self), NULL); + + return self->spawnable; +}