1 #ifndef _BITS_PROFILE_H
2 #define _BITS_PROFILE_H
3
4 /** @file
5 *
6 * Profiling
7 *
8 */
9
10 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
11
12 #include <stdint.h>
13
14 /**
15 * Get profiling timestamp
16 *
17 * @ret timestamp Timestamp
18 */
19 static inline __attribute__ (( always_inline )) uint64_t
profile_timestamp(void)20 profile_timestamp ( void ) {
21 uint32_t cycles;
22
23 /* Read cycle counter */
24 __asm__ __volatile__ ( "mcr p15, 0, %1, c9, c12, 0\n\t"
25 "mrc p15, 0, %0, c9, c13, 0\n\t"
26 : "=r" ( cycles ) : "r" ( 1 ) );
27 return cycles;
28 }
29
30 #endif /* _BITS_PROFILE_H */
31