mirror of
https://github.com/fastfetch-cli/fastfetch.git
synced 2026-11-06 21:24:43 +01:00
Only detect temps if --allow-slow-operations is given
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
#define FF_CPU_CACHE_NAME "cpu"
|
||||
|
||||
void ffDetectCPUImpl(FFCPUResult* cpu, bool cached);
|
||||
void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu, bool cached);
|
||||
|
||||
static bool cacheCallback(FFCPUResult* cpu, FFCache* cache, FFCacheMethodStrbuf strbufMethod, FFCacheMethodData dataMethod)
|
||||
{
|
||||
@@ -25,7 +25,7 @@ static void detectCPU(const FFinstance* instance, FFCPUResult* cpu)
|
||||
|
||||
bool cached = ffCacheRead(instance, cpu, FF_CPU_CACHE_NAME, (FFCacheMethodCallback) cacheCallback);
|
||||
|
||||
ffDetectCPUImpl(cpu, cached);
|
||||
ffDetectCPUImpl(instance, cpu, cached);
|
||||
|
||||
if(cached)
|
||||
return;
|
||||
|
||||
@@ -12,10 +12,13 @@ static double getFrequency(const char* propName)
|
||||
return herz / 1000.0; //to GHz
|
||||
}
|
||||
|
||||
void ffDetectCPUImpl(FFCPUResult* cpu, bool cached)
|
||||
void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu, bool cached)
|
||||
{
|
||||
FF_UNUSED(instance);
|
||||
|
||||
//TODO find a way to detect this
|
||||
cpu->temperature = FF_CPU_TEMP_UNSET;
|
||||
|
||||
if(cached)
|
||||
return;
|
||||
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
#include "cpu.h"
|
||||
#include "common/sysctl.h"
|
||||
|
||||
void ffDetectCPUImpl(FFCPUResult* cpu, bool cached)
|
||||
void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu, bool cached)
|
||||
{
|
||||
FF_UNUSED(instance);
|
||||
|
||||
cpu->temperature = FF_CPU_TEMP_UNSET;
|
||||
|
||||
if(cached)
|
||||
return;
|
||||
|
||||
|
||||
@@ -60,9 +60,9 @@ static double getFrequency(const char* info, const char* scaling)
|
||||
return getGHz(scaling);
|
||||
}
|
||||
|
||||
static double detectCPUTemp()
|
||||
static double detectCPUTemp(const FFinstance* instance)
|
||||
{
|
||||
const FFTempsResult* temps = ffDetectTemps();
|
||||
const FFTempsResult* temps = ffDetectTemps(instance);
|
||||
|
||||
for(uint32_t i = 0; i < temps->values.length; i++)
|
||||
{
|
||||
@@ -78,9 +78,10 @@ static double detectCPUTemp()
|
||||
return FF_CPU_TEMP_UNSET;
|
||||
}
|
||||
|
||||
void ffDetectCPUImpl(FFCPUResult* cpu, bool cached)
|
||||
void ffDetectCPUImpl(const FFinstance* instance, FFCPUResult* cpu, bool cached)
|
||||
{
|
||||
cpu->temperature = detectCPUTemp();
|
||||
cpu->temperature = detectCPUTemp(instance);
|
||||
|
||||
if(cached)
|
||||
return;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user