106 std::map<std::string, std::string> reportCPUProperties;
107 std::map<std::string, std::string> currentCoreProperties;
109 std::ifstream fcpuinfo (
"/proc/cpuinfo");
111 if(fcpuinfo.is_open()){
117 std::set<std::string> models;
119 while(!fcpuinfo.eof()){
121 std::getline(fcpuinfo, buf);
123 std::istringstream iss(buf);
130 while(std::getline(iss, token,
':')) {
147 if(!property.empty()){
148 if(property ==
"processor") {
150 if(currentCore.empty()) {
154 reportSvc->reportPerformanceForModule(
"SystemCPU",
"CPU-"+currentCore, currentCoreProperties);
155 currentCoreProperties.clear();
163 currentCoreProperties.insert(std::make_pair(property, value));
165 if(property ==
"cpu MHz"){
168 if(property ==
"model name"){
169 models.insert(eraseExtraSpaces(value));
178 reportSvc->reportPerformanceForModule(
"SystemCPU",
"CPU-"+currentCore, currentCoreProperties);
193 for(std::set<std::string>::const_iterator iter = models.begin(); iter != models.end(); iter++){
197 CPUModels +=
", " + *iter;
200 reportCPUProperties.insert(std::make_pair(
"CPUModels", CPUModels));
203 reportSvc->reportPerformanceSummary(
"SystemCPU", reportCPUProperties);
static std::string i2str(int i)
bool reportCPUProperties_
static std::string d2str(double d)