[gtk/new-sysprof: 15/15] wip: Port test-performance to use sysprof-cli
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/new-sysprof: 15/15] wip: Port test-performance to use sysprof-cli
- Date: Fri, 21 Aug 2020 17:26:17 +0000 (UTC)
commit 5377026e610358f68d676ab0ba6d3e7d4e8f0636
Author: Matthias Clasen <mclasen redhat com>
Date: Fri Aug 21 13:24:29 2020 -0400
wip: Port test-performance to use sysprof-cli
This isn't working for the tests yet, since it
needs a single-application mode that we don't
quite have in sysprof-cli.
testsuite/performance/test-performance.c | 20 +++++++++++++++-----
1 file changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/testsuite/performance/test-performance.c b/testsuite/performance/test-performance.c
index be135c73ba..2a8b6d902c 100644
--- a/testsuite/performance/test-performance.c
+++ b/testsuite/performance/test-performance.c
@@ -64,7 +64,6 @@ main (int argc, char *argv[])
GError *error = NULL;
Data data;
SysprofCaptureFrameType type;
- char fd_str[20];
gint64 *values;
gint64 min, max, total;
int count;
@@ -124,21 +123,32 @@ main (int argc, char *argv[])
SysprofCaptureReader *reader;
SysprofCaptureCursor *cursor;
SysprofCaptureCondition *condition;
+ char **child_argv;
fd = g_file_open_tmp ("gtk.XXXXXX.syscap", &name, &error);
if (error)
g_error ("Create syscap file: %s", error->message);
+ close (fd); // sysprof-cli uses O_EXCL
+
+ child_argv = g_new (char *, argc + 6);
+ child_argv[0] = (char *)"sysprof-cli";
+ child_argv[1] = (char *)"--force";
+ child_argv[2] = (char *)"--use-trace-fd";
+ child_argv[3] = name;
+ child_argv[5] = (char *)"--";
+ for (i = 0; i + 1 < argc; i++)
+ child_argv[6 + i] = argv[i + 1];
+ child_argv[6 + argc - 1] = NULL;
launcher = g_subprocess_launcher_new (0);
- g_subprocess_launcher_take_fd (launcher, fd, fd);
- g_snprintf (fd_str, sizeof (fd_str), "%d", fd);
- g_subprocess_launcher_setenv (launcher, "GTK_TRACE_FD", fd_str, TRUE);
g_subprocess_launcher_setenv (launcher, "GTK_DEBUG_AUTO_QUIT", "1", TRUE);
- subprocess = g_subprocess_launcher_spawnv (launcher, (const char *const *)argv + 1, &error);
+ subprocess = g_subprocess_launcher_spawnv (launcher, (const char *const *)child_argv, &error);
if (error)
g_error ("Launch child: %s", error->message);
+ g_free (child_argv);
+
if (!g_subprocess_wait (subprocess, NULL, &error))
g_error ("Run child: %s", error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]