Skip to content

Commit d536c61

Browse files
committed
allow one whitespace in thread names, and replace it with underscore
1 parent 385950d commit d536c61

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

stackcollapse-perf.pl

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,25 +170,33 @@ sub inline {
170170
}
171171

172172
# event record start
173-
if (/^((\S+\s*)+)\s+(\d+)\s/) {
173+
if (/^(\S+\s*?\S*?)\s+(\d+)\s/) {
174174
# default "perf script" output has TID but not PID
175175
# eg, "java 25607 4794564.109216: cycles:"
176+
# eg, "java 12688 [002] 6544038.708352: cpu-clock:"
177+
# eg, "V8 WorkerThread 25607 4794564.109216: cycles:"
178+
# other combinations possible
176179
if ($include_tid) {
177180
$pname = "$1-?/$2";
178181
} elsif ($include_pid) {
179182
$pname = "$1-?";
180183
} else {
181184
$pname = $1;
182185
}
183-
} elsif (/^((\S+\s*)+)\s+(\d+)\/(\d+)/) {
186+
$pname =~ tr/ /_/;
187+
} elsif (/^(\S+\s*?\S*?)\s+(\d+)\/(\d+)/) {
184188
# eg, "java 24636/25607 [000] 4794564.109216: cycles:"
189+
# eg, "java 12688/12764 6544038.708352: cpu-clock:"
190+
# eg, "V8 WorkerThread 24636/25607 [000] 94564.109216: cycles:"
191+
# other combinations possible
185192
if ($include_tid) {
186193
$pname = "$1-$2/$3";
187194
} elsif ($include_pid) {
188195
$pname = "$1-$2";
189196
} else {
190197
$pname = $1;
191198
}
199+
$pname =~ tr/ /_/;
192200

193201
# stack line
194202
} elsif (/^\s*(\w+)\s*(.+) \((\S*)\)/) {

0 commit comments

Comments
 (0)