view HW_Dependent_Primitives/VMS__HW_measurement.h @ 256:2bcf37fd50c6

Prev msg should have been: isolated valgrind with a new compiler switch use SERVICES__TURN_ON_VALGRIND in order to compile valgrind support into vmalloc
author Sean Halle <seanhalle@yahoo.com>
date Mon, 10 Sep 2012 01:26:51 -0700
parents
children f5b110414453
line source
1 /*
2 * Copyright 2009 OpenSourceStewardshipFoundation.org
3 * Licensed under GNU General Public License version 2
4 *
5 * Author: seanhalle@yahoo.com
6 *
7 */
9 #ifndef _VMS__HW_MEASUREMENT_H
10 #define _VMS__HW_MEASUREMENT_H
11 #define _GNU_SOURCE
14 //=================== Macros to Capture Measurements ======================
16 typedef union
17 { uint32 lowHigh[2];
18 uint64 longVal;
19 }
20 TSCountLowHigh;
23 //=================== Macros to Capture Measurements ======================
24 //
25 //===== RDTSC wrapper =====
26 //Also runs with x86_64 code
27 #define saveTSCLowHigh(lowHighIn) \
28 asm volatile("RDTSC; \
29 movl %%eax, %0; \
30 movl %%edx, %1;" \
31 /* outputs */ : "=m" (lowHighIn.lowHigh[0]), "=m" (lowHighIn.lowHigh[1])\
32 /* inputs */ : \
33 /* clobber */ : "%eax", "%edx" \
34 );
36 #define saveTimeStampCountInto(low, high) \
37 asm volatile("RDTSC; \
38 movl %%eax, %0; \
39 movl %%edx, %1;" \
40 /* outputs */ : "=m" (low), "=m" (high)\
41 /* inputs */ : \
42 /* clobber */ : "%eax", "%edx" \
43 );
45 #define saveLowTimeStampCountInto(low) \
46 asm volatile("RDTSC; \
47 movl %%eax, %0;" \
48 /* outputs */ : "=m" (low) \
49 /* inputs */ : \
50 /* clobber */ : "%eax", "%edx" \
51 );
53 inline TSCount getTSCount();
56 //For code that calculates normalization-offset between TSC counts of
57 // different cores.
58 //#define NUM_TSC_ROUND_TRIPS 10
60 void setup_perf_counters();
61 uint64_t rdtsc(void);
62 #endif /* */