From 27a67b18ec03eea3e6c4871d26f0a5900767f552 Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Thu, 28 Feb 2019 11:56:07 -0600 Subject: [PATCH 1/5] Document some exported Sys CPU stuff --- base/sysinfo.jl | 23 ++++++++++++++++++++++- doc/src/base/base.md | 3 +++ doc/src/base/constants.md | 1 + 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/base/sysinfo.jl b/base/sysinfo.jl index c6ed553cf337a..f77f9d7082c9b 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 julia 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: + - The number (e.g. CPU 3 on a system with 10 total) + - The CPU model + - The CPU speed + - The amounnt 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..4047f9d08cb27 100644 --- a/doc/src/base/base.md +++ b/doc/src/base/base.md @@ -288,6 +288,9 @@ Base.@elapsed Base.@allocated Base.EnvDict Base.ENV +Base.Sys.cpu_summary +Base.Sys.cpu_info +Base.Sys.isapple 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 From b88acb70101845b7c68bfe7c71766ddb4e549c6b Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Sat, 2 Mar 2019 08:52:00 -0600 Subject: [PATCH 2/5] Update base/sysinfo.jl Co-Authored-By: kshyatt --- base/sysinfo.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/sysinfo.jl b/base/sysinfo.jl index f77f9d7082c9b..5fdcb840b744b 100644 --- a/base/sysinfo.jl +++ b/base/sysinfo.jl @@ -202,7 +202,7 @@ Print a summary of information about each processor in `cpu` gathered from [`cpu - The number (e.g. CPU 3 on a system with 10 total) - The CPU model - The CPU speed - - The amounnt of time spent in `user`, `nice`, `sys`, `idle`, and `irq` modes + - 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 From 150ee643fffe25dc465ba274b2a70420fff1fc2d Mon Sep 17 00:00:00 2001 From: Matt Bauman Date: Sat, 2 Mar 2019 08:52:10 -0600 Subject: [PATCH 3/5] Update doc/src/base/base.md Co-Authored-By: kshyatt --- doc/src/base/base.md | 1 - 1 file changed, 1 deletion(-) diff --git a/doc/src/base/base.md b/doc/src/base/base.md index 4047f9d08cb27..c7eeff7a38091 100644 --- a/doc/src/base/base.md +++ b/doc/src/base/base.md @@ -290,7 +290,6 @@ Base.EnvDict Base.ENV Base.Sys.cpu_summary Base.Sys.cpu_info -Base.Sys.isapple Base.Sys.isunix Base.Sys.isapple Base.Sys.islinux From 6b4ee1395878c84105e7c6626595697cc62f6418 Mon Sep 17 00:00:00 2001 From: Matt Bauman Date: Wed, 13 Mar 2019 09:16:31 -0400 Subject: [PATCH 4/5] Update base/sysinfo.jl Co-Authored-By: kshyatt --- base/sysinfo.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/sysinfo.jl b/base/sysinfo.jl index 5fdcb840b744b..a289727eaeaca 100644 --- a/base/sysinfo.jl +++ b/base/sysinfo.jl @@ -199,7 +199,7 @@ 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: - - The number (e.g. CPU 3 on a system with 10 total) + - 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 From d7e2158ba92a23db3ec66b888d93f51872b06146 Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Wed, 13 Mar 2019 09:17:49 -0400 Subject: [PATCH 5/5] [ci skip] [av skip] drop julia --- base/sysinfo.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/sysinfo.jl b/base/sysinfo.jl index a289727eaeaca..75726d45d8df9 100644 --- a/base/sysinfo.jl +++ b/base/sysinfo.jl @@ -67,7 +67,7 @@ CPU_THREADS = 1 # for bootstrap, changed on startup """ Sys.CPU_NAME -The name of the host CPU as a julia string. +The name of the host CPU as a string. """ CPU_NAME = "" # for bootstrap, changed on startup