Collecting performance counter on AMD Zen processors

From: Varun Agrawal <varun_at_guag.net>
Date: Wed, 03 Jan 2024 01:02:26 UTC
Hello,

I run FreeBSD 14 on a machine with AMD Zen3 cores. I want to collect CPU performance metrics such as IPC, L1/L2/L3 miss rate, TLB miss rate, etc. To my surprise, I don't find any tool that supports collecting this data.

I find that FreeBSD has support for collecting this data using hwpmc, but hwpmc only supports the AMD K7 and K8 architecture. Is someone planning to add support for AMD Zen cores? If not, I can help add this support.

If there is another way to collect CPU performance counter data on FreeBSD, I would like to learn about that too.

Regards,
Varun