diff options
Diffstat (limited to 'SD-VBS/common/matlab/timingFuncs/photonStartTiming.c')
-rw-r--r-- | SD-VBS/common/matlab/timingFuncs/photonStartTiming.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/SD-VBS/common/matlab/timingFuncs/photonStartTiming.c b/SD-VBS/common/matlab/timingFuncs/photonStartTiming.c new file mode 100644 index 0000000..bbf5231 --- /dev/null +++ b/SD-VBS/common/matlab/timingFuncs/photonStartTiming.c | |||
@@ -0,0 +1,15 @@ | |||
1 | #include"mex.h" | ||
2 | #include <stdio.h> | ||
3 | #include <stdlib.h> | ||
4 | #include <stdint.h> | ||
5 | #include <math.h> | ||
6 | |||
7 | void mexFunction(int nlhs, mxArray* plhs[], int nrhs, const mxArray* prhs[]) | ||
8 | { | ||
9 | uint32_t* cycles; | ||
10 | plhs[0] = mxCreateNumericMatrix(1, 2, mxUINT32_CLASS, mxREAL); | ||
11 | cycles = (uint32_t*)mxGetPr(plhs[0]); | ||
12 | __asm__ __volatile__( "rdtsc": "=a" (cycles[0]), "=d" (cycles[1])); | ||
13 | |||
14 | return; | ||
15 | } | ||