Skip to contentSkip to conversation

perf script: Fix --max-blocks man page description

PATCH Applied Andi Kleen 3 participants 9 messages Jul 11, 2019 – Jul 23, 2019 perf events

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/3 perf script: Fix --max-blocks man page description

From: Andi Kleen <[email protected]>

The --max-blocks description was using the old name brstackasm. Use brstackinsn instead.

---
 tools/perf/Documentation/perf-script.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Documentation/perf-script.txt +1 -1
index d4e2e18a5881..042b9e5dcc32 100644
@@ -384,7 +384,7 @@ include::itrace.txt[]
 	perf script --time 0%-10%,30%-40%
 
 --max-blocks::
-	Set the maximum number of program blocks to print with brstackasm for
+	Set the maximum number of program blocks to print with brstackinsn for
 	each sample.
 
 --reltime::
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH 2/3 perf script: Fix off by one in brstackinsn IPC computation

From: Andi Kleen <[email protected]>

When we hit the end of a program block, need to count the last instruction too for the IPC computation. This caused large errors for small blocks.

% perf script -b ls / > /dev/null

Before:

% perf script -F +brstackinsn --xed
...

        00007f94c9ac70d8                        jz 0x7f94c9ac70e3                       # PRED 3 cycles [36] 4.33 IPC
        00007f94c9ac70e3                        testb  $0x20, 0x31d(%rbx)
        00007f94c9ac70ea                        jnz 0x7f94c9ac70b0
        00007f94c9ac70ec                        testb  $0x8, 0x205ad(%rip)
        00007f94c9ac70f3                        jz 0x7f94c9ac6ff0               # PRED 1 cycles [37] 3.00 IPC

After:

% perf script -F +brstackinsn --xed
...

        00007f94c9ac70d8                        jz 0x7f94c9ac70e3                       # PRED 3 cycles [15] 4.67 IPC
        00007f94c9ac70e3                        testb  $0x20, 0x31d(%rbx)
        00007f94c9ac70ea                        jnz 0x7f94c9ac70b0
        00007f94c9ac70ec                        testb  $0x8, 0x205ad(%rip)
        00007f94c9ac70f3                        jz 0x7f94c9ac6ff0               # PRED 1 cycles [16] 4.00 IPC
---
 tools/perf/builtin-script.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-script.c +1 -1
