When Barman is linked into your executable code, the code must call the following functions:
barman_initialize to initialize Barman.
barman_enable_sampling to enable sampling.
The appropriate sample function, barman_sample_counters or barman_sample_counters_with_program_counter, to periodically collect data.
In a multiprocessor system, a call to one of the sampling functions only reads the counters for the processor element the code is executing on.
If you are running a preemptive kernel, RTOS, or similar, you must ensure that the thread running a call to a sampling function is not migrated from one processor element to another during the execution of the call.
In a multiprocessor system, if you are using periodic sampling (for example with a timer interrupt), you must provide a mechanism to call the sampling function for each processor element. In other words, to capture the counters of each processor element, there must be a timer interrupt or thread that is run separately on each processor element.
Note
To sample code running at EL3 using Barman, some additional configuration may be required. By default, counting of events is prohibited when the processor is executing at EL3. To change this behavior:
When EL3 is using Aarch64, the register field MDCR_EL3.SPME must be 1
When EL3 is using Aarch32, the register field SDCR.SPME must be 1
See the Arm Architecture Reference Manual Prohibiting event and cycle counting section for more information.