CMS 3D CMS Logo

Functions | Variables
processor_model.cc File Reference
#include <string>
#include <boost/predef/os.h>
#include "HLTrigger/Timer/interface/processor_model.h"

Go to the source code of this file.

Functions

std::string read_processor_model ()
 

Variables

const std::string processor_model = read_processor_model()
 

Function Documentation

◆ read_processor_model()

std::string read_processor_model ( )

Definition at line 18 of file processor_model.cc.

18  {
19 #if BOOST_OS_LINUX
20  // on Linux, read the processor model from /proc/cpuinfo
21  static const std::regex pattern("^model name\\s*:\\s*(.*)", std::regex::optimize);
22  std::smatch match;
23 
24  std::ifstream cpuinfo("/proc/cpuinfo", std::ios::in);
26  while (cpuinfo.good()) {
27  std::getline(cpuinfo, line);
28  if (std::regex_match(line, match, pattern)) {
29  return match[1];
30  }
31  }
32 #endif // BOOST_OS_LINUX
33 
34 #if BOOST_OS_BSD || BOOST_OS_MACOS
35  // on BSD and OS X, read the processor model via sysctlbyname("machdep.cpu.brand_string", ...)
37  size_t len;
38  sysctlbyname("machdep.cpu.brand_string", nullptr, &len, NULL, 0);
39  result.resize(len);
40  sysctlbyname("machdep.cpu.brand_string", result.data(), &len, NULL, 0);
41  return result;
42 #endif // BOOST_OS_BSD || BOOST_OS_MACOS
43 
44  return "unknown";
45 }

References recoMuon::in, mps_splice::line, match(), NULL, topSingleLeptonDQM_PU_cfi::pattern, mps_fire::result, and AlCaHLTBitMon_QueryRunRegistry::string.

Variable Documentation

◆ processor_model

const std::string processor_model = read_processor_model()
AlCaHLTBitMon_QueryRunRegistry.string
string
Definition: AlCaHLTBitMon_QueryRunRegistry.py:256
recoMuon::in
Definition: RecoMuonEnumerators.h:6
match
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10
topSingleLeptonDQM_PU_cfi.pattern
pattern
Definition: topSingleLeptonDQM_PU_cfi.py:39
NULL
#define NULL
Definition: scimark2.h:8
mps_fire.result
result
Definition: mps_fire.py:311
mps_splice.line
line
Definition: mps_splice.py:76