index 2f6232f1bfdc..9a63cb3442a9 100644
@@ -1059,7 +1059,7 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,
 
 			printed += ip__fprintf_sym(ip, thread, x.cpumode, x.cpu, &lastsym, attr, fp);
 			if (ip == end) {
-				printed += ip__fprintf_jump(ip, &br->entries[i], &x, buffer + off, len - off, insn, fp,
+				printed += ip__fprintf_jump(ip, &br->entries[i], &x, buffer + off, len - off, ++insn, fp,
 							    &total_cycles);
 				if (PRINT_FIELD(SRCCODE))
 					printed += print_srccode(thread, x.cpumode, ip);
Signature · 1 line
2.20.1
#2 lore raw

Re: [PATCH 2/3] perf script: Fix off by one in brstackinsn IPC computation

Em Thu, Jul 11, 2019 at 11:19:21AM -0700, Andi Kleen escreveu:

Quoted 8 lines

From: Andi Kleen <[email protected]>

When we hit the end of a program block, need to count the last instruction too for the IPC computation. This caused large errors for small blocks.

% perf script -b ls / > /dev/null

Before:

Thanks, applied.

- Arnaldo

#3 lore raw

[tip:perf/urgent] perf script: Fix off by one in brstackinsn IPC computation

In reply to Andi Kleen
perf script: Fix off by one in brstackinsn IPC computation
Commit-ID:  dde4e732a5b02fa5599c2c0e6c48a0c11789afc4
Gitweb:     https://git.kernel.org/tip/dde4e732a5b02fa5599c2c0e6c48a0c11789afc4
Author:     Andi Kleen <[email protected]>
AuthorDate: Thu, 11 Jul 2019 11:19:21 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 23 Jul 2019 08:59:37 -0300

perf script: Fix off by one in brstackinsn IPC computation

When we hit the end of a program block, need to count the last instruction too for the IPC computation. This caused large errors for small blocks.

% perf script -b ls / > /dev/null

Before:

  % perf script -F +brstackinsn --xed
  ...
        00007f94c9ac70d8                        jz 0x7f94c9ac70e3                       # PRED 3 cycles [36] 4.33 IPC
        00007f94c9ac70e3                        testb  $0x20, 0x31d(%rbx)
        00007f94c9ac70ea                        jnz 0x7f94c9ac70b0
        00007f94c9ac70ec                        testb  $0x8, 0x205ad(%rip)
        00007f94c9ac70f3                        jz 0x7f94c9ac6ff0               # PRED 1 cycles [37] 3.00 IPC

After:

  % perf script -F +brstackinsn --xed
  ...
        00007f94c9ac70d8                        jz 0x7f94c9ac70e3                       # PRED 3 cycles [15] 4.67 IPC
        00007f94c9ac70e3                        testb  $0x20, 0x31d(%rbx)
        00007f94c9ac70ea                        jnz 0x7f94c9ac70b0
        00007f94c9ac70ec                        testb  $0x8, 0x205ad(%rip)
        00007f94c9ac70f3                        jz 0x7f94c9ac6ff0               # PRED 1 cycles [16] 4.00 IPC
---
 tools/perf/builtin-script.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/builtin-script.c +1 -1
index 8f24865596af..0140ddb8dd0b 100644
@@ -1059,7 +1059,7 @@ static int perf_sample__fprintf_brstackinsn(struct perf_sample *sample,
 
 			printed += ip__fprintf_sym(ip, thread, x.cpumode, x.cpu, &lastsym, attr, fp);
 			if (ip == end) {
-				printed += ip__fprintf_jump(ip, &br->entries[i], &x, buffer + off, len - off, insn, fp,
+				printed += ip__fprintf_jump(ip, &br->entries[i], &x, buffer + off, len - off, ++insn, fp,
 							    &total_cycles);
 				if (PRINT_FIELD(SRCCODE))
 					printed += print_srccode(thread, x.cpumode, ip);
author
#4 lore raw

PATCH 3/3 perf script: Improve man page description of metrics

In reply to Andi Kleen

From: Andi Kleen <[email protected]>

Clarify that a metric is based on events, not referring to itself. Also some improvements with the sentences.

---
 tools/perf/Documentation/perf-script.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-script.txt +3 -3
index 042b9e5dcc32..caaab28f8400 100644
@@ -228,11 +228,11 @@ OPTIONS
 
 	With the metric option perf script can compute metrics for
 	sampling periods, similar to perf stat. This requires
-	specifying a group with multiple metrics with the :S option
+	specifying a group with multiple events defining metrics with the :S option
 	for perf record. perf will sample on the first event, and
-	compute metrics for all the events in the group. Please note
+	print computed metrics for all the events in the group. Please note
 	that the metric computed is averaged over the whole sampling
-	period, not just for the sample point.
+	period (since the last sample), not just for the sample point.
 
 	For sample events it's possible to display misc field with -F +misc option,
 	following letters are displayed for each bit:
Signature · 1 line
2.20.1
#5 lore raw

Re: [PATCH 3/3] perf script: Improve man page description of metrics

Em Thu, Jul 11, 2019 at 11:19:22AM -0700, Andi Kleen escreveu:

Quoted 4 lines

From: Andi Kleen <[email protected]>

Clarify that a metric is based on events, not referring to itself. Also some improvements with the sentences.

Thanks, applied.

#6 lore raw

[tip:perf/urgent] perf script: Improve man page description of metrics

In reply to Andi Kleen
perf script: Improve man page description of metrics
Commit-ID:  7db7218a7ea577f04c2df92453d47ab5ebfc8863
Gitweb:     https://git.kernel.org/tip/7db7218a7ea577f04c2df92453d47ab5ebfc8863
Author:     Andi Kleen <[email protected]>
AuthorDate: Thu, 11 Jul 2019 11:19:22 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 23 Jul 2019 08:58:11 -0300

perf script: Improve man page description of metrics

Clarify that a metric is based on events, not referring to itself. Also some improvements with the sentences.

---
 tools/perf/Documentation/perf-script.txt | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
tools/perf/Documentation/perf-script.txt +3 -3
index 042b9e5dcc32..caaab28f8400 100644
@@ -228,11 +228,11 @@ OPTIONS
 
 	With the metric option perf script can compute metrics for
 	sampling periods, similar to perf stat. This requires
-	specifying a group with multiple metrics with the :S option
+	specifying a group with multiple events defining metrics with the :S option
 	for perf record. perf will sample on the first event, and
-	compute metrics for all the events in the group. Please note
+	print computed metrics for all the events in the group. Please note
 	that the metric computed is averaged over the whole sampling
-	period, not just for the sample point.
+	period (since the last sample), not just for the sample point.
 
 	For sample events it's possible to display misc field with -F +misc option,
 	following letters are displayed for each bit:
#8 lore raw
In reply to Andi Kleen
perf script: Fix --max-blocks man page description
Commit-ID:  5f8eec3225ff7b86763b060164e9ce47b1a71406
Gitweb:     https://git.kernel.org/tip/5f8eec3225ff7b86763b060164e9ce47b1a71406
Author:     Andi Kleen <[email protected]>
AuthorDate: Thu, 11 Jul 2019 11:19:20 -0700
Committer:  Arnaldo Carvalho de Melo <[email protected]>
CommitDate: Tue, 23 Jul 2019 08:57:54 -0300

perf script: Fix --max-blocks man page description

The --max-blocks description was using the old name brstackasm. Use brstackinsn instead.

---
 tools/perf/Documentation/perf-script.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/Documentation/perf-script.txt +1 -1
index d4e2e18a5881..042b9e5dcc32 100644
@@ -384,7 +384,7 @@ include::itrace.txt[]
 	perf script --time 0%-10%,30%-40%
 
 --max-blocks::
-	Set the maximum number of program blocks to print with brstackasm for
+	Set the maximum number of program blocks to print with brstackinsn for
 	each sample.
 
 --reltime::