Hardware counter profiling has several limitations:
You can only collect hardware counter data on processors that have hardware counters and that support hardware counter profiling. On other systems, hardware counter profiling is disabled. Oracle Solaris and Oracle Linux with Unbreakable Enterprise Kernel or Red Hat-compatible kernel 6.0 and newer do support hardware counters.
You cannot collect hardware counter data on a system running Oracle Solaris while the cpustat(1) command is running because cpustat takes control of the counters and does not let a user process use the counters. If cpustat is started during data collection, the hardware counter profiling is terminated and an error is recorded in the experiment. The same is true if root starts an er_kernel experiment using hardware counters.
You cannot use the hardware counters in your own code if you are doing hardware counter profiling. The Collector interposes on the libcpc library functions and returns with a return value of -1 if the call did not come from the Collector. Your program should be coded so as to work correctly if it fails to get access to the hardware counters. If not coded to handle this, the program will fail under hardware counter profiling, or if the superuser invokes system-wide tools that also use the counters, or if the counters are not supported on that system.
If you try to collect hardware counter data on a running program that is using the hardware counter library by attaching dbx to the process, the experiment may be corrupted.