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;
Status readline(U8 *buffer, FwSignedSizeType &size, WaitType wait)
read a line from the file using \n as the delimiter
Status _getCount(FwSizeType &cpu_count) override
Request the count of the CPUs detected by the system.
FwSizeType[ProcCpuMeasures::MAX_CPU_TICK_TYPES] ProcCpuData
PlatformSizeType FwSizeType
StringToNumberStatus string_to_number(const CHAR *input, FwSizeType buffer_size, U8 &output, char **next, U8 base=0)
converts a string to a U8
Cpu variable handle parent.
Os::FileInterface::Status open(const char *path, Mode mode)
open file with supplied path and mode
CpuHandle * getHandle() override
returns the raw console handle
Status
Generic OK/ERROR status.
constexpr FwSizeType LINE_SIZE
Status _getTicks(Os::Cpu::Ticks &ticks, FwSizeType cpu_index) override
Get the CPU tick information for a given CPU.
CpuInterface::Status getCpuData(FwSizeType cpu_index, ProcCpuData data)
FwSizeType total
Total amount.
FwSizeType used
Used amount.
Generic used/total struct.
PlatformSignedSizeType FwSignedSizeType