mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-12-05 06:22:18 +00:00
fix CPU frequency+linux memory fallback
This commit is contained in:
5 files changed
+192
-51
No files matched your search
@@ -505,7 +505,18 @@ sysinfo_backend_get_os (void)
|
||||
char *
|
||||
sysinfo_backend_get_cpu (void)
|
||||
{
|
||||
static const WCHAR cpu_key[] = L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
|
||||
DWORD mhz = 0;
|
||||
ensure_cpu_snapshot ();
|
||||
if (!snapshot.cpu)
|
||||
return NULL;
|
||||
/* The registry's reported MHz is not a guaranteed live or turbo clock. */
|
||||
if (read_registry_dword (HKEY_LOCAL_MACHINE, cpu_key, L"~MHz", &mhz) && mhz && mhz <= 100000)
|
||||
{
|
||||
if (mhz >= 1000)
|
||||
return g_strdup_printf ("%s" SYSINFO_SEP "reported %.2f GHz", snapshot.cpu, (double) mhz / 1000.0);
|
||||
return g_strdup_printf ("%s" SYSINFO_SEP "reported %lu MHz", snapshot.cpu, (unsigned long) mhz);
|
||||
}
|
||||
return g_strdup (snapshot.cpu);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user