The Gaudi Framework  v32r2 (46d42edc)
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 15 of file CPUFamily.cpp.

Function Documentation

◆ BOOST_PYTHON_MODULE()

BOOST_PYTHON_MODULE ( PyCPUFamily  )

Definition at line 33 of file CPUFamily.cpp.

33  {
34  using namespace boost::python;
35  def( "CPUFamily", CPUFamily );
36 }
const char * CPUFamily()
Definition: CPUFamily.cpp:25

◆ CPUFamily()

const char* CPUFamily ( )

Definition at line 25 of file CPUFamily.cpp.

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

◆ is_nehalem()

bool is_nehalem ( )

Definition at line 18 of file CPUFamily.cpp.

18  {
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 }
#define cpuid(func, ax, bx, cx, dx)
Definition: CPUFamily.cpp:15