feat: add opengl version cpu gpu info show

This commit is contained in:
2026-04-17 10:44:06 +08:00
parent b07adea771
commit 2f1edc4723
3 changed files with 48 additions and 1 deletions

View File

@@ -87,4 +87,34 @@ inline size_t get_current_rss() {
#endif
}
inline std::string get_cpu_info() {
#ifdef _WIN32
#elif defined (__linux__)
std::ifstream file("/proc/cpuinfo");
if (!file.is_open()) {
return std::string{"Unkown"};
}
std::string line;
while (std::getline(file, line)) {
size_t pos = line.find(":");
if (pos == std::string::npos) {
continue;
}
std::string key = line.substr(0, pos - 1);
key = key.erase(key.find_last_not_of(" \t\n") + 1);
if (key != "model name") {
continue;
}
return line.substr(pos + 2);
}
return std::string{"Unkown"};
#else
return std::string{"Unkown"};
#endif
}
}