CMS 3D CMS Logo

Functions | Variables
processor_model.cc File Reference
#include <fstream>
#include <regex>
#include <string>
#include "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

std::string read_processor_model ( )

Definition at line 7 of file processor_model.cc.

References recoMuon::in, geometryCSVtoXML::line, match(), listBenchmarks::pattern, and AlCaHLTBitMon_QueryRunRegistry::string.

8 {
9 #ifdef __linux__
10  static const std::regex pattern("^model name\\s*:\\s*(.*)", std::regex::optimize);
11  std::smatch match;
12 
13  std::ifstream cpuinfo("/proc/cpuinfo", std::ios::in);
15  while (cpuinfo.good()) {
16  std::getline(cpuinfo, line);
17  if (std::regex_match(line, match, pattern)) {
18  return match[1];
19  }
20  }
21 #endif // __linux__
22 
23  return "unknown";
24 }
std::pair< typename Association::data_type::first_type, double > match(Reference key, Association association, bool bestMatchByMaxValue)
Generic matching function.
Definition: Utils.h:10

Variable Documentation

const std::string processor_model = read_processor_model()

Definition at line 26 of file processor_model.cc.

Referenced by FastTimerService::preallocate().