Rewrite: full load

This commit is contained in:
Lightos1
2026-03-20 19:24:45 +01:00
parent cc78b6193a
commit 4502dc6fdb
4 changed files with 26 additions and 11 deletions

View File

@@ -112,7 +112,7 @@ namespace board {
ASSERT_RESULT_OK(rc, "pmdmntInitialize");
StartGpuLoad(nvCheck, fd);
// threadCreate(&cpuCore3Thread, CheckCore, &idletick3, NULL, 0x1000, 0x10, 3);
/* TODO: Add back fan. */
// threadCreate(&miscThread, miscThreadFunc, NULL, NULL, 0x1000, 0x10, 3);
// threadStart(&miscThread);

View File

@@ -25,6 +25,8 @@
*/
#include <switch.h>
#include <sysclk.h>
#include <nxExt.h>
#include <algorithm>
#include <math.h>
#include <numeric>
@@ -63,14 +65,6 @@ namespace board {
} while(true);
}
void StartGpuLoad(Result nvCheck, u32 fd) {
;
}
u32 GetGpuLoad() {
return gpuLoad;
}
void CheckCore(void *idletickPtr) {
u64* idletick = static_cast<u64 *>(idletickPtr);
while(true) {
@@ -105,6 +99,27 @@ namespace board {
return std::round(std::max({cpuUsage0, cpuUsage1, cpuUsage2}));
}
u32 GetPartLoad(SysClkPartLoad loadSource) {
switch(loadSource) {
case SysClkPartLoad_EMC:
return t210EmcLoadAll();
case SysClkPartLoad_EMCCpu:
return t210EmcLoadCpu();
case HocClkPartLoad_GPU:
return gpuLoad;
case HocClkPartLoad_CPUMax:
return GetMaxCpuLoad();
case HocClkPartLoad_BAT:
BatteryChargeInfo info;
batteryInfoGetChargeInfo(&info);
return info.RawBatteryCharge;
default:
ASSERT_ENUM_VALID(SysClkPartLoad, loadSource);
}
return 0;
}
void ExitLoad() {
threadClose(&gpuThread);
threadClose(&cpuCore0Thread);

View File

@@ -31,7 +31,6 @@ namespace board {
void StartLoad(Result nvCheck, u32 fd);
void ExitLoad();
u32 GetGpuLoad();
u32 GetMaxCpuLoad();
u32 GetPartLoad();
}

View File

@@ -34,6 +34,7 @@ namespace board {
RgltrSession session;
Result rc = 0;
u32 out = 0;
BatteryChargeInfo info;
switch (voltage) {
case HocClkVoltage_SOC: