41 constexpr
char PROC_STAT_PATH[] =
"/proc/stat";
48 for (
FwSizeType i = 0; i < cpu_index + 2; i++) {
51 Os::File::WaitType::NO_WAIT);
52 proc_stat_line[read_size + 1] =
'\0';
57 if (::strncmp(proc_stat_line,
"cpu", 3) != 0) {
61 char* token_start = proc_stat_line + 3;
65 token_start,
static_cast<FwSizeType>(
sizeof proc_stat_line) -
static_cast<FwSizeType>(token_start - proc_stat_line), token, &token_start);
80 long cpus = sysconf(_SC_NPROCESSORS_ONLN);
81 if ((cpus > 0) && (
static_cast<FwSizeType>(cpus) < std::numeric_limits<FwSizeType>::max())) {
94 }
else if (cpu_index >= count) {
106 return &this->m_handle;
uint8_t U8
8-bit unsigned integer
PlatformSignedSizeType FwSignedSizeType
PlatformSizeType FwSizeType
Cpu variable handle parent.
Status readline(U8 *buffer, FwSignedSizeType &size, WaitType wait)
read a line from the file using \n as the delimiter
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
Status _getCount(FwSizeType &cpu_count) override
Request the count of the CPUs detected by the system.
CpuHandle * getHandle() override
returns the raw console handle
Status _getTicks(Os::Cpu::Ticks &ticks, FwSizeType cpu_index) override
Get the CPU tick information for a given CPU.
@ SUCCESSFUL_CONVERSION
Output should be valid.
StringToNumberStatus string_to_number(const CHAR *input, FwSizeType buffer_size, U8 &output, char **next, U8 base=0)
converts a string to a U8
Status
Generic OK/ERROR status.
@ OP_OK
Operation succeeded.
CpuInterface::Status getCpuData(FwSizeType cpu_index, ProcCpuData data)
FwSizeType[ProcCpuMeasures::MAX_CPU_TICK_TYPES] ProcCpuData
constexpr FwSizeType LINE_SIZE
Generic used/total struct.
FwSizeType total
Total amount.
FwSizeType used
Used amount.