Boost mode typo; uplift sample rate to 200/s; GPU boost mode = GPU throttled mode

This commit is contained in:
KazushiM
2022-10-24 12:20:50 +08:00
parent b52bef3c31
commit 0f6fb06e53
7 changed files with 44 additions and 48 deletions

View File

@@ -13,8 +13,8 @@
class CpuCoreUtil {
public:
CpuCoreUtil (int coreid = -2, uint64_t ms = 1):
m_core_id(coreid), m_wait_time_ms(ms), m_wait_time_ns(ms * 1000'000ULL) {};
CpuCoreUtil (int coreid = -2, uint64_t ns = 1000'000ULL):
m_core_id(coreid), m_wait_time_ns(ns) {};
inline uint64_t Get() { Start(); WaitForStop(); Stop(); return Calculate(); };
inline void Start() { m_idletick = GetIdleTickCount(); };
@@ -22,11 +22,11 @@ public:
inline void Stop() { m_idletick = GetIdleTickCount() - m_idletick; };
static constexpr uint64_t TICKS_PER_MS = 192;
inline uint64_t Calculate() { return 100'0 - m_idletick * 10 / (TICKS_PER_MS * m_wait_time_ms); };
inline uint64_t Calculate() { return 100'0 - m_idletick * 10 * 1000'000ULL / (TICKS_PER_MS * m_wait_time_ns); };
protected:
const int m_core_id;
const uint64_t m_wait_time_ms, m_wait_time_ns;
const uint64_t m_wait_time_ns;
uint64_t m_idletick;
inline uint64_t GetIdleTickCount() {
@@ -38,8 +38,8 @@ protected:
class GpuCoreUtil {
public:
GpuCoreUtil (uint32_t nvgpu_field, uint64_t ms = 1):
m_nvgpu_field(nvgpu_field), m_wait_time_ns(ms * 1000'000ULL) {};
GpuCoreUtil (uint32_t nvgpu_field, uint64_t ns = 1000'000ULL):
m_nvgpu_field(nvgpu_field), m_wait_time_ns(ns) {};
inline uint64_t Get() { Wait(); return GetLoad(); };
inline void Wait() { svcSleepThread(m_wait_time_ns); };
@@ -127,19 +127,14 @@ public:
protected:
// Parameters for sampling
static constexpr uint64_t SAMPLE_RATE_MAIN = 60, SAMPLE_RATE_GPU = 60;
static constexpr uint64_t SAMPLE_RATE_CPU = SAMPLE_RATE_GPU / 2;
static constexpr uint64_t UPDATE_CONTEXT_RATE = 60;
static constexpr uint64_t TICK_TIME_CPU_MS = 1000 / SAMPLE_RATE_CPU;
static constexpr uint64_t TICK_TIME_CPU_NS = 1E9 / SAMPLE_RATE_CPU;
static constexpr uint64_t TICK_TIME_GPU_MS = 1000 / SAMPLE_RATE_GPU;
static constexpr uint64_t TICK_TIME_MAIN_MS = 1000 / SAMPLE_RATE_MAIN;
static constexpr uint64_t TICK_TIME_MAIN_NS = 1E9 / SAMPLE_RATE_MAIN;
static constexpr uint64_t SAMPLE_RATE = 200;
static constexpr uint64_t TICK_TIME_MS = 1000 / SAMPLE_RATE;
static constexpr uint64_t TICK_TIME_NS = 1000'000'000 / SAMPLE_RATE;
// Parameters for frequency ramp threshold
static constexpr uint64_t CPU_THR_RAMP_DOWN = 70'0;
static constexpr uint64_t CPU_THR_RAMP_UP = 90'0;
static constexpr uint64_t GPU_THR_RAMP_DOWN = 60'0;
static constexpr uint64_t GPU_THR_RAMP_DOWN = 70'0;
static constexpr uint64_t GPU_THR_RAMP_UP = 80'0;
static constexpr uint64_t GPU_THR_RAMP_MAX = 90'0;
@@ -196,7 +191,7 @@ private:
// Much faster than <queue> from stl
T queue[QUEUE_SIZE] = { 0 };
T sum = 0;
T pos = 0;
size_t pos = 0;
T GetAvg() { return sum / QUEUE_SIZE; };
T GetFirst() { return queue[pos % QUEUE_SIZE]; };