projects
/
linux-2.6-microblaze.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
58ecb3a
)
veristat: Fix top source line stat collection
author
Mykyta Yatsenko
<yatsenko@meta.com>
Tue, 17 Dec 2024 18:11:13 +0000
(18:11 +0000)
committer
Andrii Nakryiko
<andrii@kernel.org>
Tue, 17 Dec 2024 23:09:33 +0000
(15:09 -0800)
Fix comparator implementation to return most popular source code
lines instead of least.
Introduce min/max macro for building veristat outside of Linux
repository.
Signed-off-by: Mykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link:
https://lore.kernel.org/bpf/20241217181113.364651-1-mykyta.yatsenko5@gmail.com
tools/testing/selftests/bpf/veristat.c
patch
|
blob
|
history
diff --git
a/tools/testing/selftests/bpf/veristat.c
b/tools/testing/selftests/bpf/veristat.c
index
162fe27
..
9d17b4d
100644
(file)
--- a/
tools/testing/selftests/bpf/veristat.c
+++ b/
tools/testing/selftests/bpf/veristat.c
@@
-26,6
+26,14
@@
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]))
#endif
+#ifndef max
+#define max(a, b) ((a) > (b) ? (a) : (b))
+#endif
+
+#ifndef min
+#define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
enum stat_id {
VERDICT,
DURATION,
@@
-904,7
+912,7
@@
static int line_cnt_cmp(const void *a, const void *b)
const struct line_cnt *b_cnt = (const struct line_cnt *)b;
if (a_cnt->cnt != b_cnt->cnt)
- return a_cnt->cnt
<
b_cnt->cnt ? -1 : 1;
+ return a_cnt->cnt
>
b_cnt->cnt ? -1 : 1;
return strcmp(a_cnt->line, b_cnt->line);
}