The Gaudi Framework  v33r1 (b1225454)
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

◆ cpuid

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

Definition at line 25 of file CPUFamily.cpp.

Function Documentation

◆ BOOST_PYTHON_MODULE()

BOOST_PYTHON_MODULE ( PyCPUFamily  )

Definition at line 43 of file CPUFamily.cpp.

43  {
44  using namespace boost::python;
45  def( "CPUFamily", CPUFamily );
46 }
const char * CPUFamily()
Definition: CPUFamily.cpp:35

◆ CPUFamily()

const char* CPUFamily ( )

Definition at line 35 of file CPUFamily.cpp.

35  {
36  if ( is_nehalem() ) {
37  return "nehalem";
38  } else {
39  return "core";
40  }
41 }
bool is_nehalem()
Definition: CPUFamily.cpp:28

◆ is_nehalem()

bool is_nehalem ( )

Definition at line 28 of file CPUFamily.cpp.

28  {
29  int a, b, c, d;
30  cpuid( 1, a, b, c, d );
31  int sse4_2_mask = 1 << 20;
32  return ( c & sse4_2_mask );
33 }
#define cpuid(func, ax, bx, cx, dx)
Definition: CPUFamily.cpp:25