From b0a3736ff4613c34160b6f83f8b91aa56a0c1c99 Mon Sep 17 00:00:00 2001 From: Christian Hergert Date: Tue, 6 Jun 2023 16:15:45 -0700 Subject: [PATCH] libsysprof-profile: add memprof to profiler test --- src/libsysprof-profile/tests/test-profiler.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/libsysprof-profile/tests/test-profiler.c b/src/libsysprof-profile/tests/test-profiler.c index 54d28f82..fd056db8 100644 --- a/src/libsysprof-profile/tests/test-profiler.c +++ b/src/libsysprof-profile/tests/test-profiler.c @@ -18,6 +18,8 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ +#include "config.h" + #include #include @@ -26,8 +28,10 @@ static GMainLoop *main_loop; static char *capture_file; static SysprofRecording *active_recording; +static gboolean memprof; static const GOptionEntry entries[] = { { "capture", 'c', 0, G_OPTION_ARG_FILENAME, &capture_file, "The file to capture into", "CAPTURE" }, + { "memprof", 'm', 0, G_OPTION_ARG_NONE, &memprof, "Do memory allocation tracking on subprocess" }, { 0 } }; @@ -148,6 +152,10 @@ main (int argc, sysprof_spawnable_append_args (spawnable, (const char * const *)&argv[i+1]); sysprof_profiler_set_spawnable (profiler, spawnable); + if (memprof) + sysprof_spawnable_add_ld_preload (spawnable, + PACKAGE_LIBDIR "/libsysprof-memory-" API_VERSION_S ".so"); + trace_fd = sysprof_spawnable_add_trace_fd (spawnable, NULL); } }