29 for (U32 i = 0; i < CPU_COUNT; i++) {
32 m_cpu_prev[i].
used = 0;
33 m_cpu_prev[i].
total = 0;
40 m_cpu_count = (m_cpu_count >= CPU_COUNT) ? CPU_COUNT : m_cpu_count;
66 void SystemResources ::run_handler(
const NATIVE_INT_TYPE portNum, U32 tick_time_hz) {
78 void SystemResources ::ENABLE_cmdHandler(
const FwOpcodeType opCode,
80 SystemResourceEnabled enable) {
92 util = std::isnan(util) ? 100.0f : util;
97 void SystemResources::Cpu() {
101 for (U32 i = 0; i < m_cpu_count && i < CPU_COUNT; i++) {
105 F32 cpuUtil = compCpuUtil(m_cpu[i], m_cpu_prev[i]);
110 (this->*m_cpu_tlm_functions[i])(cpuUtil,
Fw::Time());
113 m_cpu_prev[i] = m_cpu[i];
118 cpuAvg = (count == 0) ? 0.0f : (cpuAvg /
static_cast<F32>(count));
122 void SystemResources::Mem() {
129 void SystemResources::PhysMem() {
PlatformIntType NATIVE_INT_TYPE
float F32
32-bit floating point
PlatformSizeType FwSizeType
C++-compatible configuration header for fprime configuration.
@ OK
Command successfully executed.
static Status getTicks(Ticks &ticks, FwSizeType cpu_index)
Get the CPU tick information for a given CPU.
static Status getCount(FwSizeType &cpu_count)
Request the count of the CPUs detected by the system.
static Status getFreeSpace(const char *path, FwSizeType &totalBytes, FwSizeType &freeBytes)
Get filesystem free and total space in bytes on the filesystem containing the specified path.
@ OP_OK
Operation was successful.
static Status getUsage(Usage &memory)
get system memory usage
Auto-generated base for SystemResources component.
void tlmWrite_CPU_01(F32 arg, Fw::Time _tlmTime=Fw::Time())
void cmdResponse_out(FwOpcodeType opCode, U32 cmdSeq, Fw::CmdResponse response)
Emit command response.
void tlmWrite_CPU_02(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_14(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_MEMORY_USED(U64 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_NON_VOLATILE_TOTAL(U64 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_NON_VOLATILE_FREE(U64 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_00(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_09(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_10(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_06(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_08(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_MEMORY_TOTAL(U64 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_07(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_15(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_04(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_12(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_05(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_11(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_03(F32 arg, Fw::Time _tlmTime=Fw::Time())
void tlmWrite_CPU_13(F32 arg, Fw::Time _tlmTime=Fw::Time())
SystemResources(const char *const compName)
Status
Generic OK/ERROR status.
@ OP_OK
Operation succeeded.
Generic used/total struct.
FwSizeType total
Total amount.
FwSizeType used
Used amount.