hocclk: add RAM bandwidth monitor

This commit is contained in:
souldbminersmwc
2026-04-11 19:00:22 -04:00
parent b7440a38a5
commit b417099a4a
6 changed files with 69 additions and 3 deletions

View File

@@ -109,6 +109,9 @@ typedef enum
HocClkPartLoad_CPUMax,
HocClkPartLoad_BAT,
HocClkPartLoad_FAN,
HocClkPartLoad_RamBWAll,
HocClkPartLoad_RamBWCpu,
HocClkPartLoad_RamBWGpu,
HocClkPartLoad_EnumMax
} HocClkPartLoad;

View File

@@ -31,7 +31,7 @@
#include "board.h"
#include "clock_manager.h"
#define HOCCLK_IPC_API_VERSION 1
#define HOCCLK_IPC_API_VERSION 2
#define HOCCLK_IPC_SERVICE_NAME "hoc:clk"
enum HocClkIpcCmd

View File

@@ -32,6 +32,9 @@ tsl::elm::ListItem* waferCordsItem = NULL;
tsl::elm::ListItem* ramVoltItem = NULL;
tsl::elm::ListItem* eristaPLLXItem = NULL;
tsl::elm::ListItem* dispVoltItem = NULL;
tsl::elm::ListItem* ramBWItemAll = NULL;
tsl::elm::ListItem* ramBWItemCpu = NULL;
tsl::elm::ListItem* ramBWItemGpu = NULL;
ImageElement* CatImage = NULL;
HideableCategoryHeader* CatHeader = NULL;
@@ -50,7 +53,7 @@ AboutGui::~AboutGui()
void AboutGui::listUI()
{
this->listElement->addItem(
new tsl::elm::CategoryHeader("Voltages and Temperatures")
new tsl::elm::CategoryHeader("Voltages and Temps")
);
ramVoltItem =
@@ -59,7 +62,6 @@ void AboutGui::listUI()
if(IsMariko()) {
this->listElement->addItem(ramVoltItem);
}
dispVoltItem =
new tsl::elm::ListItem("Display Voltage:");
this->listElement->addItem(dispVoltItem);
@@ -70,6 +72,23 @@ void AboutGui::listUI()
this->listElement->addItem(eristaPLLXItem);
}
this->listElement->addItem(
new tsl::elm::CategoryHeader("RAM Bandwidth")
);
ramBWItemAll =
new tsl::elm::ListItem("Ram BW (All):");
this->listElement->addItem(ramBWItemAll);
ramBWItemCpu =
new tsl::elm::ListItem("Ram BW (CPU):");
this->listElement->addItem(ramBWItemCpu);
ramBWItemGpu =
new tsl::elm::ListItem("Ram BW (GPU):");
this->listElement->addItem(ramBWItemGpu);
this->listElement->addItem(
new tsl::elm::CategoryHeader("HW Info")
);
@@ -346,4 +365,14 @@ void AboutGui::refresh()
sprintf(strings[5], "%u.%u mV", context->voltages[HocClkVoltage_Display] / 1000U, (context->voltages[HocClkVoltage_Display] % 1000U) / 100U);
dispVoltItem->setValue(strings[5]);
sprintf(strings[6], "%u MB/s", context->partLoad[HocClkPartLoad_RamBWAll]);
ramBWItemAll->setValue(strings[6]);
sprintf(strings[7], "%u MB/s", context->partLoad[HocClkPartLoad_RamBWCpu]);
ramBWItemCpu->setValue(strings[7]);
sprintf(strings[8], "%u MB/s", context->partLoad[HocClkPartLoad_RamBWGpu]);
ramBWItemGpu->setValue(strings[8]);
}

View File

@@ -39,6 +39,9 @@ u32 t210ClkMemFreq(void);
u32 t210ClkGpuFreq(void);
u32 t210EmcLoadAll(void);
u32 t210EmcLoadCpu(void);
u32 t210EmcBwAll(void);
u32 t210EmcBwCpu(void);
u32 t210EmcBwGpu(void);
#ifdef __cplusplus
}

View File

@@ -117,6 +117,9 @@ static u32 g_gpu_freq = 0;
static u32 g_mem_freq = 0;
static u32 g_emc_lall = 0;
static u32 g_emc_lcpu = 0;
static u32 g_emc_bw_all = 0;
static u32 g_emc_bw_cpu = 0;
static u32 g_emc_bw_gpu = 0;
static u32 _clock_get_dev_freq(u32 id, u32 multiplier)
{
@@ -256,6 +259,10 @@ static void _clock_update_freqs(void)
// Get 1000 -> 100.0.
g_emc_lall = (u64)_actmon_dev_get_count_avg(ACTMON_DEV_MC_ALL) * 10 * 100 / (emc_freq * ACTMON_PERIOD_MS);
g_emc_lcpu = (u64)_actmon_dev_get_count_avg(ACTMON_DEV_MC_CPU) * 10 * 100 / (emc_freq * ACTMON_PERIOD_MS);
g_emc_bw_all = (u64)emc_freq * 8 * g_emc_lall / 1000 / 1000;
g_emc_bw_cpu = (u64)emc_freq * 8 * g_emc_lcpu / 1000 / 1000;
g_emc_bw_gpu = g_emc_bw_all > g_emc_bw_cpu ? g_emc_bw_all - g_emc_bw_cpu : 0;
}
@@ -288,3 +295,21 @@ u32 t210EmcLoadCpu()
_clock_update_freqs();
return g_emc_lcpu;
}
u32 t210EmcBwAll()
{
_clock_update_freqs();
return g_emc_bw_all;
}
u32 t210EmcBwCpu()
{
_clock_update_freqs();
return g_emc_bw_cpu;
}
u32 t210EmcBwGpu()
{
_clock_update_freqs();
return g_emc_bw_gpu;
}

View File

@@ -120,6 +120,12 @@ namespace board {
return info.RawBatteryCharge;
case HocClkPartLoad_FAN:
return GetFanLevel();
case HocClkPartLoad_RamBWAll:
return t210EmcBwAll();
case HocClkPartLoad_RamBWCpu:
return t210EmcBwCpu();
case HocClkPartLoad_RamBWGpu:
return t210EmcBwGpu();
default:
ASSERT_ENUM_VALID(HocClkPartLoad, loadSource);
}