Learn R Programming

sfsmisc (version 1.0-15)

Sys.cpuinfo: Provide Information about the Linux Hardware (CPU, Memory, etc)

Description

Return information about the Linux hardware, notably the CPU (the central processor unit) and memory of the computer Ris running on. This is currently only available for Linux.

These functions exist on other unix-alike platforms, but produce an error when called.

Usage

Sys.procinfo(procfile)
Sys.cpuinfo()
Sys.meminfo()
Sys.MIPS()

Arguments

procfile
name of file the lines of which give the CPU info ``as on Linux''

Value

  • The Sys.*info() functions return a "simple.list", here basically a named character vector, (where the names have been filtered through make.names(*, unique=TRUE) which is of importance for multi-processor or multi-core CPUs, such that vector can easily be indexed.

    Sys.MIPS returns a number giving an approximation of the Million Iinstructions Per Second that the CPU processes. This is a performance measure of the basic non-numeric processing capabilities and for Linux systems often about twice the basic clock rate in ``MHz'' as available by Sys.cpuinfo()["cpu MHz"].

See Also

Sys.ps, etc.

Examples

Run this code
if(substr(R.version[["os"]], 1,5) == "linux") { ##-- only on Linux

  Sys.cpuinfo() # which is often ugly
  local({I <- Sys.cpuinfo(); I[ "flags" != names(I) ] })
  Sys.MIPS()
  Sys.MIPS() / as.numeric(Sys.cpuinfo()["cpu MHz"]) ## < often about 2
}

Run the code above in your browser using DataLab