diff --git a/base/sysinfo.jl b/base/sysinfo.jl index c6ed553cf337a..75726d45d8df9 100644 --- a/base/sysinfo.jl +++ b/base/sysinfo.jl @@ -64,6 +64,13 @@ See Hwloc.jl or CpuId.jl for extended information, including number of physical """ CPU_THREADS = 1 # for bootstrap, changed on startup +""" + Sys.CPU_NAME + +The name of the host CPU as a string. +""" +CPU_NAME = "" # for bootstrap, changed on startup + """ Sys.ARCH @@ -188,6 +195,15 @@ function _cpu_summary(io::IO, cpu::AbstractVector{CPUinfo}, i, j) println(io) end +""" + Sys.cpu_summary(io::IO=stdout, cpu::AbstractVector{CPUinfo} = cpu_info()) + +Print a summary of information about each processor in `cpu` gathered from [`cpu_info](@ref). This is generally: + - Its index in the `cpu` vector + - The CPU model + - The CPU speed + - The amount of time spent in `user`, `nice`, `sys`, `idle`, and `irq` modes +""" function cpu_summary(io::IO=stdout, cpu::AbstractVector{CPUinfo} = cpu_info()) model = cpu[1].model first = 1 @@ -200,6 +216,11 @@ function cpu_summary(io::IO=stdout, cpu::AbstractVector{CPUinfo} = cpu_info()) _cpu_summary(io, cpu, first, length(cpu)) end +""" + Sys.cpu_info() + +Gather information about all CPUs in the system through a syscall using LibUV. +""" function cpu_info() UVcpus = Ref{Ptr{UV_cpu_info_t}}() count = Ref{Int32}() @@ -215,7 +236,7 @@ end """ Sys.uptime() -Gets the current system uptime in seconds. +Get the current system uptime in seconds. """ function uptime() uptime_ = Ref{Float64}() diff --git a/doc/src/base/base.md b/doc/src/base/base.md index 3a1df621f1bff..c7eeff7a38091 100644 --- a/doc/src/base/base.md +++ b/doc/src/base/base.md @@ -288,6 +288,8 @@ Base.@elapsed Base.@allocated Base.EnvDict Base.ENV +Base.Sys.cpu_summary +Base.Sys.cpu_info Base.Sys.isunix Base.Sys.isapple Base.Sys.islinux diff --git a/doc/src/base/constants.md b/doc/src/base/constants.md index 4ba0e627b0c54..21e90dd3ebafe 100644 --- a/doc/src/base/constants.md +++ b/doc/src/base/constants.md @@ -10,6 +10,7 @@ Base.DEPOT_PATH Base.LOAD_PATH Base.Sys.BINDIR Base.Sys.CPU_THREADS +Base.Sys.CPU_NAME Base.Sys.WORD_SIZE Base.Sys.KERNEL Base.Sys.ARCH