[sysprof] sysprof-cli: allow disabling perf stacktraces



commit 84850218ed88ac70f2274558c218b9ad2d2e2d74
Author: Christian Hergert <chergert redhat com>
Date:   Wed Jun 5 16:55:50 2019 -0700

    sysprof-cli: allow disabling perf stacktraces

 src/tools/sysprof-cli.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/tools/sysprof-cli.c b/src/tools/sysprof-cli.c
index 29c03f5..fc5261f 100644
--- a/src/tools/sysprof-cli.c
+++ b/src/tools/sysprof-cli.c
@@ -82,6 +82,7 @@ main (gint   argc,
   gboolean no_memory = FALSE;
   gboolean no_cpu = FALSE;
   gboolean no_decode = FALSE;
+  gboolean no_perf = FALSE;
   gboolean version = FALSE;
   gboolean force = FALSE;
   gboolean use_trace_fd = FALSE;
@@ -94,6 +95,7 @@ main (gint   argc,
     { "command", 'c', 0, G_OPTION_ARG_STRING, &command, N_("Run a command and profile the process"), 
N_("COMMAND") },
     { "force", 'f', 0, G_OPTION_ARG_NONE, &force, N_("Force overwrite the capture file") },
     { "no-cpu", 0, 0, G_OPTION_ARG_NONE, &no_cpu, N_("Disable recording of CPU statistics") },
+    { "no-perf", 0, 0, G_OPTION_ARG_NONE, &no_perf, N_("Do not record stacktraces using Linux perf") },
     { "no-decode", 0, 0, G_OPTION_ARG_NONE, &no_decode, N_("Do not append symbol name information from local 
machine") },
     { "no-memory", 0, 0, G_OPTION_ARG_NONE, &no_memory, N_("Disable recording of memory statistics") },
     { "use-trace-fd", 0, 0, G_OPTION_ARG_NONE, &use_trace_fd, N_("Set SYSPROF_TRACE_FD environment for 
subprocess") },
@@ -232,9 +234,14 @@ main (gint   argc,
   sysprof_profiler_add_source (profiler, source);
   g_object_unref (source);
 
-  source = sysprof_perf_source_new ();
-  sysprof_profiler_add_source (profiler, source);
-  g_object_unref (source);
+#ifdef __linux__
+  if (!no_perf)
+    {
+      source = sysprof_perf_source_new ();
+      sysprof_profiler_add_source (profiler, source);
+      g_object_unref (source);
+    }
+#endif
 
   if (!no_decode)
     {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]