Skip to content

Commit 7268500

Browse files
committed
libbpf-tools/softirqslower: Fix review comments
- Use ARRAY_SIZE(stage_names) instead of magic number 2 for stage bounds check, so adding a new stage enum value automatically extends the valid range without a separate update here. - Update man page SYNOPSIS from softirqslower.py to softirqslower to reflect the libbpf CO-RE binary. Change-Id: I2c5c63282a40276a73eb37b1cae197fe83f2c374
1 parent 7ffb614 commit 7268500

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

libbpf-tools/softirqslower.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include "softirqslower.skel.h"
1717
#include "trace_helpers.h"
1818

19+
#define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
20+
1921
static volatile sig_atomic_t exiting = 0;
2022

2123
struct env {
@@ -136,7 +138,7 @@ static void handle_event(void *ctx, int cpu, void *data, __u32 data_sz)
136138

137139
printf("%-8s %-20s %-8s %-14llu %-6u %-16s\n",
138140
ts,
139-
e.stage < 2 ? stage_names[e.stage] : "unknown",
141+
e.stage < ARRAY_SIZE(stage_names) ? stage_names[e.stage] : "unknown",
140142
e.vec < NR_SOFTIRQS ? vec_names[e.vec] : "unknown",
141143
e.delta_us,
142144
e.cpu,

man/man8/softirqslower.8

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
.SH NAME
33
softirqslower \- Trace softirq handlers with latency exceeding a threshold
44
.SH SYNOPSIS
5-
.B softirqslower.py
5+
.B softirqslower
66
.RI [min_us]
77
.br
8-
.B softirqslower.py
8+
.B softirqslower
99
.RB [ \-c
1010
.IR CPU ]
1111
.RI [min_us]

0 commit comments

Comments
 (0)