Mercurial > hg > audiostuff
comparison spandsp-0.0.3/spandsp-0.0.3/src/spandsp/timing.h @ 5:f762bf195c4b
import spandsp-0.0.3
author | Peter Meerwald <pmeerw@cosy.sbg.ac.at> |
---|---|
date | Fri, 25 Jun 2010 16:00:21 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
4:26cd8f1ef0b1 | 5:f762bf195c4b |
---|---|
1 /* | |
2 * SpanDSP - a series of DSP components for telephony | |
3 * | |
4 * timing.h - Provide access to the Pentium/Athlon TSC timer register | |
5 * | |
6 * Written by Steve Underwood <steveu@coppice.org> | |
7 * | |
8 * Copyright (C) 2001 Steve Underwood | |
9 * | |
10 * All rights reserved. | |
11 * | |
12 * This program is free software; you can redistribute it and/or modify | |
13 * it under the terms of the GNU General Public License version 2, as | |
14 * published by the Free Software Foundation. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
24 * | |
25 * $Id: timing.h,v 1.6 2006/10/24 13:45:28 steveu Exp $ | |
26 */ | |
27 | |
28 #if !defined(_TIMING_H_) | |
29 #define _TIMING_H_ | |
30 | |
31 #ifdef __cplusplus | |
32 extern "C" { | |
33 #endif | |
34 | |
35 #if defined(__i386__) | |
36 static __inline__ uint64_t rdtscll(void) | |
37 { | |
38 uint64_t now; | |
39 | |
40 __asm__ __volatile__(" rdtsc\n" : "=A" (now)); | |
41 return now; | |
42 } | |
43 /*- End of function --------------------------------------------------------*/ | |
44 #elif defined(__x86_64__) | |
45 static __inline__ uint64_t rdtscll(void) | |
46 { | |
47 unsigned int __a; | |
48 unsigned int __d; | |
49 | |
50 __asm__ __volatile__(" rdtsc\n" : "=a" (__a), "=d" (__d)); | |
51 return ((unsigned long) __a) | (((unsigned long) __d) << 32); | |
52 } | |
53 /*- End of function --------------------------------------------------------*/ | |
54 #endif | |
55 | |
56 #ifdef __cplusplus | |
57 } | |
58 #endif | |
59 | |
60 #endif | |
61 /*- End of file ------------------------------------------------------------*/ |