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 496B

1234567891011121314151617181920212223242526272829
  1. #ifndef _BITS_PROFILE_H
  2. #define _BITS_PROFILE_H
  3. /** @file
  4. *
  5. * Profiling
  6. *
  7. */
  8. FILE_LICENCE ( GPL2_OR_LATER );
  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. uint32_t eax;
  18. uint32_t edx;
  19. /* Read timestamp counter */
  20. __asm__ __volatile__ ( "rdtsc" : "=a" ( eax ), "=d" ( edx ) );
  21. return ( ( ( ( uint64_t ) edx ) << 32 ) | eax );
  22. }
  23. #endif /* _BITS_PROFILE_H */