diff --git a/tests/python/test_histogram.py b/tests/python/test_histogram.py index 2fb8c1685d73..ec7950c9d5a7 100755 --- a/tests/python/test_histogram.py +++ b/tests/python/test_histogram.py @@ -59,10 +59,15 @@ def test_chars(self): b = BPF(text=""" #include #include +#include typedef struct { char name[TASK_COMM_LEN]; u64 slot; } Key; BPF_HISTOGRAM(hist1, Key, 1024); int kprobe__finish_task_switch(struct pt_regs *ctx, struct task_struct *prev) { +#if LINUX_VERSION_CODE < KERNEL_VERSION(5,5,0) Key k = {.slot = bpf_log2l(prev->real_start_time)}; +#else + Key k = {.slot = bpf_log2l(prev->start_boottime)}; +#endif if (!bpf_get_current_comm(&k.name, sizeof(k.name))) hist1.increment(k); return 0;