F´ Flight Software - C/C++ Documentation  devel
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 
17 #include "Os/Cpu.hpp"
18 #include "Os/Memory.hpp"
19 #include "Os/FileSystem.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  // ----------------------------------------------------------------------
43  // Handler implementations for user-defined typed input ports
44  // ----------------------------------------------------------------------
45 
48  void
49  run_handler(const NATIVE_INT_TYPE portNum,
50  U32 context
51  );
52 
53  private:
54  // ----------------------------------------------------------------------
55  // Command handler implementations
56  // ----------------------------------------------------------------------
57 
60  void ENABLE_cmdHandler(
61  const FwOpcodeType opCode,
62  const U32 cmdSeq,
63  SystemResourceEnabled enable
64  );
65 
66 
67  private:
68  void Cpu();
69  void Mem();
70  void PhysMem();
71  F32 compCpuUtil(Os::Cpu::Ticks current, Os::Cpu::Ticks previous);
72 
73 
74  static const U32 CPU_COUNT = 16;
76  cpuTlmFunc m_cpu_tlm_functions[CPU_COUNT];
77  FwSizeType m_cpu_count;
78  Os::Memory::Usage m_mem;
79  Os::Cpu::Ticks m_cpu[CPU_COUNT];
80  Os::Cpu::Ticks m_cpu_prev[CPU_COUNT];
81  bool m_enable;
82 };
83 
84 } // end namespace Svc
85 
86 #endif
PlatformIntType NATIVE_INT_TYPE
Definition: BasicTypes.h:55
float F32
32-bit floating point
Definition: BasicTypes.h:49
U32 FwOpcodeType
Definition: FpConfig.h:91
PlatformSizeType FwSizeType
Definition: FpConfig.h:35
Definition: Time.hpp:9
Auto-generated base for SystemResources component.
void(SystemResourcesComponentBase::* cpuTlmFunc)(F32, Fw::Time)
SystemResources(const char *const compName)
Generic used/total struct.
Definition: Os.hpp:31