132 std::map<std::string, std::string> reportCPUProperties;
133 std::map<std::string, std::string> currentCoreProperties;
135 std::ifstream fcpuinfo (
"/proc/cpuinfo");
137 if(fcpuinfo.is_open()){
143 std::set<std::string> models;
145 while(!fcpuinfo.eof()){
147 std::getline(fcpuinfo, buf);
149 std::istringstream iss(buf);
156 while(std::getline(iss, token,
':')) {
173 if(!property.empty()){
174 if(property ==
"processor") {
176 if(currentCore.empty()) {
180 reportSvc->reportPerformanceForModule(
"SystemCPU",
"CPU-"+currentCore, currentCoreProperties);
181 currentCoreProperties.clear();
189 currentCoreProperties.insert(std::make_pair(property, value));
191 if(property ==
"cpu MHz"){
194 if(property ==
"model name"){
195 models.insert(eraseExtraSpaces(value));
204 reportSvc->reportPerformanceForModule(
"SystemCPU",
"CPU-"+currentCore, currentCoreProperties);
219 for(std::set<std::string>::const_iterator iter = models.begin(); iter != models.end(); iter++){
223 CPUModels +=
", " + *iter;
226 reportCPUProperties.insert(std::make_pair(
"CPUModels", CPUModels));
229 reportSvc->reportPerformanceSummary(
"SystemCPU", reportCPUProperties);
static std::string i2str(int i)
bool reportCPUProperties_
static std::string d2str(double d)