Loading...
Searching...
No Matches
Systeminfo

Definition

Collect system related information.

Examples

The following example demonstrates some of the methods found in the benchmark_systeminfo module.

use benchmark_systeminfo
write (*, '(A)') 'OS:'//os_name(get_os_type())


Remarks

This steps retrieves system information at run time. The method was inspired by the paramonte library from AmirShahmoradi. It has been simplified and adapted to the needs

Attention
The method get_systeminfo() saves system related information in a file named sys.info. That file is used as cache in the subsequent calls. It is usually located next to the running program and as such one shall have write permission when using this function.
Note
If the configuration of the computer changed (os version, hardware,...) make sure to delete the cache before starting the program again.

Methods

◆ get_os_type()

integer(os_enum) function, public get_os_type

Returns the OS type. At first, the environment variable OS is checked, which is usually found on Windows. Then, OSTYPE is read in and compared with common names. If this fails too, check the existence of files that can be found on specific system types only.

Returns
An integer(OS_ENUM). Returns OS_UNKNOWN if the operating system cannot be determined.

Remarks

Definition at line 131 of file SystemInfo.f90.

◆ get_systeminfo()

subroutine, public get_systeminfo

Generate and display a summary of the operating system and platform specifications. The system information is obtained by first identifying the operating system and the runtime shell and then calling one of the following commands:

  • Darwin (macOS): The commands uname -a + sysctl -a | grep machdep.cpu + system_profiler SPHardwareDataType.
  • Linux: The commands uname -a + lscpu + cat /proc/cpuinfo.
  • Windows: The commands systeminfo.

Remarks

Definition at line 68 of file SystemInfo.f90.

◆ os_name()

pure character(:) function, allocatable, public os_name ( integer(os_enum), intent(in) os)

Return string describing the OS type flag. That function was taken from fpm.

Returns
The name of the OS.

Remarks

Definition at line 243 of file SystemInfo.f90.