mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-09-12 10:22:12 +02:00
@@ -1,3 +1,13 @@
|
||||
# 2.13.1
|
||||
|
||||
Fix a regression introduced in v2.13.0
|
||||
|
||||
Bugfixes:
|
||||
* Fix CPU frequency not displayed if `bios_limit` is not available (CPU, Linux)
|
||||
|
||||
Features:
|
||||
* Add `--cpu-show-pe-core-count` to detect and display core count for performance / efficiency cores (CPU, FreeBSD)
|
||||
|
||||
# 2.13.0
|
||||
|
||||
Changes:
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.12.0) # target_link_libraries with OBJECT libs & project homepage url
|
||||
|
||||
project(fastfetch
|
||||
VERSION 2.13.0
|
||||
VERSION 2.13.1
|
||||
LANGUAGES C
|
||||
DESCRIPTION "Fast neofetch-like system information tool"
|
||||
HOMEPAGE_URL "https://github.com/fastfetch-cli/fastfetch"
|
||||
|
||||
@@ -1074,6 +1074,11 @@
|
||||
"maximum": 9,
|
||||
"default": 2
|
||||
},
|
||||
"showPeCoreCount": {
|
||||
"description": "Detect and display CPU frequency of different core types (eg. Pcore and Ecore) if supported",
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"key": {
|
||||
"$ref": "#/$defs/key"
|
||||
},
|
||||
|
||||
@@ -1152,6 +1152,15 @@
|
||||
"default": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "cpu-show-pe-core-count",
|
||||
"desc": "Detect and display CPU frequency of different core types (eg. Pcore and Ecore) if supported",
|
||||
"arg": {
|
||||
"type": "bool",
|
||||
"optional": true,
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
{
|
||||
"long": "cpuusage-separate",
|
||||
"desc": "Display CPU usage per CPU logical core, instead of an average result",
|
||||
|
||||
@@ -121,7 +121,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
cpu->coresOnline = (uint16_t) ffSysctlGetInt("hw.activecpu", 1);
|
||||
|
||||
detectFrequency(cpu);
|
||||
detectCoreCount(cpu);
|
||||
if (options->showPeCoreCount) detectCoreCount(cpu);
|
||||
|
||||
cpu->temperature = options->temp ? detectCpuTemp(&cpu->name) : FF_CPU_TEMP_UNSET;
|
||||
|
||||
|
||||
@@ -39,7 +39,6 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t ifreq = (uint32_t) -1;
|
||||
for (uint16_t i = 0; i < cpu->coresLogical; ++i)
|
||||
{
|
||||
ffStrbufClear(&buffer);
|
||||
@@ -56,12 +55,15 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
if (!(cpu->frequencyMin <= fmin)) cpu->frequencyMin = fmin; // Counting for NaN
|
||||
if (!(cpu->frequencyMax >= fmax)) cpu->frequencyMax = fmax;
|
||||
|
||||
uint32_t ifreq = 0;
|
||||
while (cpu->coreTypes[ifreq].freq != fmax && cpu->coreTypes[ifreq].freq > 0)
|
||||
++ifreq;
|
||||
if (cpu->coreTypes[ifreq].freq == 0)
|
||||
cpu->coreTypes[ifreq].freq = fmax;
|
||||
cpu->coreTypes[ifreq].count++;
|
||||
if (options->showPeCoreCount)
|
||||
{
|
||||
uint32_t ifreq = 0;
|
||||
while (cpu->coreTypes[ifreq].freq != fmax && cpu->coreTypes[ifreq].freq > 0)
|
||||
++ifreq;
|
||||
if (cpu->coreTypes[ifreq].freq == 0)
|
||||
cpu->coreTypes[ifreq].freq = fmax;
|
||||
cpu->coreTypes[ifreq].count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
cpu->frequencyMin /= 1000;
|
||||
|
||||
@@ -127,7 +127,7 @@ static uint8_t getNumCores(FFstrbuf* basePath, FFstrbuf* buffer)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static bool detectFrequency(FFCPUResult* cpu)
|
||||
static bool detectFrequency(FFCPUResult* cpu, const FFCPUOptions* options)
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY path = ffStrbufCreateS("/sys/devices/system/cpu/cpufreq/");
|
||||
FF_AUTO_CLOSE_DIR DIR* dir = opendir(path.chars);
|
||||
@@ -175,13 +175,16 @@ static bool detectFrequency(FFCPUResult* cpu)
|
||||
cpu->frequencyMin = fmin;
|
||||
}
|
||||
|
||||
uint32_t freq = fbase == 0 ? fmax : fbase; // seems base frequencies are more stable
|
||||
uint32_t ifreq = 0;
|
||||
while (cpu->coreTypes[ifreq].freq != freq && cpu->coreTypes[ifreq].freq > 0)
|
||||
++ifreq;
|
||||
if (cpu->coreTypes[ifreq].freq == 0)
|
||||
cpu->coreTypes[ifreq].freq = freq;
|
||||
cpu->coreTypes[ifreq].count += getNumCores(&path, &buffer);
|
||||
if (options->showPeCoreCount)
|
||||
{
|
||||
uint32_t freq = fbase == 0 ? fmax : fbase; // seems base frequencies are more stable
|
||||
uint32_t ifreq = 0;
|
||||
while (cpu->coreTypes[ifreq].freq != freq && cpu->coreTypes[ifreq].freq > 0)
|
||||
++ifreq;
|
||||
if (cpu->coreTypes[ifreq].freq == 0)
|
||||
cpu->coreTypes[ifreq].freq = freq;
|
||||
cpu->coreTypes[ifreq].count += getNumCores(&path, &buffer);
|
||||
}
|
||||
ffStrbufSubstrBefore(&path, baseLen);
|
||||
}
|
||||
}
|
||||
@@ -270,7 +273,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
cpu->coresOnline = (uint16_t) get_nprocs();
|
||||
cpu->coresPhysical = (uint16_t) ffStrbufToUInt(&physicalCoresBuffer, cpu->coresLogical);
|
||||
|
||||
if (!detectFrequency(cpu) || cpu->frequencyBase != cpu->frequencyBase)
|
||||
if (!detectFrequency(cpu, options) || cpu->frequencyBase != cpu->frequencyBase)
|
||||
cpu->frequencyBase = ffStrbufToDouble(&cpuMHz) / 1000;
|
||||
|
||||
if(cpuUarch.length > 0)
|
||||
|
||||
@@ -157,6 +157,10 @@ static const char* detectByRegistry(FFCPUResult* cpu)
|
||||
cpu->coresOnline = cpu->coresPhysical = cpu->coresLogical = (uint16_t) cores;
|
||||
}
|
||||
|
||||
uint32_t mhz;
|
||||
if(ffRegReadUint(hKey, L"~MHz", &mhz, NULL))
|
||||
cpu->frequencyBase = mhz / 1000.0;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -190,7 +194,7 @@ const char* ffDetectCPUImpl(const FFCPUOptions* options, FFCPUResult* cpu)
|
||||
return error;
|
||||
|
||||
detectSpeedByCpuid(cpu);
|
||||
detectCoreTypes(cpu);
|
||||
if (options->showPeCoreCount) detectCoreTypes(cpu);
|
||||
|
||||
if (cpu->frequencyMax != cpu->frequencyMax)
|
||||
detectMaxSpeedBySmbios(cpu);
|
||||
|
||||
+37
-18
@@ -37,6 +37,20 @@ void ffPrintCPU(FFCPUOptions* options)
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY coreTypes = ffStrbufCreate();
|
||||
if (options->showPeCoreCount)
|
||||
{
|
||||
uint32_t typeCount = 0;
|
||||
while (cpu.coreTypes[typeCount].count != 0 && typeCount < sizeof(cpu.coreTypes) / sizeof(cpu.coreTypes[0])) typeCount++;
|
||||
if (typeCount > 0)
|
||||
{
|
||||
qsort(cpu.coreTypes, typeCount, sizeof(cpu.coreTypes[0]), (void*) sortCores);
|
||||
|
||||
for (uint32_t i = 0; i < typeCount; i++)
|
||||
ffStrbufAppendF(&coreTypes, "%s%u", i == 0 ? "" : "+", cpu.coreTypes[i].count);
|
||||
}
|
||||
}
|
||||
|
||||
if(options->moduleArgs.outputFormat.length == 0)
|
||||
{
|
||||
ffPrintLogoAndKey(FF_CPU_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT);
|
||||
@@ -53,13 +67,15 @@ void ffPrintCPU(FFCPUOptions* options)
|
||||
else
|
||||
ffStrbufAppendS(&str, "Unknown");
|
||||
|
||||
if(cpu.coresOnline > 1)
|
||||
if(coreTypes.length > 0)
|
||||
ffStrbufAppendF(&str, " (%s)", coreTypes.chars);
|
||||
else if(cpu.coresOnline > 1)
|
||||
ffStrbufAppendF(&str, " (%u)", cpu.coresOnline);
|
||||
|
||||
double freq = cpu.frequencyBiosLimit;
|
||||
if(freq <= 0.0000001)
|
||||
if(!(freq > 0.0000001))
|
||||
freq = cpu.frequencyMax;
|
||||
if(freq <= 0.0000001)
|
||||
if(!(freq > 0.0000001))
|
||||
freq = cpu.frequencyBase;
|
||||
if(freq > 0.0000001)
|
||||
ffStrbufAppendF(&str, " @ %.*f GHz", options->freqNdigits, freq);
|
||||
@@ -74,19 +90,6 @@ void ffPrintCPU(FFCPUOptions* options)
|
||||
}
|
||||
else
|
||||
{
|
||||
FF_STRBUF_AUTO_DESTROY coreTypes = ffStrbufCreate();
|
||||
uint32_t typeCount = 0;
|
||||
while (cpu.coreTypes[typeCount].count != 0 && typeCount < sizeof(cpu.coreTypes) / sizeof(cpu.coreTypes[0])) typeCount++;
|
||||
if (typeCount > 0)
|
||||
{
|
||||
qsort(cpu.coreTypes, typeCount, sizeof(cpu.coreTypes[0]), (void*) sortCores);
|
||||
|
||||
for (uint32_t i = 0; i < typeCount; i++)
|
||||
ffStrbufAppendF(&coreTypes, "%s%u", i == 0 ? "" : "+", cpu.coreTypes[i].count);
|
||||
}
|
||||
else
|
||||
ffStrbufAppendF(&coreTypes, "%u", cpu.coresOnline);
|
||||
|
||||
char freqBase[32], freqMax[32], freqBioslimit[32];
|
||||
if (cpu.frequencyBase > 0)
|
||||
snprintf(freqBase, sizeof(freqBase), "%.*f", options->freqNdigits, cpu.frequencyBase);
|
||||
@@ -122,7 +125,7 @@ void ffPrintCPU(FFCPUOptions* options)
|
||||
ffStrbufDestroy(&cpu.vendor);
|
||||
}
|
||||
|
||||
bool ffParseCPUCPUOptions(FFCPUOptions* options, const char* key, const char* value)
|
||||
bool ffParseCPUCommandOptions(FFCPUOptions* options, const char* key, const char* value)
|
||||
{
|
||||
const char* subKey = ffOptionTestPrefix(key, FF_CPU_MODULE_NAME);
|
||||
if (!subKey) return false;
|
||||
@@ -138,6 +141,12 @@ bool ffParseCPUCPUOptions(FFCPUOptions* options, const char* key, const char* va
|
||||
return true;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(subKey, "show-pe-core-count"))
|
||||
{
|
||||
options->showPeCoreCount = ffOptionParseBoolean(value);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -163,6 +172,12 @@ void ffParseCPUJsonObject(FFCPUOptions* options, yyjson_val* module)
|
||||
continue;
|
||||
}
|
||||
|
||||
if (ffStrEqualsIgnCase(key, "showPeCoreCount"))
|
||||
{
|
||||
options->showPeCoreCount = yyjson_get_bool(val);
|
||||
continue;
|
||||
}
|
||||
|
||||
ffPrintError(FF_CPU_MODULE_NAME, 0, &options->moduleArgs, FF_PRINT_TYPE_DEFAULT, "Unknown JSON key %s", key);
|
||||
}
|
||||
}
|
||||
@@ -178,6 +193,9 @@ void ffGenerateCPUJsonConfig(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_
|
||||
|
||||
if (defaultOptions.freqNdigits != options->freqNdigits)
|
||||
yyjson_mut_obj_add_uint(doc, module, "freqNdigits", options->freqNdigits);
|
||||
|
||||
if (defaultOptions.showPeCoreCount != options->showPeCoreCount)
|
||||
yyjson_mut_obj_add_bool(doc, module, "showPeCoreCount", options->showPeCoreCount);
|
||||
}
|
||||
|
||||
void ffGenerateCPUJsonResult(FFCPUOptions* options, yyjson_mut_doc* doc, yyjson_mut_val* module)
|
||||
@@ -256,7 +274,7 @@ void ffInitCPUOptions(FFCPUOptions* options)
|
||||
&options->moduleInfo,
|
||||
FF_CPU_MODULE_NAME,
|
||||
"Print CPU name, frequency, etc",
|
||||
ffParseCPUCPUOptions,
|
||||
ffParseCPUCommandOptions,
|
||||
ffParseCPUJsonObject,
|
||||
ffPrintCPU,
|
||||
ffGenerateCPUJsonResult,
|
||||
@@ -267,6 +285,7 @@ void ffInitCPUOptions(FFCPUOptions* options)
|
||||
options->temp = false;
|
||||
options->tempConfig = (FFColorRangeConfig) { 60, 80 };
|
||||
options->freqNdigits = 2;
|
||||
options->showPeCoreCount = false;
|
||||
}
|
||||
|
||||
void ffDestroyCPUOptions(FFCPUOptions* options)
|
||||
|
||||
@@ -12,4 +12,5 @@ typedef struct FFCPUOptions
|
||||
bool temp;
|
||||
FFColorRangeConfig tempConfig;
|
||||
uint8_t freqNdigits;
|
||||
bool showPeCoreCount;
|
||||
} FFCPUOptions;
|
||||
|
||||
Reference in New Issue
Block a user