I want to get the number of architectural and microarchitectural events in our program.
Is there a good way to get these values?
You can refer to the TRM of the processor of interest to retrieve the event reference value.developer.arm.com/.../Performance-Monitor-Unitdeveloper.arm.com/.../Events-and-Performance-Monitor
If you're running Linux, perf framework could be used: perf.wiki.kernel.org/.../Main_Page
If you're in baremetal: ARM Development Studio at developer.arm.com/.../arm-development-studio (free trial for 30 days), contains code example to setup environment that let you monitor the PMCs.