You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

profile.h 516B

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