| Index: base/sys_info_linux.cc
|
| diff --git a/base/sys_info_linux.cc b/base/sys_info_linux.cc
|
| index 03fdac28e58c9326eec145774544d0a2bd585575..59dfee06c52ee1e6d575c058f1dea41ec465731f 100644
|
| --- a/base/sys_info_linux.cc
|
| +++ b/base/sys_info_linux.cc
|
| @@ -46,4 +46,23 @@ size_t SysInfo::MaxSharedMemorySize() {
|
| return static_cast<size_t>(limit);
|
| }
|
|
|
| +// static
|
| +std::string SysInfo::CPUModelName() {
|
| + const char kModelNamePrefix[] = "model name";
|
| + std::string contents;
|
| + file_util::ReadFileToString(FilePath("/proc/cpuinfo"), &contents);
|
| + DCHECK(!contents.empty());
|
| + if (!contents.empty()) {
|
| + std::istringstream iss(contents);
|
| + std::string line;
|
| + while (std::getline(iss, line)){
|
| + if (line.compare(0, strlen(kModelNamePrefix), kModelNamePrefix) == 0) {
|
| + size_t pos = line.find(": ");
|
| + return line.substr(pos + 2);
|
| + }
|
| + }
|
| + }
|
| + return std::string();
|
| +}
|
| +
|
| } // namespace base
|
|
|