summaryrefslogtreecommitdiff
path: root/tools/perf/util/bpf_skel
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung@kernel.org>2022-08-02 22:10:04 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2022-08-03 00:03:31 +0300
commit6d499a6b3d90277dbb7e408e7c70d68b507ef383 (patch)
treec7b31abbff7da55a7a83e42f7f149377f17ba46c /tools/perf/util/bpf_skel
parentceb13bfc01d55388092c00796a5b76aa3dfa483a (diff)
downloadlinux-6d499a6b3d90277dbb7e408e7c70d68b507ef383.tar.xz
perf lock: Print the number of lost entries for BPF
Like the normal 'perf lock contention' output, it'd print the number of lost entries for BPF if exists or -v option is passed. Currently it uses BROKEN_CONTENDED stat for the lost count (due to full stack maps). $ sudo perf lock con -a -b --map-nr-entries 128 sleep 5 ... === output for debug=== bad: 43, total: 14903 bad rate: 0.29 % histogram of events caused bad sequence acquire: 0 acquired: 0 contended: 43 release: 0 Signed-off-by: Namhyung Kim <namhyung@kernel.org> Cc: Blake Jones <blakejones@google.com> Cc: Boqun Feng <boqun.feng@gmail.com> Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Ian Rogers <irogers@google.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Jiri Olsa <jolsa@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Song Liu <songliubraving@fb.com> Cc: Waiman Long <longman@redhat.com> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20220802191004.347740-3-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/bpf_skel')
-rw-r--r--tools/perf/util/bpf_skel/lock_contention.bpf.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/perf/util/bpf_skel/lock_contention.bpf.c b/tools/perf/util/bpf_skel/lock_contention.bpf.c
index 67d46533e518..9e8b94eb6320 100644
--- a/tools/perf/util/bpf_skel/lock_contention.bpf.c
+++ b/tools/perf/util/bpf_skel/lock_contention.bpf.c
@@ -12,7 +12,7 @@
#define MAX_ENTRIES 10240
struct contention_key {
- __u32 stack_id;
+ __s32 stack_id;
};
struct contention_data {
@@ -27,7 +27,7 @@ struct tstamp_data {
__u64 timestamp;
__u64 lock;
__u32 flags;
- __u32 stack_id;
+ __s32 stack_id;
};
/* callstack storage */
@@ -73,6 +73,9 @@ int enabled;
int has_cpu;
int has_task;
+/* error stat */
+unsigned long lost;
+
static inline int can_record(void)
{
if (has_cpu) {
@@ -116,6 +119,8 @@ int contention_begin(u64 *ctx)
pelem->flags = (__u32)ctx[1];
pelem->stack_id = bpf_get_stackid(ctx, &stacks, BPF_F_FAST_STACK_CMP);
+ if (pelem->stack_id < 0)
+ lost++;
return 0;
}