Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

veristat: Fix top source line stat collection

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

authored by

Mykyta Yatsenko and committed by
Andrii Nakryiko
a7c20512 58ecb3a7

+9 -1
+9 -1
tools/testing/selftests/bpf/veristat.c
··· 26 26 #define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0])) 27 27 #endif 28 28 29 + #ifndef max 30 + #define max(a, b) ((a) > (b) ? (a) : (b)) 31 + #endif 32 + 33 + #ifndef min 34 + #define min(a, b) ((a) < (b) ? (a) : (b)) 35 + #endif 36 + 29 37 enum stat_id { 30 38 VERDICT, 31 39 DURATION, ··· 912 904 const struct line_cnt *b_cnt = (const struct line_cnt *)b; 913 905 914 906 if (a_cnt->cnt != b_cnt->cnt) 915 - return a_cnt->cnt < b_cnt->cnt ? -1 : 1; 907 + return a_cnt->cnt > b_cnt->cnt ? -1 : 1; 916 908 return strcmp(a_cnt->line, b_cnt->line); 917 909 } 918 910