| The Gaudi Framework v32r1 (f65d50dc)

CPUFamily.cpp
Go to the documentation of this file.
1 /*
2 * CPUFamily.cpp
3 *
4 * Created on: Sep 23, 2010
5 */
6
13 #include <boost/python.hpp>
14
15 #define cpuid( func, ax, bx, cx, dx ) \
16 __asm__ __volatile__( "cpuid" : "=a"( ax ), "=b"( bx ), "=c"( cx ), "=d"( dx ) : "a"( func ) );
17
18 bool is_nehalem() {
19 int a, b, c, d;
20 cpuid( 1, a, b, c, d );
21 int sse4_2_mask = 1 << 20;
22 return ( c & sse4_2_mask );
23 }
24
25 const char* CPUFamily() {
26 if ( is_nehalem() ) {
27 return "nehalem";
28 } else {
29 return "core";
30 }
31 }
32
33 BOOST_PYTHON_MODULE( PyCPUFamily ) {
34 using namespace boost::python;
35 def( "CPUFamily", CPUFamily );
36 }
gaudirun.c
c
Definition: gaudirun.py:487
BOOST_PYTHON_MODULE
BOOST_PYTHON_MODULE(PyCPUFamily)
Definition: CPUFamily.cpp:33
cpuid
#define cpuid(func, ax, bx, cx, dx)
Definition: CPUFamily.cpp:15
is_nehalem
bool is_nehalem()
Definition: CPUFamily.cpp:18
CPUFamily
const char * CPUFamily()
Definition: CPUFamily.cpp:25