iPXE
profile.h
Go to the documentation of this file.
00001 #ifndef _BITS_PROFILE_H
00002 #define _BITS_PROFILE_H
00003 
00004 /** @file
00005  *
00006  * Profiling
00007  *
00008  */
00009 
00010 FILE_LICENCE ( GPL2_OR_LATER_OR_UBDL );
00011 
00012 #include <stdint.h>
00013 
00014 /**
00015  * Get profiling timestamp
00016  *
00017  * @ret timestamp       Timestamp
00018  */
00019 static inline __attribute__ (( always_inline )) uint64_t
00020 profile_timestamp ( void ) {
00021         uint64_t tsc;
00022 
00023         /* Read timestamp counter */
00024         __asm__ __volatile__ ( "rdtsc" : "=A" ( tsc ) );
00025         return tsc;
00026 }
00027 
00028 #endif /* _BITS_PROFILE_H */