albgarse
albgarse

Reputation: 43

Can hardware performance counters decrease when using perf stat?

I'm taking time-based measures with perf stat using the command:

$ perf stat -x, -I 100  -oout.txt -e cache-misses:u find / -name file

The samples taken are not always increasing. Some measures are lower than the previous one. Here is an example:

0.100225621,1103127,cache-misses:u
0.200583165,1098697,cache-misses:u
0.300825858,1093229,cache-misses:u
0.401061818,1307353,cache-misses:u
0.501293039,1271823,cache-misses:u
0.601531048,968170,cache-misses:u
0.701913069,986001,cache-misses:u
0.802181430,1080398,cache-misses:u
0.902453753,1312237,cache-misses:u
1.002721050,1276197,cache-misses:u
1.102988175,1263220,cache-misses:u
1.203292647,1201003,cache-misses:u
1.228879941,275942,cache-misses:u

The first measure is 1103127 while the second is 1098697 which is lower than the previous one.

Is it a perf bug or does it have any explanation?

Upvotes: 4

Views: 97

Answers (1)

kaylum
kaylum

Reputation: 14044

Can't really see from your post whether that's a -l100 (l for Love) or -I100 (I for Interval). I assume it's the latter. If that is the case then from the man page it says that it prints count deltas.

 
-I msecs, --interval-print msecs
           Print count deltas every N milliseconds (minimum: 100ms) example:
           perf stat -I 1000 -e cycles -a sleep 5

Upvotes: 5

Related Questions