Skip to content

Commit dfffdec

Browse files
committed
docs/misc-tsc-amperf.md: Improve perf example
It is smarter to do events grouping. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
1 parent 2ac2388 commit dfffdec

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

docs/misc-tsc-amperf.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,9 @@ TSC and MPERF frequencies can be easily measured in Linux by sampling counters o
209209
interval. For example, this `perf` command takes samples every second on CPU 0:
210210

211211
```bash
212-
# Sample every second while running a busy loop on CPU 0 to prevent idle states
213-
perf stat -I 1000 -C 0 -A -e 'msr/tsc/,msr/mperf/' -- taskset -c 0 sh -c 'while true; do :; done'
212+
# Sample every second while running a busy loop on CPU 0 to prevent idle states. Use counters
213+
# grouping ("{}") to ensure that TSC and MPERF are sampled in a single system call.
214+
perf stat -I 1000 -C 0 -A -e '{msr/tsc/,msr/mperf/}' -- taskset -c 0 sh -c 'while true; do :; done'
214215
```
215216

216217
In practice, the measured MPERF frequency is very close to TSC frequency on all platforms I have

0 commit comments

Comments
 (0)