diff options
| author | Michael Brown | 2016-05-08 01:18:35 +0200 |
|---|---|---|
| committer | Michael Brown | 2016-05-08 01:18:35 +0200 |
| commit | edea3a434ccae8dc980c715949287c9ba63babf5 (patch) | |
| tree | d821d987dcf1ac0bc4f22e1363fa32c95f6bd0b2 /src/arch/arm32/include/bits/profile.h | |
| parent | [arm] Avoid instruction references to symbols defined via ".equ" (diff) | |
| download | ipxe-edea3a434ccae8dc980c715949287c9ba63babf5.tar.gz ipxe-edea3a434ccae8dc980c715949287c9ba63babf5.tar.xz ipxe-edea3a434ccae8dc980c715949287c9ba63babf5.zip | |
[arm] Split out 32-bit-specific code to arch/arm32
Signed-off-by: Michael Brown <mcb30@ipxe.org>
Diffstat (limited to 'src/arch/arm32/include/bits/profile.h')
| -rw-r--r-- | src/arch/arm32/include/bits/profile.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/src/arch/arm32/include/bits/profile.h b/src/arch/arm32/include/bits/profile.h new file mode 100644 index 000000000..2b15d1604 --- /dev/null +++ b/src/arch/arm32/include/bits/profile.h @@ -0,0 +1,30 @@ +#ifndef _BITS_PROFILE_H +#define _BITS_PROFILE_H + +/** @file + * + * Profiling + * + */ + +FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL ); + +#include <stdint.h> + +/** + * Get profiling timestamp + * + * @ret timestamp Timestamp + */ +static inline __attribute__ (( always_inline )) uint64_t +profile_timestamp ( void ) { + uint32_t cycles; + + /* Read cycle counter */ + __asm__ __volatile__ ( "mcr p15, 0, %1, c9, c12, 0\n\t" + "mrc p15, 0, %0, c9, c13, 0\n\t" + : "=r" ( cycles ) : "r" ( 1 ) ); + return cycles; +} + +#endif /* _BITS_PROFILE_H */ |
