control-fd: add SysprofControlSource

This is a source that will allow the inferior to call into Sysprof to
create a new mmap()'d ring buffer to share data. This allows significantly
less overhead in the child process as Sysprof itself will take care of
copying the data out of the inferior into the final capture file. There is
more copying of course, but less intrusive to the inferior itself.
This commit is contained in:
Christian Hergert
2020-02-13 18:53:58 -08:00
parent 77400c57c1
commit 089f5d7c56
4 changed files with 343 additions and 0 deletions

View File

@ -34,6 +34,7 @@
#include "sysprof-local-profiler.h"
#include "sysprof-platform.h"
#include "sysprof-control-source.h"
#include "sysprof-gjs-source.h"
#include "sysprof-hostinfo-source.h"
#ifdef __linux__
@ -712,6 +713,7 @@ sysprof_local_profiler_start (SysprofProfiler *profiler)
SysprofLocalProfiler *self = (SysprofLocalProfiler *)profiler;
SysprofLocalProfilerPrivate *priv = sysprof_local_profiler_get_instance_private (self);
SysprofHelpers *helpers = sysprof_helpers_get_default ();
g_autoptr(SysprofControlSource) control_source = NULL;
g_return_if_fail (SYSPROF_IS_LOCAL_PROFILER (self));
g_return_if_fail (priv->is_running == FALSE);
@ -721,6 +723,9 @@ sysprof_local_profiler_start (SysprofProfiler *profiler)
g_clear_pointer (&priv->timer, g_timer_destroy);
g_object_notify (G_OBJECT (self), "elapsed");
control_source = sysprof_control_source_new ();
sysprof_profiler_add_source (SYSPROF_PROFILER (self), SYSPROF_SOURCE (control_source));
sysprof_helpers_authorize_async (helpers,
NULL,
sysprof_local_profiler_authorize_cb,