CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PentiumTimer.cc
Go to the documentation of this file.
2 #include <iostream>
3 #include <fstream>
4 #include <string>
5 #include <algorithm>
6 #include <iterator>
7 
8 
10 
12 #ifdef __APPLE__
13  // FIXME: PentiumTime not supported on mac.
14  abort();
15 #else
16  std::string input;
17  {
18  std::ifstream cpuinfo("/proc/cpuinfo");
19  cpuinfo.unsetf( std::ios::skipws );
20  std::istream_iterator<char> sbegin(cpuinfo),send;
21  copy(sbegin,send,inserter(input,input.end()));
22  cpuinfo.close();
23  }
24  size_t i = input.find("cpu MHz");
25  if (i==std::string::npos) {
26  std::cout << "/proc/cpuinfo does not contain cpu speed..." << std::endl;
27  one = 1.;
28  return;
29  }
30  i = input.find(":",i);
31  one = 1.e-6/atof(input.substr(i+1,input.find("/n",i)-i).c_str());
32 #endif
33 }
int i
Definition: DBlmapReader.cc:9
tuple cout
Definition: gather_cfg.py:121