libsysprof-profile: give Profiler a spawnable

And pass it along to the recording so that it can manage spawning the
subprocess during the record loop.
This commit is contained in:
Christian Hergert
2023-06-02 16:15:27 -07:00
parent ba9d29fa33
commit 5746add9c6
4 changed files with 69 additions and 30 deletions

View File

@ -164,45 +164,18 @@ sysprof_recording_finalize (GObject *object)
g_clear_pointer (&self->writer, sysprof_capture_writer_unref);
g_clear_pointer (&self->instruments, g_ptr_array_unref);
g_clear_object (&self->spawnable);
dex_clear (&self->fiber);
G_OBJECT_CLASS (sysprof_recording_parent_class)->finalize (object);
}
static void
sysprof_recording_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
sysprof_recording_set_property (GObject *object,
guint prop_id,
const GValue *value,
GParamSpec *pspec)
{
switch (prop_id)
{
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
}
}
static void
sysprof_recording_class_init (SysprofRecordingClass *klass)
{
GObjectClass *object_class = G_OBJECT_CLASS (klass);
object_class->finalize = sysprof_recording_finalize;
object_class->get_property = sysprof_recording_get_property;
object_class->set_property = sysprof_recording_set_property;
}
static void
@ -214,6 +187,7 @@ sysprof_recording_init (SysprofRecording *self)
SysprofRecording *
_sysprof_recording_new (SysprofCaptureWriter *writer,
SysprofSpawnable *spawnable,
SysprofInstrument **instruments,
guint n_instruments)
{
@ -224,6 +198,8 @@ _sysprof_recording_new (SysprofCaptureWriter *writer,
self = g_object_new (SYSPROF_TYPE_RECORDING, NULL);
self->writer = sysprof_capture_writer_ref (writer);
g_set_object (&self->spawnable, spawnable);
for (guint i = 0; i < n_instruments; i++)
g_ptr_array_add (self->instruments, g_object_ref (instruments[i]));