The Kernel Kit Table of Contents | The Kernel Kit Index |
Declared in: be/kernel/OS.h
Library: libroot.so
The following functions, types, and structures convey information about the system, such as the number of CPUs, when the kernel was built, and whether your computer is on fire.
|
The get_system_info() function tells you more than you want to know about the physical capacities of your computer and other statistics of your operating system. The function copies this information into the system_info argument info. You must allocate info before passing it in.
RETURN CODES
get_system_info() always returns B_OK.
|
Returns 1 if the computer is on. If the computer isn't on, the value returned by this function is undefined.
|
Returns the temperature of the motherboard if the computer is currently on fire. If the computer isn't on fire, the function returns some other value.
|
The cpu_info structure provides information about your computer's CPU(s). You retrieve the structure by looking in the cpu_infos field of the system_info structure. The cpu_infos field is an array that contains one cpu_info structure for each CPU on your motherboard.
Field | Meaning |
---|---|
active_time | The number of microseconds the CPU has spent doing useful work (i.e. not busy waiting) since the machine was booted. |
|
|
These constants represents different CPU vendors and models. To retrieve the constant that represents the CPU(s) that your computer uses, look in the cpu_type field of the system_info structure.
Note that the x86 types are grouped by vendor, where the vendor is identified by the high word, and the model by the low word. Each vendor has its own cpu_type constant, as indicated by the explicit values in the list above. If you're only interested in the vendor, mask the cpu_type value with B_CPU_X86_VENDOR_MASK, thus:
system_info sysinfo; get_system_info( &sysinfo ); switch ( sysinfo.cpu_type & B_CPU_X86_VENDOR_MASK ) { case B_CPU_INTEL_X86: ... case B_CPU_AMD_X86: ... case B_CPU_CYRIX_x86: ... case B_CPU_IDT_X86: ... case B_CPU_RISE_X86: ... default: /* Not x86. */ }
|
You mask your machine's cpu_type value with this constant to retrieve the CPU's vendor id (which is also a cpu_type value). If the CPU isn't an breed of x86, applying the mask will yield 0. See the cpu_type description for an example.
machine_id is a 64-bit number (encoded as two 32-bit numbers) that uniquely identifies this specific computer. The id number is returned as the id field (currently unused
typedef int32 machine_id[2]; Currently unused
|
This constant is set to the maximum number of CPUs that the BeOS can take advantage of. The number is machine-dependent.
|
These constants represent the various computer platforms that the BeOS does, has, should, might, or might not run on. To retrieve the constant for the machine that you're running on, look in the platform_type field of the system_info structure.
|
The system_info structure describes your computer's hardware and operating system, and provides information about the availability of kernel resources (such as threads and ports). You retrieve a system_info structure through the get_system_info() function.
Field | Meaning |
---|---|
id | A 64-bit number (encoded as two int32s) that uniquely identifies this machine. Currently unsed. |
boot_time | The time at which the computer was last booted, measured in microseconds since January 1st, 1970. You can also get this information through system_time(). |
cpu_count | The number of CPUs on your computer's motherboard. |
cpu_type | A constant that represents the CPU(s) make and model. |
cpu_revision | The revision number of the CPU(s). |
cpu_infos | An array of cpu_info structures, one for each CPU. |
cpu_clock_speed | The speed (in Hz) at which the CPU(s) operate. |
bus_clock_speed | The speed (in Hz) at which the bus operates. |
platform_type | The platform type constant that reprsents your computer. |
max_resource
used_resource |
These 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. |
page_faults | The number of times the system has read a page of memory into RAM due to a page fault. |
kernel_name | The filename of the kernel (the leaf name, not the path). |
kernel_build_date | Fixed-width string that gives the date that the kernel was built; for example:
Jun 5 1999 |
kernel_build_time Fixed-width string that gives the time of day that the kernel was built; for example: 10:02:16 | |
kernel_version A Be-assigned number that identifies the kernel version. |
The Kernel Kit Table of Contents | The Kernel Kit Index |
Copyright © 2000 Be, Inc. All rights reserved..