Skip to content

Commit 18a6929

Browse files
committed
CPUUsage (Windows): disable ENABLE_CPUUSAGE_PERFLIB by default
Because Windows 7 doesn't support it
1 parent 0e61d11 commit 18a6929

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ cmake_dependent_option(ENABLE_ELF "Enable libelf" ON "LINUX OR ANDROID OR Dragon
8383
cmake_dependent_option(ENABLE_THREADS "Enable multithreading" ON "Threads_FOUND" OFF)
8484
cmake_dependent_option(ENABLE_LIBZFS "Enable libzfs" ON "LINUX OR FreeBSD OR SunOS" OFF)
8585
cmake_dependent_option(ENABLE_PCIACCESS "Enable libpciaccess" ON "NetBSD OR OpenBSD" OFF)
86-
cmake_dependent_option(ENABLE_CPUUSAGE_PERFLIB "Use perflib (Processor Information) to calculate CPU usage (used by task manager) instead of CPU times (used by all other *nix platforms)" ON "WIN32" OFF)
86+
cmake_dependent_option(ENABLE_CPUUSAGE_PERFLIB "Use perflib (Processor Information) to calculate CPU usage (used by task manager) instead of CPU times (used by all other *nix platforms)" OFF "WIN32" OFF)
8787

8888
option(ENABLE_SYSTEM_YYJSON "Use system provided (instead of fastfetch embedded) yyjson library" OFF)
8989
option(ENABLE_ASAN "Build fastfetch with ASAN (address sanitizer)" OFF)

src/common/init.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,9 @@ void ffListFeatures(void)
265265
#if FF_HAVE_EMBEDDED_PCIIDS
266266
"Embedded pciids\n"
267267
#endif
268+
#if FF_ENABLE_CPUUSAGE_PERFLIB
269+
"CPUUsage perflib\n"
270+
#endif
268271
""
269272
, stdout);
270273
}

src/detection/cpuusage/cpuusage_windows.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,11 @@ const char* ffGetCpuUsageInfo(FFlist* cpuTimes)
129129
pCounterData = (PERF_COUNTER_DATA*)((BYTE*)pCounterData + pCounterData->dwSize);
130130
}
131131

132-
if (wcschr(instanceName, L'_') == NULL /* ignore `_Total` */ && processorUtility != UINT64_MAX && utilityBase != UINT64_MAX)
132+
if (wcschr(instanceName, L'_') == NULL /* ignore `_Total` */)
133133
{
134+
if (processorUtility == UINT64_MAX)
135+
return "Counter \"% Processor Utility\" are not supported";
136+
134137
FFCpuUsageInfo* info = (FFCpuUsageInfo*) ffListAdd(cpuTimes);
135138
*info = (FFCpuUsageInfo) {
136139
.inUseAll = processorUtility,

0 commit comments

Comments
 (0)