sys-cpu 0.6.4-universal-linux
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +159 -0
- data/MANIFEST +29 -0
- data/README +73 -0
- data/Rakefile +89 -0
- data/doc/bsd.txt +49 -0
- data/doc/hpux.txt +54 -0
- data/doc/linux.txt +41 -0
- data/doc/sunos.txt +56 -0
- data/doc/windows.txt +130 -0
- data/examples/example_sys_cpu_bsd.rb +19 -0
- data/examples/example_sys_cpu_hpux.rb +27 -0
- data/examples/example_sys_cpu_linux.rb +24 -0
- data/examples/example_sys_cpu_sunos.rb +21 -0
- data/examples/example_sys_cpu_windows.rb +24 -0
- data/ext/bsd/bsd.c +331 -0
- data/ext/extconf.rb +26 -0
- data/ext/hpux/hpux.c +219 -0
- data/ext/sunos/sunos.c +281 -0
- data/ext/version.h +2 -0
- data/install.rb +85 -0
- data/lib/linux/sys/cpu.rb +122 -0
- data/lib/windows/sys/cpu.rb +790 -0
- data/sys-cpu.gemspec +50 -0
- data/test/test_sys_cpu.rb +23 -0
- data/test/test_sys_cpu_bsd.rb +76 -0
- data/test/test_sys_cpu_hpux.rb +52 -0
- data/test/test_sys_cpu_linux.rb +34 -0
- data/test/test_sys_cpu_sunos.rb +67 -0
- data/test/test_sys_cpu_version.rb +18 -0
- data/test/test_sys_cpu_windows.rb +72 -0
- metadata +113 -0
data/CHANGES
ADDED
@@ -0,0 +1,159 @@
|
|
1
|
+
== 0.6.4 - ???
|
2
|
+
* The CPU.freq method now works on OSX.
|
3
|
+
* The CPU.model method on OSX has been altered. Previously it
|
4
|
+
returned the machine model. However, the information is limited.
|
5
|
+
* Fixed a couple unused variable warnings for the BSD/OSX code.
|
6
|
+
* Refactored the clean task in the Rakefile.
|
7
|
+
|
8
|
+
== 0.6.3 - 9-Oct-2010
|
9
|
+
* Fixed a bug in the install.rb file and refactored it a bit. Thanks go
|
10
|
+
to Di-an Jan for the spot. Note, however, that this file will eventually
|
11
|
+
be removed and/or integrated into the Linux source file.
|
12
|
+
* Fixed the example Rake task, and refactored some of the other tasks.
|
13
|
+
* Fixed and updated the CPU.architecture method on MS Windows to handle IA64
|
14
|
+
and x64 architectures.
|
15
|
+
|
16
|
+
== 0.6.2 - 1-Jan-2010
|
17
|
+
* Fixed a bug in the cpu_freq function (which would only be noticed on
|
18
|
+
certain platforms in cases where the CPU.freq method failed). Thanks
|
19
|
+
go to Edho P Arief for the spot.
|
20
|
+
* Explicitly add sys/param.h on OpenBSD, and default to the HW_MODEL mib
|
21
|
+
because HW_MACHINE does not exist. Thanks go to Edho P Arief for the patch.
|
22
|
+
* Updated my support notes. In short I will support 1.8.6 and 1.9.x. I will
|
23
|
+
not support any 1.8.x branch later than 1.8.6.
|
24
|
+
* Removed redundant information in the various .txt files that is already
|
25
|
+
covered in the README file.
|
26
|
+
* Test files renamed.
|
27
|
+
* Added test-unit 2.x as a development dependency.
|
28
|
+
|
29
|
+
== 0.6.1 - 4-Jan-2009
|
30
|
+
* Fix for OS X 10.5.x. Thanks go to Victor Costan for the spot and the patch.
|
31
|
+
* Updated the gemspec and some other minor changes.
|
32
|
+
* On MS Windows the impersonation level is now explicitly set to 'impersonate'
|
33
|
+
to avoid issues where systems might be using an older version of WMI.
|
34
|
+
|
35
|
+
== 0.6.0 - 26-Apr-2007
|
36
|
+
* Added support for most BSD flavors, including OS X. The freebsd.c file is
|
37
|
+
now just bsd.c.
|
38
|
+
* The CPU.type method for Solaris has been changed to CPU.cpu_type to avoid
|
39
|
+
conflicting with the Object.type method.
|
40
|
+
* Added a Rakefile. There are now tasks for building, testing and installing,
|
41
|
+
among other things. Run 'rake -T' to check your options.
|
42
|
+
* Many internal directory layout changes - C source files are now under the
|
43
|
+
'ext' directory.
|
44
|
+
* Improved RDoc comments in the C source files.
|
45
|
+
* Changed CPUError to CPU::Error.
|
46
|
+
|
47
|
+
== 0.5.5 - 17-Nov-2006
|
48
|
+
* Fixed a bug in the Linux version where there could be a key but no
|
49
|
+
associated value, causing a String#strip! call to fail. Now the value is
|
50
|
+
simply left at nil.
|
51
|
+
* Refactored the CPU.processors method on Linux, including the removal of '?'
|
52
|
+
from the CPUStruct members for the boolean methods (Ruby doesn't like them).
|
53
|
+
* Minor tweaks and updates to the documentation, including the README.
|
54
|
+
* Modified the gemspec so that it sets the platform properly for Linux
|
55
|
+
and Windows.
|
56
|
+
|
57
|
+
== 0.5.4 - 12-Jul-2006
|
58
|
+
* Added a gemspec (and a gem on RubyForge).
|
59
|
+
* The CPU.architecture method on HP-UX now returns nil if it cannot be
|
60
|
+
determined instead of "Unknown" for consistency with the other
|
61
|
+
platforms.
|
62
|
+
* Inlined the RDoc and made some minor cosmetic source code changes.
|
63
|
+
|
64
|
+
== 0.5.3 - 4-May-2006
|
65
|
+
* Fixed in a bug in the Solaris version where CPU.load_avg returned bad values
|
66
|
+
when compiled in 64 bit mode. Thanks go to James Hranicky for the spot and
|
67
|
+
both James Hranicky and Peter Tribble (via comp.unix.solaris) for patches.
|
68
|
+
* Made some modifications to the test suite. You know longer need to know
|
69
|
+
which test suite to run. All platforms now use 'ts_all.rb', which will run
|
70
|
+
the appropriate test case behind the scenes.
|
71
|
+
|
72
|
+
== 0.5.2 - 24-Jun-2005
|
73
|
+
* Bug fixed on Linux where empty lines could cause problems. This affected
|
74
|
+
both the install.rb and linux.rb files, though it only seems to have been
|
75
|
+
an issue on the 2.6+ kernel.
|
76
|
+
* Altered the behavior of the CPU.cpu_stats method on Linux. Now, only the
|
77
|
+
numbered cpu entries return associated data, unless the numberless entry
|
78
|
+
is the only entry.
|
79
|
+
* Added a sample program for Linux under the 'examples' directory.
|
80
|
+
|
81
|
+
== 0.5.1 - 5-May-2005
|
82
|
+
* Fixed a potential bug in the FreeBSD version of CPU.model.
|
83
|
+
* Eliminated some warnings in the FreeBSD version.
|
84
|
+
* Moved examples directory to the toplevel package directory.
|
85
|
+
* Renamed and updated the sample scripts.
|
86
|
+
* Added a sample script for FreeBSD.
|
87
|
+
* Removed the INSTALL file. That information is now included in the README.
|
88
|
+
* Made the CHANGES, README, and .txt files rdoc friendly.
|
89
|
+
* The dynamic documentation generation for Linux has been altered. Anything
|
90
|
+
relating to rd2 has been removed. The doc file generated is now
|
91
|
+
doc/linux.txt.
|
92
|
+
* Some $LOAD_PATH setup changes in the unit tests.
|
93
|
+
|
94
|
+
== 0.5.0 - 26-Jun-2004
|
95
|
+
* Now requires Ruby 1.8.0 or later.
|
96
|
+
* FreeBSD support added.
|
97
|
+
* Replaced 'CPUException' with 'CPUError'
|
98
|
+
* The MS Windows version has been completely revamped to use WMI instead of
|
99
|
+
the C API. Some method names have changed and some methods have been
|
100
|
+
dropped entirely. Please see the documentation for details.
|
101
|
+
* Corresponding documentation updates and test suite changes.
|
102
|
+
* Sample programs have been moved to doc/examples.
|
103
|
+
* Installation procedure somewhat revamped.
|
104
|
+
* No longer autogenerates test file.
|
105
|
+
* The .html files have been removed. You can generate the html on your own
|
106
|
+
if you like.
|
107
|
+
|
108
|
+
== 0.4.0 - 18-Sep-2003
|
109
|
+
* Added MS Windows support
|
110
|
+
* Changed some method names. The "cpu" has been dropped from most method
|
111
|
+
names. See documentation for details.
|
112
|
+
* The state() and freq() methods (where supported) now assume a default
|
113
|
+
value of zero.
|
114
|
+
* More unit tests added.
|
115
|
+
* Fixed minor issue with test.rb for those without TestUnit installed.
|
116
|
+
* Fixed issue with linux.rb file being auto-installed on non-Linux platforms.
|
117
|
+
* Minor API change for the load_avg() method on HP-UX. It now accepts a
|
118
|
+
CPU number as an argument.
|
119
|
+
|
120
|
+
== 0.3.1 - 16-Jul-2003
|
121
|
+
* Fixed a bug in the Solaris version that was using up and not
|
122
|
+
freeing file descriptors.
|
123
|
+
* Added html doc for Solaris under doc directory.
|
124
|
+
* Minor changes to test_hpux.rb and test_sunos.rb
|
125
|
+
* Minor README changes.
|
126
|
+
|
127
|
+
== 0.3.0 - 30-Jun-2003
|
128
|
+
* Added HP-UX support
|
129
|
+
* Removed the VERSION class method. Use the constant instead
|
130
|
+
* Changed license to "Artistic"
|
131
|
+
* Moved version info into its own file for convenience
|
132
|
+
* Some minor mods to the test suites
|
133
|
+
* Modified extconf.rb, moving some of the dynamic test generation
|
134
|
+
into separate files
|
135
|
+
|
136
|
+
== 0.2.2 - 25-Mar-2003
|
137
|
+
* fpu_type and cpu_type now return nil if not found (Solaris)
|
138
|
+
* CPUException is now a direct subclass of StandardError
|
139
|
+
* Modified extconf.rb script
|
140
|
+
* Minor doc updates
|
141
|
+
* Added another test to the solaris test suite
|
142
|
+
* Important note added to INSTALL file
|
143
|
+
|
144
|
+
== 0.2.1 - 12-Mar-2003
|
145
|
+
* Added the cpu_stats() class method for Linux, which contains the
|
146
|
+
data from the 'cpu' lines of /proc/stat
|
147
|
+
* Minor fix for extconf.rb (thanks Michael Granger)
|
148
|
+
* Some tests added to Linux test suite
|
149
|
+
* MANIFEST correction
|
150
|
+
|
151
|
+
== 0.2.0 - 13-Feb-2003
|
152
|
+
* Linux support added (pure Ruby only)
|
153
|
+
* Many changes to extconf.rb to support Linux version
|
154
|
+
* sys-uname prerequisite dropped
|
155
|
+
* rd2 documentation now kept separate from source
|
156
|
+
|
157
|
+
== 0.1.0 - 3-Feb-2003
|
158
|
+
* Initial release
|
159
|
+
* Currently supports Solaris (only)
|
data/MANIFEST
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
* install.rb
|
2
|
+
* MANIFEST
|
3
|
+
* CHANGES
|
4
|
+
* Rakefile
|
5
|
+
* README
|
6
|
+
* sys-cpu.gemspec
|
7
|
+
* doc/bsd.txt
|
8
|
+
* doc/hpux.txt
|
9
|
+
* doc/linux.txt
|
10
|
+
* doc/sunos.txt
|
11
|
+
* doc/windows.txt
|
12
|
+
* examples/example_sys_cpu_freebsd.rb
|
13
|
+
* examples/example_sys_cpu_hpux.rb
|
14
|
+
* examples/example_sys_cpu_linux.rb
|
15
|
+
* examples/example_sys_cpu_sunos.rb
|
16
|
+
* examples/example_sys_cpu_windows.rb
|
17
|
+
* ext/extconf.rb
|
18
|
+
* ext/version.h
|
19
|
+
* ext/bsd/bsd.c
|
20
|
+
* ext/hpux/hpux.c
|
21
|
+
* ext/sunos/sunos.c
|
22
|
+
* lib/linux/sys/cpu.rb
|
23
|
+
* lib/windows/sys/cpu.rb
|
24
|
+
* test/test_sys_cpu.rb
|
25
|
+
* test/test_sys_cpu_bsd.rb
|
26
|
+
* test/test_sys_cpu_hpux.rb
|
27
|
+
* test/test_sys_cpu_sunos.rb
|
28
|
+
* test/test_sys_cpu_linux.rb
|
29
|
+
* test/test_sys_cpu_windows.rb
|
data/README
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
= Description
|
2
|
+
A Ruby interface for getting cpu information.
|
3
|
+
|
4
|
+
= Installation
|
5
|
+
gem install sys-cpu
|
6
|
+
|
7
|
+
If that doesn't work try one of these:
|
8
|
+
|
9
|
+
gem install sys-cpu --platform linux # Linux
|
10
|
+
gem install sys-cpu --platform mingw32 # MS Windows
|
11
|
+
|
12
|
+
= Notes
|
13
|
+
== Solaris
|
14
|
+
Currently there is no 'processors()' iterative method for multi-cpu systems.
|
15
|
+
I plan to add it this in a future release.
|
16
|
+
|
17
|
+
== OS X
|
18
|
+
The CPU.model method returns very limited information. I do not yet know
|
19
|
+
how to get more detailed information.
|
20
|
+
|
21
|
+
== Linux
|
22
|
+
This is pure Ruby. This version reads information out of /proc/cpuinfo and
|
23
|
+
/proc/loadavg, so if /proc isn't mounted it won't work.
|
24
|
+
|
25
|
+
The key-value information in /proc/cpuinfo is stored internally (i.e. in
|
26
|
+
memory) as an array of hashes when you first 'require' this package. This
|
27
|
+
overhead is exceptionally minimal, given that your average cpuinfo file
|
28
|
+
contains less than 1k of text (and I don't store whitespace or newlines).
|
29
|
+
|
30
|
+
The text documentation for Linux is dynamically generated during the
|
31
|
+
build process because the fields vary depending on your setup. So, don't
|
32
|
+
look at it until *after* you've installed it. You will see a doc/linux.txt
|
33
|
+
file after you run 'rake install' (via install.rb).
|
34
|
+
|
35
|
+
== HP-UX
|
36
|
+
Unlike other platforms, you can get load averages for an individual cpu in
|
37
|
+
multi-cpu systems. See documentation for more details.
|
38
|
+
|
39
|
+
== MS Windows
|
40
|
+
This is a pure Ruby implementation using the win32ole package + WMI. The C
|
41
|
+
version has been scrapped.
|
42
|
+
|
43
|
+
As of version 0.5.0, the CPU.usage method has been removed in favor of the
|
44
|
+
CPU.load_avg method. This does not (currently) use a perf counter, so there
|
45
|
+
is no longer any delay. Also, the 'processors' method has been
|
46
|
+
added and the 'supported' method has been dropped. See the documentation
|
47
|
+
for other changes.
|
48
|
+
|
49
|
+
= Acknowledgements
|
50
|
+
Thanks go to the MPlayer team for some source code that helped me on
|
51
|
+
certain versions of FreeBSD.
|
52
|
+
|
53
|
+
= Known Bugs
|
54
|
+
None that I'm aware of. Please report bugs on the project page at
|
55
|
+
http://www.rubyforge.org/projects/sysutils.
|
56
|
+
|
57
|
+
= Future Plans
|
58
|
+
Add iterative CPU.processors method.
|
59
|
+
Add more information in general, such as what 'prtdiag' shows.
|
60
|
+
|
61
|
+
= License
|
62
|
+
Artistic 2.0
|
63
|
+
|
64
|
+
= Copyright
|
65
|
+
(C) 2003-2011 Daniel J. Berger, All Rights Reserved
|
66
|
+
|
67
|
+
= Warranty
|
68
|
+
This package is provided "as is" and without any express or
|
69
|
+
implied warranties, including, without limitation, the implied
|
70
|
+
warranties of merchantability and fitness for a particular purpose.
|
71
|
+
|
72
|
+
= Author
|
73
|
+
Daniel J. Berger
|
data/Rakefile
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/clean'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rbconfig'
|
5
|
+
include Config
|
6
|
+
|
7
|
+
CLEAN.include(
|
8
|
+
'**/*.gem', # Gem files
|
9
|
+
'**/*.rbc', # Rubinius
|
10
|
+
'ext/cpu.c', # Temporary file
|
11
|
+
'**/*.o', # C object file
|
12
|
+
'**/*.log', # Ruby extension build log
|
13
|
+
'**/Makefile', # C Makefile
|
14
|
+
'**/conftest.dSYM', # OS X build directory
|
15
|
+
"**/*.#{CONFIG['DLEXT']}" # C shared object
|
16
|
+
)
|
17
|
+
|
18
|
+
desc "Build the sys-cpu library on UNIX systems"
|
19
|
+
task :build => [:clean] do
|
20
|
+
Dir.chdir('ext') do
|
21
|
+
unless CONFIG['host_os'] =~ /mswin|win32|mingw|cygwin|dos|windows|linux/i
|
22
|
+
ruby 'extconf.rb'
|
23
|
+
sh 'make'
|
24
|
+
build_file = 'cpu.' + CONFIG['DLEXT']
|
25
|
+
Dir.mkdir('sys') unless File.exists?('sys')
|
26
|
+
FileUtils.cp(build_file, 'sys')
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
namespace 'gem' do
|
32
|
+
desc "Create the sys-cpu gem"
|
33
|
+
task :create => [:clean] do
|
34
|
+
spec = eval(IO.read('sys-cpu.gemspec'))
|
35
|
+
Gem::Builder.new(spec).build
|
36
|
+
end
|
37
|
+
|
38
|
+
desc "Install the sys-cpu gem"
|
39
|
+
task :install => [:create] do
|
40
|
+
file = Dir["*.gem"].first
|
41
|
+
sh "gem install #{file}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
desc "Run the example program"
|
46
|
+
task :example => [:build] do
|
47
|
+
Dir.mkdir('sys') unless File.exists?('sys')
|
48
|
+
if CONFIG['host_os'] =~ /mswin|win32|mingw|cygwin|dos|windows|linux/i
|
49
|
+
if CONFIG['host_os'].match('linux')
|
50
|
+
cp 'lib/linux/sys/cpu.rb', 'sys'
|
51
|
+
else
|
52
|
+
cp 'lib/windows/sys/cpu.rb', 'sys'
|
53
|
+
end
|
54
|
+
else
|
55
|
+
build_file = 'ext/cpu.' + CONFIG['DLEXT']
|
56
|
+
cp build_file, 'sys'
|
57
|
+
end
|
58
|
+
|
59
|
+
case CONFIG['host_os']
|
60
|
+
when /bsd|darwin|mach|osx/i
|
61
|
+
file = 'examples/example_sys_cpu_bsd.rb'
|
62
|
+
when /hpux/i
|
63
|
+
file = 'examples/example_sys_cpu_hpux.rb'
|
64
|
+
when /linux/i
|
65
|
+
file = 'examples/example_sys_cpu_linux.rb'
|
66
|
+
when /sunos|solaris/i
|
67
|
+
file = 'examples/example_sys_cpu_sunos.rb'
|
68
|
+
when /mswin|win32|cygwin|mingw|dos/i
|
69
|
+
file = 'examples/example_sys_cpu_windows.rb'
|
70
|
+
end
|
71
|
+
sh "ruby -I. -Iext -Ilib #{file}"
|
72
|
+
end
|
73
|
+
|
74
|
+
Rake::TestTask.new do |t|
|
75
|
+
if CONFIG['host_os'] =~ /mswin|win32|mingw|cygwin|dos|windows/i
|
76
|
+
t.libs << 'lib/windows'
|
77
|
+
elsif CONFIG['host_os'] =~ /linux/i
|
78
|
+
t.libs << 'lib/linux'
|
79
|
+
else
|
80
|
+
task :test => :build
|
81
|
+
t.libs << 'ext'
|
82
|
+
t.libs.delete('lib')
|
83
|
+
end
|
84
|
+
|
85
|
+
t.libs << 'test'
|
86
|
+
t.test_files = FileList['test/test_sys_cpu.rb']
|
87
|
+
end
|
88
|
+
|
89
|
+
task :default => :test
|
data/doc/bsd.txt
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
== Description
|
2
|
+
Sys::CPU - An interface for various cpu statistics
|
3
|
+
|
4
|
+
== Synopsis
|
5
|
+
require "sys/cpu"
|
6
|
+
include Sys
|
7
|
+
|
8
|
+
# BSD and OS X
|
9
|
+
puts "Architecture: " + CPU.architecture
|
10
|
+
puts "Machine: " + CPU.machine
|
11
|
+
puts "Mhz: " + CPU.cpu_freq.to_s
|
12
|
+
puts "Number of cpu's on this system: " + CPU.num_cpu.to_s
|
13
|
+
puts "CPU model: " + CPU.model
|
14
|
+
puts "Load averages: " + CPU.load_avg.join(", ")
|
15
|
+
|
16
|
+
== Constants
|
17
|
+
VERSION
|
18
|
+
Returns the current version number for this package.
|
19
|
+
|
20
|
+
== Class Methods
|
21
|
+
CPU.architecture
|
22
|
+
Returns the cpu's architecture.
|
23
|
+
|
24
|
+
CPU.freq
|
25
|
+
Returns an integer indicating the speed (i.e. frequency in Mhz) of
|
26
|
+
the cpu.
|
27
|
+
|
28
|
+
Not supported on OS X.
|
29
|
+
|
30
|
+
CPU.load_avg
|
31
|
+
Returns an array of three floats indicating the 1, 5 and 15 minute load
|
32
|
+
average.
|
33
|
+
|
34
|
+
CPU.machine
|
35
|
+
Returns the class of cpu (probably identical to the architecture).
|
36
|
+
|
37
|
+
CPU.model
|
38
|
+
Returns a string indicating the cpu model.
|
39
|
+
|
40
|
+
CPU.num_cpu
|
41
|
+
Returns an integer indicating the number of cpu's on the system.
|
42
|
+
|
43
|
+
== Error Classes
|
44
|
+
CPU::Error < StandardError
|
45
|
+
Raised is response to internal function errors, usually relating to an
|
46
|
+
invalid cpu number.
|
47
|
+
|
48
|
+
== More Information
|
49
|
+
See the README file for more information.
|
data/doc/hpux.txt
ADDED
@@ -0,0 +1,54 @@
|
|
1
|
+
== Description
|
2
|
+
Sys::CPU - An interface for various cpu statistics
|
3
|
+
|
4
|
+
== Synopsis
|
5
|
+
require "sys/cpu"
|
6
|
+
include Sys
|
7
|
+
|
8
|
+
puts "Mhz: " + CPU.cpu_freq.to_s
|
9
|
+
puts "State: " + CPU.state(0)
|
10
|
+
puts "Number of cpu's on this system: " + CPU.num_cpu.to_s
|
11
|
+
puts "Number of active cpu's: " + CPU.num_active_cpu.to_s
|
12
|
+
puts "Load averages: " + CPU.load_avg.join(", ")
|
13
|
+
|
14
|
+
== Constants
|
15
|
+
VERSION
|
16
|
+
Returns the current version number for this package.
|
17
|
+
|
18
|
+
== Class Methods
|
19
|
+
CPU.architecture
|
20
|
+
Returns the cpu architecture, e.g. PA RISC 1.2, etc.
|
21
|
+
|
22
|
+
CPU.freq(cpu_num=0)
|
23
|
+
Returns an integer indicating the speed (i.e. frequency in Mhz) of
|
24
|
+
the cpu.
|
25
|
+
|
26
|
+
CPU.load_avg
|
27
|
+
CPU.load_avg(cpu_num)
|
28
|
+
CPU.load_avg{ |cpu| ... }
|
29
|
+
|
30
|
+
In non-block form returns an array of three floats indicating the 1, 5
|
31
|
+
and 15 minute overall load average.
|
32
|
+
|
33
|
+
In block form, it returns an array of three floats indicating the 1, 5
|
34
|
+
and 15 minute load average for each cpu. Only useful on multi-cpu
|
35
|
+
systems.
|
36
|
+
|
37
|
+
If 'cpu_num' is provided, returns the load average (as a 3-element
|
38
|
+
array) for that cpu only.
|
39
|
+
|
40
|
+
You cannot provide a cpu number and use block form at the same time.
|
41
|
+
|
42
|
+
CPU.num_cpu
|
43
|
+
Returns an integer indicating the number of cpu's on the system.
|
44
|
+
|
45
|
+
CPU.num_active_cpu
|
46
|
+
Returns an integer indicating the number of active cpu's on the system.
|
47
|
+
|
48
|
+
== Error Classes
|
49
|
+
CPU::Error < StandardError
|
50
|
+
Raised is response to internal function errors, usually relating to an
|
51
|
+
invalid cpu number.
|
52
|
+
|
53
|
+
== More Information
|
54
|
+
See the README file for more information.
|