The Gaudi Framework  v29r0 (ff2e7097)
CPUFamily.cpp File Reference

Python module to be able to check the processor family (Core/Nehalem) More...

#include <boost/python.hpp>
Include dependency graph for CPUFamily.cpp:

Go to the source code of this file.

Macros

#define cpuid(func, ax, bx, cx, dx)    __asm__ __volatile__( "cpuid" : "=a"( ax ), "=b"( bx ), "=c"( cx ), "=d"( dx ) : "a"( func ) );
 

Functions

bool is_nehalem ()
 
const char * CPUFamily ()
 
 BOOST_PYTHON_MODULE (PyCPUFamily)
 

Detailed Description

Python module to be able to check the processor family (Core/Nehalem)

Definition in file CPUFamily.cpp.

Macro Definition Documentation

#define cpuid (   func,
  ax,
  bx,
  cx,
  dx 
)    __asm__ __volatile__( "cpuid" : "=a"( ax ), "=b"( bx ), "=c"( cx ), "=d"( dx ) : "a"( func ) );

Definition at line 15 of file CPUFamily.cpp.

Function Documentation

BOOST_PYTHON_MODULE ( PyCPUFamily  )

Definition at line 35 of file CPUFamily.cpp.

36 {
37  using namespace boost::python;
38  def( "CPUFamily", CPUFamily );
39 }
const char * CPUFamily()
Definition: CPUFamily.cpp:26
const char* CPUFamily ( )

Definition at line 26 of file CPUFamily.cpp.

27 {
28  if ( is_nehalem() ) {
29  return "nehalem";
30  } else {
31  return "core";
32  }
33 }
bool is_nehalem()
Definition: CPUFamily.cpp:18
bool is_nehalem ( )

Definition at line 18 of file CPUFamily.cpp.

19 {
20  int a, b, c, d;
21  cpuid( 1, a, b, c, d );
22  int sse4_2_mask = 1 << 20;
23  return ( c & sse4_2_mask );
24 }
#define cpuid(func, ax, bx, cx, dx)
Definition: CPUFamily.cpp:15