STM32 DDR Performance Monitor (DDRPERFM) ======================================== The DDRPERFM is the DDR Performance Monitor embedded in STM32MP1 SOC. See STM32MP157 reference manual RM0436 to get a description of this peripheral. The five following counters are supported by stm32-ddr-pmu driver: cnt0: read operations counters (read_cnt) cnt1: write operations counters (write_cnt) cnt2: active state counters (activate_cnt) cnt3: idle state counters (idle_cnt) tcnt: time count, present for all sets (time_cnt) The stm32-ddr-pmu driver relies on the perf PMU framework to expose the counters via sysfs: $ ls /sys/bus/event_source/devices/ddrperfm/events activate_cnt idle_cnt read_cnt time_cnt write_cnt The perf PMU framework is usually invoked via the 'perf stat' tool. The DDRPERFM is a system monitor that cannot isolate the traffic coming from a given thread or CPU, that is why stm32-ddr-pmu driver rejects any 'perf stat' call that does not request a system-wide collection: the '-a, --all-cpus' option is mandatory! Example: $ perf stat -e ddrperfm/read_cnt/,ddrperfm/time_cnt/ -a sleep 20 Performance counter stats for 'system wide': 342541560 ddrperfm/read_cnt/ 10660011400 ddrperfm/time_cnt/ 20.021068551 seconds time elapsed The driver also exposes a 'bandwidth' attribute that can be used to display the read/write/total bandwidth achieved during the last 'perf stat' execution. $ cat /sys/bus/event_source/devices/ddrperfm/bandwidth Read = 403, Write = 239, Read & Write = 642 (MB/s)