~pmdj/ubuntu/trusty/qemu/2.9+applesmc+fadtv3

« back to all changes in this revision

Viewing changes to roms/ipxe/src/arch/x86_64/include/bits/profile.h

  • Committer: Phil Dennis-Jordan
  • Date: 2017-07-21 08:03:43 UTC
  • mfrom: (1.1.1)
  • Revision ID: phil@philjordan.eu-20170721080343-2yr2vdj7713czahv
New upstream release 2.9.0.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
20
profile_timestamp ( void ) {
 
21
        uint32_t eax;
 
22
        uint32_t edx;
 
23
 
 
24
        /* Read timestamp counter */
 
25
        __asm__ __volatile__ ( "rdtsc" : "=a" ( eax ), "=d" ( edx ) );
 
26
        return ( ( ( ( uint64_t ) edx ) << 32 ) | eax );
 
27
}
 
28
 
 
29
#endif /* _BITS_PROFILE_H */