parse-events.c (21ee2fcbf8c0f1242a947569c9e3a1e37d94b376) parse-events.c (89896051f8dae5a04ada1f5fbeeaedc23f484f68)
1#include <linux/hw_breakpoint.h>
2#include <linux/err.h>
3#include "util.h"
4#include "../perf.h"
5#include "evlist.h"
6#include "evsel.h"
7#include <subcmd/parse-options.h>
8#include "parse-events.h"

--- 2006 unchanged lines hidden (view full) ---

2015 bool ret = true;
2016 int open_return;
2017 struct perf_evsel *evsel;
2018 struct perf_event_attr attr = {
2019 .type = type,
2020 .config = config,
2021 .disabled = 1,
2022 };
1#include <linux/hw_breakpoint.h>
2#include <linux/err.h>
3#include "util.h"
4#include "../perf.h"
5#include "evlist.h"
6#include "evsel.h"
7#include <subcmd/parse-options.h>
8#include "parse-events.h"

--- 2006 unchanged lines hidden (view full) ---

2015 bool ret = true;
2016 int open_return;
2017 struct perf_evsel *evsel;
2018 struct perf_event_attr attr = {
2019 .type = type,
2020 .config = config,
2021 .disabled = 1,
2022 };
2023 struct {
2024 struct thread_map map;
2025 int threads[1];
2026 } tmap = {
2027 .map.nr = 1,
2028 .threads = { 0 },
2029 };
2023 struct thread_map *tmap = thread_map__new_by_tid(0);
2030
2024
2025 if (tmap == NULL)
2026 return false;
2027
2031 evsel = perf_evsel__new(&attr);
2032 if (evsel) {
2028 evsel = perf_evsel__new(&attr);
2029 if (evsel) {
2033 open_return = perf_evsel__open(evsel, NULL, &tmap.map);
2030 open_return = perf_evsel__open(evsel, NULL, tmap);
2034 ret = open_return >= 0;
2035
2036 if (open_return == -EACCES) {
2037 /*
2038 * This happens if the paranoid value
2039 * /proc/sys/kernel/perf_event_paranoid is set to 2
2040 * Re-run with exclude_kernel set; we don't do that
2041 * by default as some ARM machines do not support it.
2042 *
2043 */
2044 evsel->attr.exclude_kernel = 1;
2031 ret = open_return >= 0;
2032
2033 if (open_return == -EACCES) {
2034 /*
2035 * This happens if the paranoid value
2036 * /proc/sys/kernel/perf_event_paranoid is set to 2
2037 * Re-run with exclude_kernel set; we don't do that
2038 * by default as some ARM machines do not support it.
2039 *
2040 */
2041 evsel->attr.exclude_kernel = 1;
2045 ret = perf_evsel__open(evsel, NULL, &tmap.map) >= 0;
2042 ret = perf_evsel__open(evsel, NULL, tmap) >= 0;
2046 }
2047 perf_evsel__delete(evsel);
2048 }
2049
2050 return ret;
2051}
2052
2053void print_sdt_events(const char *subsys_glob, const char *event_glob,

--- 446 unchanged lines hidden ---
2043 }
2044 perf_evsel__delete(evsel);
2045 }
2046
2047 return ret;
2048}
2049
2050void print_sdt_events(const char *subsys_glob, const char *event_glob,

--- 446 unchanged lines hidden ---