Declared in: | kernel/OS.h |
Library: | libroot.so |
The following functions, types, and structures are used to convey basic information about the system, such as the number of CPUs, when the kernel was built, what time it is now and whether your computer is on fire.
status_t get_system_info(system_info* info);
struct {} system_info struct {} cpu_info enum cpu_type enum platform_type
The get_system_info()
function tells you more than you want to know about
the physical capacities and other statistics of your operating system.
The function takes a pointer to an allocated system_info structure and
fills it in.
typedef struct { machine_idid
; bigtime_tboot_time
; int32cpu_count
; cpu_typecpu_type
; int32cpu_revision
; cpu_infocpu_infos
[B_MAX_CPU_NUM
]; int64cpu_clock_speed
; int64bus_clock_speed
; platform_typeplatform_type
; int32max_pages
; int32used_pages
; int32page_faults
; int32max_sems
; int32used_sems
; int32max_ports
; int32used_ports
; int32max_threads
; int32used_threads
; int32max_teams
; int32used_teams
; charkernel_name
[B_FILE_NAME_LENGTH
]; charkernel_build_date
[B_OS_NAME_LENGTH
]; charkernel_build_time
[B_OS_NAME_LENGTH
]; int64kernel_version
; } system_info
The system_info structure holds information about the machine and the state of the kernel. The structure's fields are:
Field | Description |
---|---|
| The 64-bit number (encoded as two int32s) that uniquely identifies this machine. |
| The time at which the computer was last booted, measured in microseconds since January 1st, 1970. |
| The number of CPUs. |
| The type constant and revision number of the CPUs. |
| An array of cpu_info structures, one for each CPU. |
| The speed (in Hz) at which the CPUs operate. |
| The speed (in Hz) at which the bus operates. |
| One of the platform type constants. |
| The five pairs of max/used fields give the total number of RAM pages, semaphores, and so on, that the system can create, and the number that are currently in use. |
| The number of times the system a read a page of memory into RAM due to a page fault. |
| The (leaf) name of the kernel. |
| Human-readable strings that tell you when the kernel was built. |
| A number that identifies the kernel version. |
The cpu_info structure is:
typedef struct {
bigtime_t active_time
;
} cpu_info;
Field | Description |
---|---|
| Is the number of microseconds spent doing useful work since the machine was booted. |
Relatedly, B_MAX_CPU_COUNT
is currently 8.
The machine_id type is:
typedef int32 machine_id[2];
The cpu_type constants are:
typedef enum {B_CPU_PPC_601
= 1,B_CPU_PPC_603
= 2,B_CPU_PPC_603e
= 3,B_CPU_PPC_604
= 4,B_CPU_PPC_604e
= 5,B_CPU_PPC_686
= 13,B_CPU_AMD_29K
,B_CPU_X86
,B_CPU_MC6502
,B_CPU_Z80
,B_CPU_ALPHA
,B_CPU_MIPS
,B_CPU_HPPA
,B_CPU_M68K
,B_CPU_ARM
,B_CPU_SH
,B_CPU_SPARC
} cpu_type;
The platform_type constants are:
typedef enum {B_BEBOX_PLATFORM
= 0,B_MAC_PLATFORM
,B_AT_CLONE_PLATFORM
,B_ENIAC_PLATFORM
,B_APPLE_II_PLATFORM
,B_CRAY_PLATFORM
,B_LISA_PLATFORM
,B_TI_994A_PLATFORM
,B_TIMEX_SINCLAIR_PLATFORM
,B_ORAC_1_PLATFORM
,B_HAL_PLATFORM
} platform_type;
I haven't tried it, but I really don't think the BeOS would work at all
well on a Timex Sinclair (see
is_computer_on_fire()
).
get_system_info()
always returns
B_OK
.