The Be Book The Kernel Kit The Kernel Kit Index

System Information

Declared in:  be/kernel/OS.h
Summary:  more...

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.

System Info Functions


status_t get_system_info(system_info *info)

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.


get_system_info() always returns


int32 is_computer_on(void)

Returns 1 if the computer is on. If the computer isn't on, the value returned by this function is undefined.


double is_computer_on_fire(void)

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.

System Info Structures and Constants


typedef struct {
      bigtime_t active_time;
      } cpu_info

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.


typedef enum cpu_types {
      B_CPU_X86, Obsolete
      B_CPU_INTEL_X86 = 0x1000,
      B_CPU_AMD_X86 = 0x1100,
      B_CPU_CYRIX_X86 = 0x1200,
      B_CPU_IDT_X86 = 0x1300,
      B_CPU_RISE_X86 = 0x1400,
} cpu_type;

The B_X86_CPU constant is obsolete. All x86 CPUs are represented by specific vendor/model constants.

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: ...
   /* 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.


typedef int32 machine_id[2]; Currently unused

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) of the system_info structure.



This constant is set to the maximum number of CPUs that the BeOS can take advantage of. The number is machine-dependent.


typedef enum platform_types {
} platform_type;

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.


typedef struct {
      machine_id id; Currently unused
bigtime_t boot_time;
      int32 cpu_count;
      cpu_type cpu_type;
      int32 cpu_revision;
      cpu_info cpu_infos[B_MAX_CPU_NUM];   
      int64 cpu_clock_speed;
      int64 bus_clock_speed;
      platform_type platform_type;
      int32 max_pages;
      int32 used_pages;
      int32 page_faults;
      int32 max_sems;
      int32 used_sems;
      int32 max_ports;
      int32 used_ports;
      int32 max_threads;
      int32 used_threads;
      int32 max_teams;
      int32 used_teams;
      char kernel_name[B_FILE_NAME_LENGTH];
      char kernel_build_date[B_OS_NAME_LENGTH];
      char kernel_build_time[B_OS_NAME_LENGTH];
      int64 kernel_version;
      } system_info;

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.
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:
kernel_version    A Be-assigned number that identifies the kernel version.

The Be Book The Kernel Kit The Kernel Kit Index

The Be Book, lovely HTML...
for BeOS Release 5.

Copyright © 2000 Be, Inc. All rights reserved..