perf record: Fix priv level with branch sampling for paranoid=2
[linux-2.6-microblaze.git] / tools / perf / perf.c
index 97e2628..bb40a10 100644 (file)
@@ -1,4 +1,3 @@
-// SPDX-License-Identifier: GPL-2.0
 /*
  * perf.c
  *
@@ -8,7 +7,10 @@
  * perf top, perf record, perf report, etc.) are started.
  */
 #include "builtin.h"
+#include "perf.h"
 
+#include "util/build-id.h"
+#include "util/cache.h"
 #include "util/env.h"
 #include <subcmd/exec-cmd.h>
 #include "util/config.h"
@@ -18,6 +20,9 @@
 #include "util/bpf-loader.h"
 #include "util/debug.h"
 #include "util/event.h"
+#include "util/util.h" // page_size, usage()
+#include "ui/ui.h"
+#include "perf-sys.h"
 #include <api/fs/fs.h>
 #include <api/fs/tracing_path.h>
 #include <errno.h>
@@ -29,6 +34,7 @@
 #include <sys/stat.h>
 #include <unistd.h>
 #include <linux/kernel.h>
+#include <linux/string.h>
 #include <linux/zalloc.h>
 
 const char perf_usage_string[] =
@@ -441,6 +447,9 @@ int main(int argc, const char **argv)
 
        srandom(time(NULL));
 
+       /* Setting $PERF_CONFIG makes perf read _only_ the given config file. */
+       config_exclusive_filename = getenv("PERF_CONFIG");
+
        err = perf_config(perf_default_config, NULL);
        if (err)
                return err;