37#ifdef OPENMRN_FEATURE_THREAD_FREERTOS
40#include "freertos_includes.h"
50static constexpr uint32_t SHIFT_ONE = 24;
53static constexpr uint32_t SHIFT_RATE = 8;
55static constexpr uint8_t AVG_RATE = 0xff;
57static constexpr uint32_t ADD_RATE = 0x1 << 24;
59void CpuLoad::record_value(
bool busy, uintptr_t key)
71 if (consecutive_ < 255)
75 if (consecutive_ > maxConsecutive_)
77 maxConsecutive_ = consecutive_;
86 last16Bits_ |= (busy ? 1 : 0);
88 unsigned v = last16Bits_;
89 v = (v & 0x5555) + ((v & 0xaaaa) >> 1);
90 v = (v & 0x3333) + ((v & 0xcccc) >> 2);
91 v = (v & 0x0F0F) + ((v & 0xF0F0) >> 4);
92 v = (v & 0x00FF) + ((v & 0xFF00) >> 8);
93 if (v > peakOver16Counts_)
95 peakOver16Counts_ = v;
101 for (
auto it = perKeyCost_.begin(); it != perKeyCost_.end(); ++it)
110 if (!found && newKey_ == 0)
116uint8_t CpuLoad::get_load() {
117 return (avg_ * 100) >> SHIFT_ONE;
120void cpuload_tick(
unsigned irq)
135 auto hdl = xTaskGetCurrentTaskHandleForCPU(PRO_CPU_NUM);
136 bool is_idle = xTaskGetIdleTaskHandleForCPU(PRO_CPU_NUM) == hdl;
142#ifndef CONFIG_FREERTOS_UNICORE
145 auto hdl = xTaskGetCurrentTaskHandleForCPU(APP_CPU_NUM);
146 bool is_idle = xTaskGetIdleTaskHandleForCPU(APP_CPU_NUM) == hdl;
155 auto hdl = xTaskGetCurrentTaskHandle();
156 bool is_idle = xTaskGetIdleTaskHandle() == hdl;
#define DEFINE_SINGLETON_INSTANCE(T)
Helper macro the the customer may (but is not required to) use for ensuring that the singleton instan...