uint Count() { // It seems there's no better way to get this info on Linux systems. // If somebody can find it without depending on the location of /proc, // please patch this function. uint count = 0; std::ifstream cpuInfo("/proc/cpuinfo", std::ifstream::in); std::string lineBuffer; std::getline(cpuInfo, lineBuffer); while (cpuInfo.good()) { if (std::string::npos != lineBuffer.find("processor")) ++count; std::getline(cpuInfo, lineBuffer); } cpuInfo.close(); return static_cast<unsigned int>(0 == count ? 1 : count); }
static void notImplemented(Cpu* cpu, OPCODE op) { cpuInfo(cpu); ERROR("Opcode %s has not been implemented jet.", OpcodeName(op)); \ }