Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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 }
#define cpuid(func, ax, bx, cx, dx)
Definition: CPUFamily.cpp:15
BOOST_PYTHON_MODULE(PyCPUFamily)
Definition: CPUFamily.cpp:33
bool is_nehalem()
Definition: CPUFamily.cpp:18
const char * CPUFamily()
Definition: CPUFamily.cpp:25