diff options
Diffstat (limited to 'tools/perf/builtin-lock.c')
-rw-r--r-- | tools/perf/builtin-lock.c | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/tools/perf/builtin-lock.c b/tools/perf/builtin-lock.c index 574e30ec6d7c..474dfd59d7eb 100644 --- a/tools/perf/builtin-lock.c +++ b/tools/perf/builtin-lock.c @@ -4,13 +4,13 @@ #include "builtin.h" #include "perf.h" -#include "util/evlist.h" +#include "util/evlist.h" // for struct evsel_str_handler #include "util/evsel.h" -#include "util/cache.h" #include "util/symbol.h" #include "util/thread.h" #include "util/header.h" +#include <subcmd/pager.h> #include <subcmd/parse-options.h> #include "util/trace-event.h" @@ -30,6 +30,7 @@ #include <linux/hash.h> #include <linux/kernel.h> #include <linux/zalloc.h> +#include <linux/err.h> static struct perf_session *session; @@ -347,16 +348,16 @@ alloc_failed: } struct trace_lock_handler { - int (*acquire_event)(struct perf_evsel *evsel, + int (*acquire_event)(struct evsel *evsel, struct perf_sample *sample); - int (*acquired_event)(struct perf_evsel *evsel, + int (*acquired_event)(struct evsel *evsel, struct perf_sample *sample); - int (*contended_event)(struct perf_evsel *evsel, + int (*contended_event)(struct evsel *evsel, struct perf_sample *sample); - int (*release_event)(struct perf_evsel *evsel, + int (*release_event)(struct evsel *evsel, struct perf_sample *sample); }; @@ -396,7 +397,7 @@ enum acquire_flags { READ_LOCK = 2, }; -static int report_lock_acquire_event(struct perf_evsel *evsel, +static int report_lock_acquire_event(struct evsel *evsel, struct perf_sample *sample) { void *addr; @@ -468,7 +469,7 @@ end: return 0; } -static int report_lock_acquired_event(struct perf_evsel *evsel, +static int report_lock_acquired_event(struct evsel *evsel, struct perf_sample *sample) { void *addr; @@ -531,7 +532,7 @@ end: return 0; } -static int report_lock_contended_event(struct perf_evsel *evsel, +static int report_lock_contended_event(struct evsel *evsel, struct perf_sample *sample) { void *addr; @@ -586,7 +587,7 @@ end: return 0; } -static int report_lock_release_event(struct perf_evsel *evsel, +static int report_lock_release_event(struct evsel *evsel, struct perf_sample *sample) { void *addr; @@ -656,7 +657,7 @@ static struct trace_lock_handler report_lock_ops = { static struct trace_lock_handler *trace_handler; -static int perf_evsel__process_lock_acquire(struct perf_evsel *evsel, +static int perf_evsel__process_lock_acquire(struct evsel *evsel, struct perf_sample *sample) { if (trace_handler->acquire_event) @@ -664,7 +665,7 @@ static int perf_evsel__process_lock_acquire(struct perf_evsel *evsel, return 0; } -static int perf_evsel__process_lock_acquired(struct perf_evsel *evsel, +static int perf_evsel__process_lock_acquired(struct evsel *evsel, struct perf_sample *sample) { if (trace_handler->acquired_event) @@ -672,7 +673,7 @@ static int perf_evsel__process_lock_acquired(struct perf_evsel *evsel, return 0; } -static int perf_evsel__process_lock_contended(struct perf_evsel *evsel, +static int perf_evsel__process_lock_contended(struct evsel *evsel, struct perf_sample *sample) { if (trace_handler->contended_event) @@ -680,7 +681,7 @@ static int perf_evsel__process_lock_contended(struct perf_evsel *evsel, return 0; } -static int perf_evsel__process_lock_release(struct perf_evsel *evsel, +static int perf_evsel__process_lock_release(struct evsel *evsel, struct perf_sample *sample) { if (trace_handler->release_event) @@ -806,13 +807,13 @@ static int dump_info(void) return rc; } -typedef int (*tracepoint_handler)(struct perf_evsel *evsel, +typedef int (*tracepoint_handler)(struct evsel *evsel, struct perf_sample *sample); static int process_sample_event(struct perf_tool *tool __maybe_unused, union perf_event *event, struct perf_sample *sample, - struct perf_evsel *evsel, + struct evsel *evsel, struct machine *machine) { int err = 0; @@ -847,7 +848,7 @@ static void sort_result(void) } } -static const struct perf_evsel_str_handler lock_tracepoints[] = { +static const struct evsel_str_handler lock_tracepoints[] = { { "lock:lock_acquire", perf_evsel__process_lock_acquire, }, /* CONFIG_LOCKDEP */ { "lock:lock_acquired", perf_evsel__process_lock_acquired, }, /* CONFIG_LOCKDEP, CONFIG_LOCK_STAT */ { "lock:lock_contended", perf_evsel__process_lock_contended, }, /* CONFIG_LOCKDEP, CONFIG_LOCK_STAT */ @@ -872,9 +873,9 @@ static int __cmd_report(bool display_info) }; session = perf_session__new(&data, false, &eops); - if (!session) { + if (IS_ERR(session)) { pr_err("Initializing perf session failed\n"); - return -1; + return PTR_ERR(session); } symbol__init(&session->header.env); |