Skip to content

Commit 0bd16a7

Browse files
f-rannerrli9
authored andcommitted
programs/perf-stat/parse: Added parsing to handle composite key
cpu_atom/cpu-cycles/ -> cpu-cycles * Explanation Hybrid Architecture Behavior: On Intel hybrid systems, if you run perf stat -e cycles without specifying the PMU (Performance Monitoring Unit), perf will automatically list cpu_core/cycles/ and cpu_atom/cycles/ separately. Explicit Targetting: Use perf stat -e cpu_atom/cpu-cycles/ to explicitly target E-cores if you are studying power efficiency or ensuring a process is running on the correct type of core. In the future, the parser may need to differentiate cpu-atom vs cpu-core values, but for now the difference is ignored. Added additional unit test under spec/fixtures/stats/perf-stat Signed-off-by: Frank Ranner <frank.ranner@intel.com> Signed-off-by: Philip Li <philip.li@intel.com>
1 parent 4db1a3a commit 0bd16a7

3 files changed

Lines changed: 127 additions & 0 deletions

File tree

programs/perf-stat/parse

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,12 @@ def parse
184184
stime, *fields = line.split
185185
end
186186

187+
if fields[2].include? "/"
188+
# 282075081,,cpu_atom/cpu-cycles/,4046709442,100.00,,
189+
# 282075081,,cpu-cycles,4046709442,100.00,,
190+
fields[2] = fields[2][/.*\/(.*)\//,1]
191+
end
192+
187193
return false if fields.none? { |field| events.include?(field) }
188194

189195
prev_time = time

spec/fixtures/stats/perf-stat/5

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
perf version 6.17.g0739473694c4
2+
/lkp/benchmarks/perf/perf stat -a --scale -I 1000 -x , -e {cpu-cycles,instructions,cache-references,cache-misses},{branch-instructions,branch-misses},cpu-clock,task-clock,page-faults,context-switches,cpu-migrations,minor-faults,major-faults --log-fd 1 -D 0 -- /lkp/lkp/src/bin/event/wait post-test
3+
1.001092774,340060066,,cpu_atom/cpu-cycles/,10031900423,100.00,,
4+
1.001092774,244499732,,cpu_atom/instructions/,10031900423,100.00,0.72,insn per cycle
5+
1.001092774,3902956,,cpu_atom/cache-references/,10031900423,100.00,,
6+
1.001092774,1592214,,cpu_atom/cache-misses/,10031900423,100.00,40.80,of all cache refs
7+
1.001092774,13478657956,,cpu_core/cpu-cycles/,12033722986,100.00,,
8+
1.001092774,21005840710,,cpu_core/instructions/,12033722986,100.00,1.56,insn per cycle
9+
1.001092774,27322569,,cpu_core/cache-references/,12033722986,100.00,,
10+
1.001092774,9569504,,cpu_core/cache-misses/,12033722986,100.00,35.02,of all cache refs
11+
1.001092774,49633333,,cpu_atom/branch-instructions/,10031902591,100.00,,
12+
1.001092774,1244692,,cpu_atom/branch-misses/,10031902591,100.00,2.51,of all branches
13+
1.001092774,4237056448,,cpu_core/branch-instructions/,12033727354,100.00,,
14+
1.001092774,220878478,,cpu_core/branch-misses/,12033727354,100.00,5.21,of all branches
15+
1.001092774,22065603430,,cpu-clock,22065611881,100.00,22.066,CPUs utilized
16+
1.001092774,22065625475,,task-clock,22065619765,100.00,22.066,CPUs utilized
17+
1.001092774,8849,,page-faults,22065634430,100.00,401.031,/sec
18+
1.001092774,24829,,context-switches,22065640244,100.00,1.125,K/sec
19+
1.001092774,108,,cpu-migrations,22065646924,100.00,4.894,/sec
20+
1.001092774,8849,,minor-faults,22065661338,100.00,401.031,/sec
21+
1.001092774,0,,major-faults,22065673597,100.00,0.000,/sec
22+
2.004750051,84063123,,cpu_atom/cpu-cycles/,10071621862,100.00,,
23+
2.004750051,65070441,,cpu_atom/instructions/,10071621862,100.00,0.77,insn per cycle
24+
2.004750051,2291391,,cpu_atom/cache-references/,10071621862,100.00,,
25+
2.004750051,1297071,,cpu_atom/cache-misses/,10071621862,100.00,56.61,of all cache refs
26+
2.004750051,12212552042,,cpu_core/cpu-cycles/,12073029171,100.00,,
27+
2.004750051,16679025052,,cpu_core/instructions/,12073029171,100.00,1.37,insn per cycle
28+
2.004750051,25096844,,cpu_core/cache-references/,12073029171,100.00,,
29+
2.004750051,8139671,,cpu_core/cache-misses/,12073029171,100.00,32.43,of all cache refs
30+
2.004750051,12731183,,cpu_atom/branch-instructions/,10071615618,100.00,,
31+
2.004750051,289273,,cpu_atom/branch-misses/,10071615618,100.00,2.27,of all branches
32+
2.004750051,3383388299,,cpu_core/branch-instructions/,12073017736,100.00,,
33+
2.004750051,213539230,,cpu_core/branch-misses/,12073017736,100.00,6.31,of all branches
34+
2.004750051,22144622593,,cpu-clock,22144626045,100.00,22.145,CPUs utilized
35+
2.004750051,22144621062,,task-clock,22144623436,100.00,22.145,CPUs utilized
36+
2.004750051,8373,,page-faults,22144618286,100.00,378.105,/sec
37+
2.004750051,24722,,context-switches,22144616132,100.00,1.116,K/sec
38+
2.004750051,90,,cpu-migrations,22144613803,100.00,4.064,/sec
39+
2.004750051,8373,,minor-faults,22144613829,100.00,378.105,/sec
40+
2.004750051,0,,major-faults,22144609354,100.00,0.000,/sec
41+
3.011943315,52517491,,cpu_atom/cpu-cycles/,10052101950,100.00,,
42+
3.011943315,17533477,,cpu_atom/instructions/,10052101950,100.00,0.33,insn per cycle
43+
3.011943315,1960639,,cpu_atom/cache-references/,10052101950,100.00,,
44+
3.011943315,163068,,cpu_atom/cache-misses/,10052101950,100.00,8.32,of all cache refs
45+
3.011943315,10926142281,,cpu_core/cpu-cycles/,12070745289,100.00,,
46+
3.011943315,13707673045,,cpu_core/instructions/,12070745289,100.00,1.25,insn per cycle
47+
3.011943315,19146228,,cpu_core/cache-references/,12070745289,100.00,,
48+
3.011943315,4933587,,cpu_core/cache-misses/,12070745289,100.00,25.77,of all cache refs
49+
3.011943315,3612078,,cpu_atom/branch-instructions/,10052103251,100.00,,
50+
3.011943315,313649,,cpu_atom/branch-misses/,10052103251,100.00,8.68,of all branches
51+
3.011943315,2711539533,,cpu_core/branch-instructions/,12070750247,100.00,,
52+
3.011943315,173867047,,cpu_core/branch-misses/,12070750247,100.00,6.41,of all branches
53+
3.011943315,22122856981,,cpu-clock,22122856980,100.00,22.123,CPUs utilized
54+
3.011943315,22122859438,,task-clock,22122857812,100.00,22.123,CPUs utilized
55+
3.011943315,162,,page-faults,22122859944,100.00,7.323,/sec
56+
3.011943315,26808,,context-switches,22122860513,100.00,1.212,K/sec
57+
3.011943315,33,,cpu-migrations,22122862539,100.00,1.492,/sec
58+
3.011943315,162,,minor-faults,22122861543,100.00,7.323,/sec
59+
3.011943315,0,,major-faults,22122864621,100.00,0.000,/sec
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
time: 1.001092774
2+
i.cpu-cycles: 13803633769.91072
3+
i.instructions: 21227143970.974262
4+
i.cache-references: 31191439.80555792
5+
i.cache-misses: 11149534.079046305
6+
i.branch-instructions: 4282010511.2455845
7+
i.branch-misses: 221880704.5349825
8+
i.cpu-clock: 22041517033.26549
9+
i.task-clock: 22041539054.201584
10+
i.page-faults: 8839.340598416906
11+
i.context-switches: 24801.897131663845
12+
i.cpu-migrations: 107.88210923596179
13+
i.minor-faults: 8839.340598416906
14+
i.major-faults: 0.0
15+
i.ipc: 1.5377939117194905
16+
i.cpi: 0.6502821947590142
17+
i.cache-miss-rate%: 35.74549347048608
18+
i.cycles-between-cache-misses: 1238.0457938464313
19+
i.MPKI: 0.5252489027394378
20+
i.branch-miss-rate%: 5.181694532329397
21+
i.metric.K/sec: 1.125
22+
time: 2.004750051
23+
i.cpu-cycles: 12251806913.367302
24+
i.instructions: 16683080845.135946
25+
i.cache-references: 27288433.63928502
26+
i.cache-misses: 9402354.983373474
27+
i.branch-instructions: 3383744192.1920133
28+
i.branch-misses: 213049322.61254358
29+
i.cpu-clock: 22063928694.057587
30+
i.task-clock: 22063927168.636475
31+
i.page-faults: 8342.48920610377
32+
i.context-switches: 24631.91426648721
33+
i.cpu-migrations: 89.67204449412866
34+
i.minor-faults: 8342.48920610377
35+
i.major-faults: 0.0
36+
i.ipc: 1.3616832980720512
37+
i.cpi: 0.7343851550620155
38+
i.cache-miss-rate%: 34.4554587033447
39+
i.cycles-between-cache-misses: 1303.0572590625027
40+
i.MPKI: 0.5635862506843146
41+
i.branch-miss-rate%: 6.296259720346317
42+
i.metric.K/sec: 1.116
43+
ps.cpu-cycles: 8670592523.08671
44+
ps.instructions: 12614591963.195696
45+
ps.cache-references: 19460445.921439927
46+
ps.cache-misses: 6838926.847466252
47+
ps.branch-instructions: 2550781492.0481
48+
ps.branch-misses: 144740995.23350427
49+
ps.cpu-clock: 14678306129.74202
50+
ps.task-clock: 14678312940.627172
51+
ps.page-faults: 5717.903094069352
52+
ps.context-switches: 16451.50483185637
53+
ps.cpu-migrations: 65.7382889690937
54+
ps.minor-faults: 5717.903094069352
55+
ps.major-faults: 0.0
56+
total.instructions: 37994435935.0
57+
overall.ipc: 1.4548708095332026
58+
overall.cpi: 0.6873462533218682
59+
overall.cache-miss-rate%: 35.142703692784764
60+
overall.cycles-between-cache-misses: 1267.8294002075884
61+
overall.MPKI: 0.5421441190820511
62+
overall.branch-miss-rate%: 5.6743784477316135

0 commit comments

Comments
 (0)