For my project I must use inline assembly instructions such as rdtsc to calculate the execution time of some C/C++ instructions.
Th
You should read the PMCCNTR
register of a co-processor p15
(not an actual co-processor, just an entry point for CPU functions) to obtain a cycle count. Note that it is available to an unprivileged app only if:
Unprivileged PMCCNTR
reads are alowed:
Bit 0 of PMUSERENR
register must be set to 1 (official docs)
PMCCNTR
is actually counting cycles:
Bit 31 of PMCNTENSET
register must be set to 1 (official docs)
This is a real-world example of how it`s done.