Skip to contentSkip to conversation

perf stat: Display iostat headers correctly

PATCH Applied Yicong Yang 3 participants 4 messages Aug 2, 2024 – Aug 16, 2024 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf stat: Display iostat headers correctly

From: Yicong Yang <[email protected]>

Currently we'll only print metric headers for metric leader in aggregration mode. This will make perf iostat header not shown since it'll aggregrated globally but don't have metric events:

root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
 Performance counter stats for 'system wide':
    port
0000:00                    0                    0                    0                    0
0000:80                    0                    0                    0                    0
[...]

Fix this by excluding the iostat in the check of printing metric headers. Then we can see the headers:

root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
 Performance counter stats for 'system wide':
    port             Inbound Read(MB)    Inbound Write(MB)    Outbound Read(MB)   Outbound Write(MB)
0000:00                    0                    0                    0                    0
0000:80                    0                    0                    0                    0
[...]
Fixes 193a9e30207f ("perf stat: Don't display metric header for non-leader uncore events")
---
 tools/perf/util/stat-display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/stat-display.c +2 -1
index c38bcb6f4c78..ea96e4ebad8c 100644
@@ -1237,7 +1237,8 @@ static void print_metric_headers(struct perf_stat_config *config,
 
 	/* Print metrics headers only */
 	evlist__for_each_entry(evlist, counter) {
-		if (config->aggr_mode != AGGR_NONE && counter->metric_leader != counter)
+		if (!config->iostat_run &&
+		    config->aggr_mode != AGGR_NONE && counter->metric_leader != counter)
 			continue;
 
 		os.evsel = counter;
Signature · 1 line
2.24.0
#1 lore raw

A gentle ping...

Quoted 42 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Currently we'll only print metric headers for metric leader in aggregration mode. This will make perf iostat header not shown since it'll aggregrated globally but don't have metric events:

root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
 Performance counter stats for 'system wide':
    port
0000:00                    0                    0                    0                    0
0000:80                    0                    0                    0                    0
[...]

Fix this by excluding the iostat in the check of printing metric headers. Then we can see the headers:

root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
 Performance counter stats for 'system wide':
    port             Inbound Read(MB)    Inbound Write(MB)    Outbound Read(MB)   Outbound Write(MB)
0000:00                    0                    0                    0                    0
0000:80                    0                    0                    0                    0
[...]
Fixes 193a9e30207f ("perf stat: Don't display metric header for non-leader uncore events")
---
 tools/perf/util/stat-display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/stat-display.c +2 -1
index c38bcb6f4c78..ea96e4ebad8c 100644
@@ -1237,7 +1237,8 @@ static void print_metric_headers(struct perf_stat_config *config,
 
 	/* Print metrics headers only */
 	evlist__for_each_entry(evlist, counter) {
-		if (config->aggr_mode != AGGR_NONE && counter->metric_leader != counter)
+		if (!config->iostat_run &&
+		    config->aggr_mode != AGGR_NONE && counter->metric_leader != counter)
 			continue;
 
 		os.evsel = counter;
maintainer Acked-by on v1 1/1
#2 lore raw
In reply to Yicong Yang
Quoted 21 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Currently we'll only print metric headers for metric leader in aggregration mode. This will make perf iostat header not shown since it'll aggregrated globally but don't have metric events:

root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
 Performance counter stats for 'system wide':
    port
0000:00                    0                    0                    0                    0
0000:80                    0                    0                    0                    0
[...]

Fix this by excluding the iostat in the check of printing metric headers. Then we can see the headers:

root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
 Performance counter stats for 'system wide':
    port             Inbound Read(MB)    Inbound Write(MB)    Outbound Read(MB)   Outbound Write(MB)
0000:00                    0                    0                    0                    0
0000:80                    0                    0                    0                    0
[...]
Quoted 2 lines
Fixes 193a9e30207f ("perf stat: Don't display metric header for non-leader uncore events")

Thanks,
Namhyung

Quoted 21 lines
---
 tools/perf/util/stat-display.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/perf/util/stat-display.c +2 -1
index c38bcb6f4c78..ea96e4ebad8c 100644
@@ -1237,7 +1237,8 @@ static void print_metric_headers(struct perf_stat_config *config,
 
 	/* Print metrics headers only */
 	evlist__for_each_entry(evlist, counter) {
-		if (config->aggr_mode != AGGR_NONE && counter->metric_leader != counter)
+		if (!config->iostat_run &&
+		    config->aggr_mode != AGGR_NONE && counter->metric_leader != counter)
 			continue;
 
 		os.evsel = counter;
Signature · 1 line
2.24.0
maintainer Applied
#3 lore raw
Quoted 22 lines · Namhyung Kim
Quoted 21 lines · Yicong Yang

From: Yicong Yang <[email protected]>

Currently we'll only print metric headers for metric leader in aggregration mode. This will make perf iostat header not shown since it'll aggregrated globally but don't have metric events:

root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
 Performance counter stats for 'system wide':
    port
0000:00                    0                    0                    0                    0
0000:80                    0                    0                    0                    0
[...]

Fix this by excluding the iostat in the check of printing metric headers. Then we can see the headers:

root@ubuntu204:/home/yang/linux/tools/perf# ./perf stat --iostat --timeout 1000
 Performance counter stats for 'system wide':
    port             Inbound Read(MB)    Inbound Write(MB)    Outbound Read(MB)   Outbound Write(MB)
0000:00                    0                    0                    0                    0
0000:80                    0                    0                    0                    0
[...]
Quoted 4 lines
Quoted 2 lines
Fixes 193a9e30207f ("perf stat: Don't display metric header for non-leader uncore events")

Thanks, applied to perf-tools-next,

- Arnaldo