F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
SystemResources.hpp
Go to the documentation of this file.
1 // ======================================================================
2 // \title SystemResourcesComponentImpl.hpp
3 // \author Santos F. Fregoso
4 // \brief hpp file for SystemResources component implementation class
5 //
6 // \copyright
7 // Copyright 2021, by the California Institute of Technology.
8 // ALL RIGHTS RESERVED. United States Government Sponsorship
9 // acknowledged.
10 //
11 // ======================================================================
12 
13 #ifndef SystemResources_HPP
14 #define SystemResources_HPP
15 
16 #include "Os/Cpu.hpp"
17 #include "Os/FileSystem.hpp"
18 #include "Os/Memory.hpp"
20 
21 namespace Svc {
22 
24  public:
25  // ----------------------------------------------------------------------
26  // Construction, initialization, and destruction
27  // ----------------------------------------------------------------------
28 
31  SystemResources(const char* const compName
32  );
33 
36  ~SystemResources(void);
37 
39 
40  private:
41  // ----------------------------------------------------------------------
42  // Handler implementations for user-defined typed input ports
43  // ----------------------------------------------------------------------
44 
47  void run_handler(const FwIndexType portNum,
48  U32 context
49  );
50 
51  private:
52  // ----------------------------------------------------------------------
53  // Command handler implementations
54  // ----------------------------------------------------------------------
55 
58  void ENABLE_cmdHandler(const FwOpcodeType opCode,
59  const U32 cmdSeq,
60  SystemResourceEnabled enable
61  );
62 
63  private:
64  void Cpu();
65  void Mem();
66  void PhysMem();
67  F32 compCpuUtil(Os::Cpu::Ticks current, Os::Cpu::Ticks previous);
68 
69  static const U32 CPU_COUNT = 16;
71  cpuTlmFunc m_cpu_tlm_functions[CPU_COUNT];
72  FwSizeType m_cpu_count;
73  Os::Memory::Usage m_mem;
74  Os::Cpu::Ticks m_cpu[CPU_COUNT];
75  Os::Cpu::Ticks m_cpu_prev[CPU_COUNT];
76  bool m_enable;
77 };
78 
79 } // end namespace Svc
80 
81 #endif
FwIdType FwOpcodeType
The type of a command opcode.
PlatformSizeType FwSizeType
float F32
32-bit floating point
Definition: BasicTypes.h:83
void(SystemResourcesComponentBase::* cpuTlmFunc)(F32, Fw::Time) const
SystemResources(const char *const compName)
Auto-generated base for SystemResources component.
PlatformIndexType FwIndexType
Generic used/total struct.
Definition: Os.hpp:31
RateGroupDivider component implementation.