Skip to content

Commit

Permalink
Merge pull request xbmc#16884 from lrusak/cpuinfo-proc
Browse files Browse the repository at this point in the history
CPUInfoLinux: add /proc/cpuinfo parsing for arm/aarch64
  • Loading branch information
lrusak authored and Maven85 committed Jan 21, 2020
1 parent 1ab631c commit 600b759
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions xbmc/platform/linux/CPUInfoLinux.cpp
Expand Up @@ -13,6 +13,7 @@
#include "utils/Temperature.h"

#include <fstream>
#include <regex>
#include <sstream>
#include <vector>

Expand Down Expand Up @@ -182,6 +183,37 @@ CCPUInfoLinux::CCPUInfoLinux()
m_cpuFeatures |= CPU_FEATURE_3DNOWEXT;
}
}
#else
std::ifstream cpuinfo("/proc/cpuinfo");
std::regex re(".*: (.*)$");

for (std::string line; std::getline(cpuinfo, line);)
{
std::smatch match;

if (std::regex_match(line, match, re))
{
if (match.size() == 2)
{
std::ssub_match value = match[1];

if (line.find("model name") != std::string::npos)
m_cpuModel = value.str();

if (line.find("BogoMIPS") != std::string::npos)
m_cpuBogoMips = value.str();

if (line.find("Hardware") != std::string::npos)
m_cpuHardware = value.str();

if (line.find("Serial") != std::string::npos)
m_cpuSerial = value.str();

if (line.find("Revision") != std::string::npos)
m_cpuRevision = value.str();
}
}
}
#endif

#if defined(HAS_NEON) && defined(__arm__)
Expand Down

0 comments on commit 600b759

Please sign in to comment.