mirror of
https://github.com/varun-r-mallya/sysprof.git
synced 2026-02-10 07:00:53 +00:00
Revert "libsysprof: do process setup before recording starts"
This reverts commit a286c2a8cb.
This is needed so that we get better system info currently for
processes spawned by sysprof-cli.
This commit is contained in:
@ -302,11 +302,7 @@ static DexFuture *
|
|||||||
sysprof_linux_instrument_prepare_fiber (gpointer user_data)
|
sysprof_linux_instrument_prepare_fiber (gpointer user_data)
|
||||||
{
|
{
|
||||||
SysprofRecording *recording = user_data;
|
SysprofRecording *recording = user_data;
|
||||||
g_autoptr(GDBusConnection) bus = NULL;
|
|
||||||
g_autoptr(GVariant) process_info_reply = NULL;
|
|
||||||
g_autoptr(GVariant) process_info = NULL;
|
|
||||||
g_autoptr(GError) error = NULL;
|
g_autoptr(GError) error = NULL;
|
||||||
gint64 at_time;
|
|
||||||
|
|
||||||
g_assert (SYSPROF_IS_RECORDING (recording));
|
g_assert (SYSPROF_IS_RECORDING (recording));
|
||||||
|
|
||||||
@ -324,14 +320,40 @@ sysprof_linux_instrument_prepare_fiber (gpointer user_data)
|
|||||||
add_process_output_as_file (recording, "glxinfo", "glxinfo", TRUE);
|
add_process_output_as_file (recording, "glxinfo", "glxinfo", TRUE);
|
||||||
add_process_output_as_file (recording, "lsusb -v", "lsusb", TRUE);
|
add_process_output_as_file (recording, "lsusb -v", "lsusb", TRUE);
|
||||||
|
|
||||||
|
return dex_future_new_for_boolean (TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DexFuture *
|
||||||
|
sysprof_linux_instrument_prepare (SysprofInstrument *instrument,
|
||||||
|
SysprofRecording *recording)
|
||||||
|
{
|
||||||
|
g_assert (SYSPROF_IS_INSTRUMENT (instrument));
|
||||||
|
g_assert (SYSPROF_IS_RECORDING (recording));
|
||||||
|
|
||||||
|
return dex_scheduler_spawn (NULL, 0,
|
||||||
|
sysprof_linux_instrument_prepare_fiber,
|
||||||
|
g_object_ref (recording),
|
||||||
|
g_object_unref);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DexFuture *
|
||||||
|
sysprof_linux_instrument_record_fiber (gpointer user_data)
|
||||||
|
{
|
||||||
|
SysprofRecording *recording = user_data;
|
||||||
|
g_autoptr(GDBusConnection) bus = NULL;
|
||||||
|
g_autoptr(GVariant) process_info_reply = NULL;
|
||||||
|
g_autoptr(GVariant) process_info = NULL;
|
||||||
|
g_autoptr(GError) error = NULL;
|
||||||
|
gint64 at_time;
|
||||||
|
|
||||||
|
g_assert (SYSPROF_IS_RECORDING (recording));
|
||||||
|
|
||||||
/* We need access to the bus to call various sysprofd API directly */
|
/* We need access to the bus to call various sysprofd API directly */
|
||||||
if (!(bus = dex_await_object (dex_bus_get (G_BUS_TYPE_SYSTEM), &error)))
|
if (!(bus = dex_await_object (dex_bus_get (G_BUS_TYPE_SYSTEM), &error)))
|
||||||
return dex_future_new_for_error (g_steal_pointer (&error));
|
return dex_future_new_for_error (g_steal_pointer (&error));
|
||||||
|
|
||||||
/* Normally we would want to do this once recording has started since we
|
/* We also want to get a bunch of info on user processes so that we can add
|
||||||
* want to reduce the chances we miss a process being executed. But that
|
* records about them to the recording.
|
||||||
* race condition exists anyway so instead do it during prepare so that
|
|
||||||
* we don't waste so much time on our profiles with our own process.
|
|
||||||
*/
|
*/
|
||||||
at_time = SYSPROF_CAPTURE_CURRENT_TIME;
|
at_time = SYSPROF_CAPTURE_CURRENT_TIME;
|
||||||
if (!(process_info_reply = dex_await_variant (dex_dbus_connection_call (bus,
|
if (!(process_info_reply = dex_await_variant (dex_dbus_connection_call (bus,
|
||||||
@ -354,14 +376,15 @@ sysprof_linux_instrument_prepare_fiber (gpointer user_data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static DexFuture *
|
static DexFuture *
|
||||||
sysprof_linux_instrument_prepare (SysprofInstrument *instrument,
|
sysprof_linux_instrument_record (SysprofInstrument *instrument,
|
||||||
SysprofRecording *recording)
|
SysprofRecording *recording,
|
||||||
|
GCancellable *cancellable)
|
||||||
{
|
{
|
||||||
g_assert (SYSPROF_IS_INSTRUMENT (instrument));
|
g_assert (SYSPROF_IS_INSTRUMENT (instrument));
|
||||||
g_assert (SYSPROF_IS_RECORDING (recording));
|
g_assert (SYSPROF_IS_RECORDING (recording));
|
||||||
|
|
||||||
return dex_scheduler_spawn (NULL, 0,
|
return dex_scheduler_spawn (NULL, 0,
|
||||||
sysprof_linux_instrument_prepare_fiber,
|
sysprof_linux_instrument_record_fiber,
|
||||||
g_object_ref (recording),
|
g_object_ref (recording),
|
||||||
g_object_unref);
|
g_object_unref);
|
||||||
}
|
}
|
||||||
@ -392,6 +415,7 @@ sysprof_linux_instrument_class_init (SysprofLinuxInstrumentClass *klass)
|
|||||||
|
|
||||||
instrument_class->list_required_policy = sysprof_linux_instrument_list_required_policy;
|
instrument_class->list_required_policy = sysprof_linux_instrument_list_required_policy;
|
||||||
instrument_class->prepare = sysprof_linux_instrument_prepare;
|
instrument_class->prepare = sysprof_linux_instrument_prepare;
|
||||||
|
instrument_class->record = sysprof_linux_instrument_record;
|
||||||
instrument_class->process_started = sysprof_linux_instrument_process_started;
|
instrument_class->process_started = sysprof_linux_instrument_process_started;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user