F´ Flight Software - C/C++ Documentation
A framework for building embedded system applications to NASA flight quality standards.
Os::Darwin::Cpu Namespace Reference

Classes

class  DarwinCpu
 stub implementation of Os::CpuInterface More...
 
struct  DarwinCpuHandle
 

Functions

kern_return_t cpu_data_helper (processor_cpu_load_info_t &cpu_load_info, FwSizeType &cpu_count, mach_msg_type_number_t &processor_msg_count)
 helper around raw CPU capture API More...
 
void cpu_data_release (processor_cpu_load_info_t cpu_load_info, mach_msg_type_number_t processor_msg_count)
 release the CPU information allocated by the kernel inside cpu_data_helper More...
 
kern_return_t cpu_by_index (FwSizeType cpu_index, FwSizeType &used, FwSizeType &total)
 Query for a single CPU's ticks information. More...
 

Function Documentation

◆ cpu_by_index()

kern_return_t Os::Darwin::Cpu::cpu_by_index ( FwSizeType  cpu_index,
FwSizeType used,
FwSizeType total 
)

Query for a single CPU's ticks information.

Queries all CPU information but only deals with a single CPU's output. This is done because the load average is tracked sample to sample and the call pattern is cpu0, cpu1, ..., cpu last, wait for sample window, cpu0, ... and thus each call should update one CPU's sample or only the last cpu will have the benefit of the sampling window.

Parameters
cpu_indexindex of current CPU being queried
usedfilled with CPU's used ticks count
totalfilled with CPU's total ticks
Returns
success/failure using kern_return_t

Definition at line 63 of file Cpu.cpp.

◆ cpu_data_helper()

kern_return_t Os::Darwin::Cpu::cpu_data_helper ( processor_cpu_load_info_t &  cpu_load_info,
FwSizeType cpu_count,
mach_msg_type_number_t &  processor_msg_count 
)

helper around raw CPU capture API

Calls for the CPU information from the machine, improving readability in cpu_by_index

Parameters
cpu_load_infofilled with CPU data
cpu_countfilled with CPU count
processor_msg_countfilled with the size of the kernel allocation in integer_t units
Returns
success/failure using kern_return_t
Note
on success the kernel allocates cpu_load_info; the caller must release it using cpu_data_release once the data has been read

Definition at line 30 of file Cpu.cpp.

◆ cpu_data_release()

void Os::Darwin::Cpu::cpu_data_release ( processor_cpu_load_info_t  cpu_load_info,
mach_msg_type_number_t  processor_msg_count 
)

release the CPU information allocated by the kernel inside cpu_data_helper

Parameters
cpu_load_infodata filled by a successful cpu_data_helper call
processor_msg_countcount filled by that same call

Definition at line 47 of file Cpu.cpp.