sys-cpu 0.5.4

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES ADDED
@@ -0,0 +1,103 @@
1
+ == 0.5.4 - 12-Jul-2006
2
+ * Added a gemspec (and a gem on RubyForge).
3
+ * The CPU.architecture method on HP-UX now returns nil if it cannot be
4
+ determined instead of "Unknown" for consistency with the other
5
+ platforms.
6
+ * Inlined the RDoc and made some minor cosmetic source code changes.
7
+
8
+ == 0.5.3 - 4-May-2006
9
+ * Fixed in a bug in the Solaris version where CPU.load_avg returned bad values
10
+ when compiled in 64 bit mode. Thanks go to James Hranicky for the spot and
11
+ both James Hranicky and Peter Tribble (via comp.unix.solaris) for patches.
12
+ * Made some modifications to the test suite. You know longer need to know
13
+ which test suite to run. All platforms now use 'ts_all.rb', which will run
14
+ the appropriate test case behind the scenes.
15
+
16
+ == 0.5.2 - 24-Jun-2005
17
+ * Bug fixed on Linux where empty lines could cause problems. This affected
18
+ both the install.rb and linux.rb files, though it only seems to have been
19
+ an issue on the 2.6+ kernel.
20
+ * Altered the behavior of the CPU.cpu_stats method on Linux. Now, only the
21
+ numbered cpu entries return associated data, unless the numberless entry
22
+ is the only entry.
23
+ * Added a sample program for Linux under the 'examples' directory.
24
+
25
+ == 0.5.1 - 5-May-2005
26
+ * Fixed a potential bug in the FreeBSD version of CPU.model.
27
+ * Eliminated some warnings in the FreeBSD version.
28
+ * Moved examples directory to the toplevel package directory.
29
+ * Renamed and updated the sample scripts.
30
+ * Added a sample script for FreeBSD.
31
+ * Removed the INSTALL file. That information is now included in the README.
32
+ * Made the CHANGES, README, and .txt files rdoc friendly.
33
+ * The dynamic documentation generation for Linux has been altered. Anything
34
+ relating to rd2 has been removed. The doc file generated is now
35
+ doc/linux.txt.
36
+ * Some $LOAD_PATH setup changes in the unit tests.
37
+
38
+ == 0.5.0 - 26-Jun-2004
39
+ * Now requires Ruby 1.8.0 or later.
40
+ * FreeBSD support added.
41
+ * Replaced 'CPUException' with 'CPUError'
42
+ * The MS Windows version has been completely revamped to use WMI instead of
43
+ the C API. Some method names have changed and some methods have been
44
+ dropped entirely. Please see the documentation for details.
45
+ * Corresponding documentation updates and test suite changes.
46
+ * Sample programs have been moved to doc/examples.
47
+ * Installation procedure somewhat revamped.
48
+ * No longer autogenerates test file.
49
+ * The .html files have been removed. You can generate the html on your own
50
+ if you like.
51
+
52
+ == 0.4.0 - 18-Sep-2003
53
+ * Added MS Windows support
54
+ * Changed some method names. The "cpu" has been dropped from most method
55
+ names. See documentation for details.
56
+ * The state() and freq() methods (where supported) now assume a default
57
+ value of zero.
58
+ * More unit tests added.
59
+ * Fixed minor issue with test.rb for those without TestUnit installed.
60
+ * Fixed issue with linux.rb file being auto-installed on non-Linux platforms.
61
+ * Minor API change for the load_avg() method on HP-UX. It now accepts a
62
+ CPU number as an argument.
63
+
64
+ == 0.3.1 - 16-Jul-2003
65
+ * Fixed a bug in the Solaris version that was using up and not
66
+ freeing file descriptors.
67
+ * Added html doc for Solaris under doc directory.
68
+ * Minor changes to test_hpux.rb and test_sunos.rb
69
+ * Minor README changes.
70
+
71
+ == 0.3.0 - 30-Jun-2003
72
+ * Added HP-UX support
73
+ * Removed the VERSION class method. Use the constant instead
74
+ * Changed license to "Artistic"
75
+ * Moved version info into its own file for convenience
76
+ * Some minor mods to the test suites
77
+ * Modified extconf.rb, moving some of the dynamic test generation
78
+ into separate files
79
+
80
+ == 0.2.2 - 25-Mar-2003
81
+ * fpu_type and cpu_type now return nil if not found (Solaris)
82
+ * CPUException is now a direct subclass of StandardError
83
+ * Modified extconf.rb script
84
+ * Minor doc updates
85
+ * Added another test to the solaris test suite
86
+ * Important note added to INSTALL file
87
+
88
+ == 0.2.1 - 12-Mar-2003
89
+ * Added the cpu_stats() class method for Linux, which contains the
90
+ data from the 'cpu' lines of /proc/stat
91
+ * Minor fix for extconf.rb (thanks Michael Granger)
92
+ * Some tests added to Linux test suite
93
+ * MANIFEST correction
94
+
95
+ == 0.2.0 - 13-Feb-2003
96
+ * Linux support added (pure Ruby only)
97
+ * Many changes to extconf.rb to support Linux version
98
+ * sys-uname prerequisite dropped
99
+ * rd2 documentation now kept separate from source
100
+
101
+ == 0.1.0 - 3-Feb-2003
102
+ * Initial release
103
+ * Currently supports Solaris (only)
data/README ADDED
@@ -0,0 +1,51 @@
1
+ == Description
2
+ A Ruby interface for getting cpu information.
3
+
4
+ == Installation
5
+ === Linux and Windows:
6
+ ruby test/ts_all.rb (optional)
7
+ ruby install.rb
8
+
9
+ === All other platforms:
10
+ ruby extconf.rb
11
+ make
12
+ ruby test/ts_all.rb (optional)
13
+ make site-install
14
+
15
+ == Notes
16
+ === All Platforms
17
+ As of version 0.5.0 Ruby 1.8.0 or later is required. It may work with
18
+ earlier versions, but I will not support it. In addition, a test file is
19
+ no longer auto-generated for you. If wish to run the test suite, cd to the
20
+ 'test' directory and run the test suite appropriate for your platform.
21
+
22
+ === Solaris
23
+ Currently there is no 'processors()' iterative method for multi-cpu systems.
24
+ I plan to add it this in a future release.
25
+
26
+ === Linux
27
+ This is pure Ruby. This version reads information out of /proc/cpuinfo and
28
+ /proc/loadavg, so if /proc isn't mounted it won't work.
29
+
30
+ The key-value information in /proc/cpuinfo is stored internally (i.e. in
31
+ memory) as an array of hashes when you first 'require' this package. This
32
+ overhead is exceptionally minimal, given that your average cpuinfo file
33
+ contains less than 1k of text (and I don't store whitespace or newlines).
34
+
35
+ The text documentation for Linux is dynamically generating during the
36
+ build process. So, don't look at it until *after* you've run make. :)
37
+ You will see a doc/linux.txt file after you run install.rb.
38
+
39
+ === HP-UX
40
+ Unlike other platforms, you can get load averages for an individual cpu (in
41
+ multi-cpu systems). See documentation for more details.
42
+
43
+ === Win32
44
+ This is a pure Ruby implementation using the win32ole package + WMI. The C
45
+ version has been scrapped.
46
+
47
+ As of version 0.5.0, the CPU.usage method has been removed in favor of the
48
+ CPU.load_avg method. This does not (currently) use a perf counter, so there
49
+ is no longer any delay. Also, the 'processors' method has been
50
+ added and the 'supported' method has been dropped. See the documentation
51
+ for other changes.
data/doc/freebsd.txt ADDED
@@ -0,0 +1,65 @@
1
+ == Description
2
+ Sys::CPU - An interface for various cpu statistics
3
+
4
+ == Synopsis
5
+ require "sys/cpu"
6
+ include Sys
7
+
8
+ # FreeBSD
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
+ CPU.load_avg
29
+ Returns an array of three floats indicating the 1, 5 and 15 minute load
30
+ average.
31
+
32
+ CPU.machine
33
+ Returns the class of cpu (probably identical to the architecture).
34
+
35
+ CPU.model
36
+ Returns a string indicating the cpu model.
37
+
38
+ CPU.num_cpu
39
+ Returns an integer indicating the number of cpu's on the system.
40
+
41
+ == Error Classes
42
+ CPUError < StandardError
43
+ Raised is response to internal function errors, usually relating to an
44
+ invalid cpu number.
45
+
46
+ == Known Bugs
47
+ None known. Please post bug reports to the SourceForge home page at
48
+ http://www.rubyforge.org/projects/sysutils
49
+
50
+ == Copyright
51
+ (C) 2003-2005 Daniel J. Berger
52
+ All Rights Reserved
53
+
54
+ == Warranty
55
+ This package is provided "as is" and without any express or
56
+ implied warranties, including, without limitation, the implied
57
+ warranties of merchantability and fitness for a particular purpose.
58
+
59
+ == License
60
+ Ruby's
61
+
62
+ == Author
63
+ Daniel J. Berger
64
+ djberg96 at yahoo dot com
65
+ imperator/rubyhacker1 on IRC (Freenode)
data/doc/hpux.txt ADDED
@@ -0,0 +1,75 @@
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
+ CPUError < StandardError
50
+ Raised is response to internal function errors, usually relating to an
51
+ invalid cpu number.
52
+
53
+ == Known Bugs
54
+ No bugs known. Please log any bugs at
55
+ http://www.rubyforge.org/projects/sysutils
56
+
57
+ == Future Plans
58
+ Add cpu model and type
59
+
60
+ == Copyright
61
+ (C) 2003-2005 Daniel J. Berger
62
+ All Rights Reserved
63
+
64
+ == Warranty
65
+ This package is provided "as is" and without any express or
66
+ implied warranties, including, without limitation, the implied
67
+ warranties of merchantability and fitness for a particular purpose.
68
+
69
+ == License
70
+ Ruby's
71
+
72
+ == Author
73
+ Daniel J. Berger
74
+ djberg96 at yahoo dot com
75
+ imperator/rubyhacker1 on IRC (Freenode)
data/doc/linux.txt ADDED
@@ -0,0 +1,41 @@
1
+ == Description
2
+ Sys::CPU - An interface for various cpu statistics
3
+
4
+ == Synopsis
5
+ require "sys/cpu"
6
+ include Sys
7
+
8
+ CPU.processors{ |cs|
9
+ cs.members.each{ |m|
10
+ puts "#{m}: " + cs[m].to_s
11
+ }
12
+ }
13
+
14
+ CPU.bogomips(1) # -> returns bogomips for cpu #2
15
+
16
+ == Notes
17
+ Portions of this documentation built dynamically
18
+
19
+ == Constants
20
+ VERSION
21
+ Returns the current version number for this package as a String.
22
+
23
+ == Class Methods
24
+ CPU.load_avg
25
+ Returns an array of three floats indicating the 1, 5 and 15 minute load
26
+ average.
27
+
28
+ CPU.cpu_stats
29
+ Returns a hash, with the cpu number as the key and an array as the value.
30
+ The array contains the number of seconds that the system spent in
31
+ user mode, user mode with low priority (nice), system mode, and the
32
+ idle task, respectively, for that cpu.
33
+
34
+ CPU.processors{ |cpu struct| block }
35
+ Calls the block for each processor on your system, passing a CPUStruct as the
36
+ parameter.
37
+
38
+ The exact members of the CPUStruct are the same as the class method names, except
39
+ for CPU.processors (although you may optionally omit the "?" when referring to a
40
+ struct member). These were determined when you installed this package because they
41
+ vary from one chip architecture to another.
data/doc/sunos.txt ADDED
@@ -0,0 +1,76 @@
1
+ == Description
2
+ Sys::CPU - An interface for various cpu statistics
3
+
4
+ == Synopsis
5
+ require "sys/cpu"
6
+ include Sys
7
+
8
+ # Solaris
9
+ puts "Mhz: " + CPU.cpu_freq(0).to_s
10
+ puts "State: " + CPU.state(0)
11
+ puts "Number of cpu's on this system: " + CPU.num_cpu.to_s
12
+ puts "CPU type: " + CPU.type
13
+ puts "FPU type: " + CPU.fpu_type
14
+ puts "CPU model: " + CPU.model
15
+ puts "Load averages: " + CPU.load_avg.join(", ")
16
+
17
+ == Constants
18
+ VERSION
19
+ Returns the current version number for this package.
20
+
21
+ == Class Methods
22
+ CPU.freq(cpu_num=0)
23
+ Returns an integer indicating the speed (i.e. frequency in Mhz) of
24
+ 'cpu_num', or CPU 0 if no number is provided.
25
+
26
+ CPU.type
27
+ Returns a string indicating the type of processor. This is the
28
+ architecture (e.g. sparcv9), not the exact model (e.g. Ultra-IIe).
29
+ Returns nil if not found.
30
+
31
+ CPU.fpu_type
32
+ Returns a string indicating the type of floating point unit, or nil if
33
+ not found.
34
+
35
+ CPU.load_avg
36
+ Returns an array of three floats indicating the 1, 5 and 15 minute load
37
+ average.
38
+
39
+ CPU.model
40
+ Returns a string indicating the cpu model. For now, this is the
41
+ architecture type, rather than the exact model. However, see the
42
+ 'Future Plans' section below.
43
+
44
+ CPU.num_cpu
45
+ Returns an integer indicating the number of cpu's on the system.
46
+
47
+ CPU.state(cpu_num)
48
+ Returns a string indicating the cpu state of 'cpu_num'.
49
+
50
+ == Error Classes
51
+ CPUError < StandardError
52
+ Raised is response to internal function errors, usually relating to an
53
+ invalid cpu number.
54
+
55
+ == Known Bugs
56
+ None known. Please post bug reports to the SourceForge home page at
57
+ http://www.rubyforge.org/projects/sysutils
58
+
59
+ == Future Plans
60
+ Add more information, such as what prtdiag shows.
61
+ Get the model() method to display more specific information.
62
+
63
+ == Copyright
64
+ (C) 2003-2006 Daniel J. Berger
65
+ 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
+ == License
73
+ Ruby's
74
+
75
+ == Author
76
+ Daniel J. Berger
data/doc/windows.txt ADDED
@@ -0,0 +1,152 @@
1
+ == Description
2
+ Sys::CPU - An interface for various cpu statistics
3
+
4
+ == Synopsis
5
+ require "sys/cpu"
6
+ include Sys
7
+
8
+ CPU.processors{ |cs|
9
+ cs.members.each{ |m|
10
+ puts "#{m}: " + cs[m].to_s
11
+ }
12
+ }
13
+
14
+ puts "CPU Speed (Frequency): " + CPU.freq(0).to_s
15
+ puts "Load avg: " + CPU.load_avg.to_s
16
+ puts "Num CPU: " + CPU.num_cpu.to_s
17
+ puts "Type: " + CPU.type
18
+ puts "Model: " + CPU.model
19
+ puts "Architecture: " + CPU.architecture
20
+
21
+ == Constants
22
+ VERSION
23
+ Returns the current version number for this package.
24
+
25
+ == Class Methods
26
+ CPU.architecture(host=localhost)
27
+ Returns the architecture of the cpu, e.g. x86 Family 15 Model 2
28
+
29
+ CPU.freq(cpu_num=0, host=localhost)
30
+ Returns an integer indicating the speed (i.e. frequency in Mhz) of
31
+ 'cpu_num'. If cpu_num+1 is greater than the number of cpu's on
32
+ your system, or this call fails for any other reason, a CPUError
33
+ is raised.
34
+
35
+ CPU.load_avg(host=localhost)
36
+ Returns the load capacity of each processor, averaged to the last second.
37
+ Processor loading refers to the total computing burden for each
38
+ processor at one time.
39
+
40
+ Note that this attribute is actually the LoadPercentage. I may use
41
+ one of the Win32_Perf* classes in the future.
42
+
43
+ CPU.model(host=localhost)
44
+ Returns a string indicating the cpu model, e.g. Intel Pentium 4
45
+
46
+ CPU.num_cpu(host=localhost)
47
+ Returns an integer indicating the number of cpu's on the system.
48
+
49
+ CPU.processors(host=localhost){ |cpu| ... }
50
+ Returns a CPUStruct for each CPU on the system containing the following
51
+ members:
52
+
53
+ * address_width
54
+ * architecture
55
+ * availability
56
+ * caption
57
+ * config_manager_error_code
58
+ * config_manager_user_config
59
+ * cpu_status
60
+ * creation_class_name
61
+ * freq
62
+ * voltage
63
+ * data_width
64
+ * description
65
+ * device_id
66
+ * error_cleared?
67
+ * error_description
68
+ * ext_clock
69
+ * family
70
+ * install_date
71
+ * l2_cache_size
72
+ * l2_cache_speed
73
+ * last_error_code
74
+ * level
75
+ * load_avg
76
+ * manufacturer
77
+ * max_clock_speed
78
+ * name
79
+ * other_family_description
80
+ * pnp_device_id
81
+ * power_management_supported?
82
+ * power_management_capabilities
83
+ * processor_id
84
+ * processor_type
85
+ * revision
86
+ * role
87
+ * socket_designation
88
+ * status
89
+ * status_info
90
+ * stepping
91
+ * system_creation_class_name
92
+ * system_name
93
+ * unique_id
94
+ * upgrade_method
95
+ * version
96
+ * voltage_caps
97
+
98
+ Note that not all of these members will necessarily be defined. See the
99
+ NOTES section below.
100
+
101
+ CPU.type(host=localhost)
102
+ Returns a string indicating the type of processor, e.g. GenuineIntel.
103
+
104
+ == Exception Classes
105
+ CPUError < StandardError
106
+ Raised is response to internal function errors, most likely to be raised
107
+ in the event that in invalid cpu number is provided for the 'freq'
108
+ method.
109
+
110
+ == Notes
111
+ Some of the CPUStruct members may be nil. As far as I can tell, this
112
+ means that Windows is unable to determine the value for the attribute due
113
+ to your BIOS and/or BIOS settings. There is nothing clear in the
114
+ documentation I could find for this, however.
115
+
116
+ The 'family' attribute may contain the trademark symbol.
117
+
118
+ The 'status_info' attribute was not converted to a string because the
119
+ 'status' attribute already is a string. I'm not even sure why MS has both
120
+ versions.
121
+
122
+ The 'system_name' attribute appears to be the hostname. I have no idea
123
+ why this is included as part of the CPU information, but there you go.
124
+
125
+ See http://tinyurl.com/2mros (and click on 'Win32_Processor' in the left
126
+ frame) for a list of attributes and their meaning. Link courtesy of
127
+ tinyurl.com.
128
+
129
+ == Known Bugs
130
+ No bugs known. Please log any bugs at
131
+ http://www.rubyforge.org/projects/sysutils
132
+
133
+ == Future Plans
134
+ Add more detailed CPU usage information via the
135
+ Win32_PerfFormattedData_PerfOS_Processor class.
136
+
137
+ == Copyright
138
+ (C) 2003-2004 Daniel J. Berger
139
+ All Rights Reserved
140
+
141
+ == Warranty
142
+ This package is provided "as is" and without any express or
143
+ implied warranties, including, without limitation, the implied
144
+ warranties of merchantability and fitness for a particular purpose.
145
+
146
+ == License
147
+ Ruby's
148
+
149
+ == Author
150
+ Daniel J. Berger
151
+ djberg96 at yahoo dot com
152
+ imperator/rubyhacker1 on IRC (Freenode)
data/extconf.rb ADDED
@@ -0,0 +1,36 @@
1
+ require "mkmf"
2
+ require "ftools"
3
+
4
+ # Linux and Windows should use install.rb instead
5
+ if RUBY_PLATFORM =~ /windows|win32|mingw|cygwin|dos|linux/
6
+ STDERR.puts "For this platform, run 'ruby install.rb' instead"
7
+ STDERR.puts "Exiting..."
8
+ exit
9
+ end
10
+
11
+ # Move any .rb files to .orig to prevent them from being installed
12
+ # during make site-install.
13
+ File.move("lib/sys/linux.rb","lib/sys/linux.orig") rescue nil
14
+ File.move("lib/sys/windows.rb","lib/sys/windows.orig") rescue nil
15
+
16
+ File.delete('cpu.c') if File.exists?('cpu.c')
17
+
18
+ case RUBY_PLATFORM
19
+ when /hpux/i
20
+ File.symlink("lib/sys/hpux.c", "cpu.c")
21
+ create_makefile("sys/cpu")
22
+ when /sunos|solaris/i
23
+ File.symlink("lib/sys/sunos.c", "cpu.c")
24
+ unless have_func("getloadavg")
25
+ have_library("kstat")
26
+ end
27
+ create_makefile("sys/cpu")
28
+ when /freebsd/i
29
+ File.symlink("lib/sys/freebsd.c", "cpu.c")
30
+ have_library("kvm")
31
+ create_makefile("sys/cpu")
32
+ when /linux|dos|windows|win32|mingw|cygwin/i
33
+ STDERR.puts "Run 'ruby install.rb' instead for this platform"
34
+ else
35
+ STDERR.puts "This platform is not currently supported. Exiting..."
36
+ end
data/lib/sys/sunos.c ADDED
@@ -0,0 +1,278 @@
1
+ /*****************************************************************************
2
+ * sunos.c (cpu.c) - Solaris code sys-cpu
3
+ *
4
+ * Interface to provide various types of cpu information.
5
+ * Based on the Unix::Processors Perl module (Wilson Snyder) with ideas from
6
+ * Sys::CPU (Matt Sanford) and Solaris::Kstat (Alan Burlison) as well.
7
+ *
8
+ * The kstat code for load_avg() was taken largely from a post by Casper Dik
9
+ * on comp.unix.solaris.
10
+ *****************************************************************************/
11
+ #include "ruby.h"
12
+ #include "lib/version.h"
13
+ #include <unistd.h>
14
+ #include <sys/types.h>
15
+ #include <sys/processor.h>
16
+ #include <sys/utsname.h>
17
+ #include <sys/param.h>
18
+ #include <kstat.h>
19
+
20
+ #ifdef HAVE_GETLOADAVG
21
+ #include <sys/loadavg.h>
22
+ #endif
23
+
24
+ /* Missing in older header files */
25
+ #ifndef P_POWEROFF
26
+ #define P_POWEROFF 5
27
+ #endif
28
+
29
+ #ifdef __cplusplus
30
+ extern "C"
31
+ {
32
+ #endif
33
+
34
+ VALUE cCPUError;
35
+
36
+ /*
37
+ * call-seq:
38
+ * CPU.freq(cpu_num=0)
39
+ *
40
+ * Returns an integer indicating the speed (i.e. frequency in Mhz) of
41
+ * +cpu_num+, or CPU 0 (zero) if no number is provided. If you provide an
42
+ * invalid CPU number then a CPUError is raised.
43
+ */
44
+ static VALUE cpu_freq(int argc, VALUE *argv)
45
+ {
46
+ int ncpu = 0; /* Default value */
47
+ int cpu;
48
+ int last_cpu = 0;
49
+ int clock = 0;
50
+ processor_info_t pi;
51
+ VALUE cpu_num = Qnil;
52
+
53
+ rb_scan_args(argc, argv, "01", &cpu_num);
54
+
55
+ if(cpu_num != Qnil)
56
+ ncpu = NUM2INT(cpu_num);
57
+
58
+ for(cpu = ncpu; cpu < last_cpu+16; cpu++) {
59
+ if(processor_info(cpu, &pi) == 0 && pi.pi_state == P_ONLINE){
60
+ if(clock < pi.pi_clock){
61
+ clock = pi.pi_clock;
62
+ }
63
+ last_cpu = cpu;
64
+ }
65
+ }
66
+
67
+ if(clock == 0)
68
+ rb_raise(cCPUError, "Invalid CPU number?");
69
+
70
+ return INT2NUM(clock);
71
+ }
72
+
73
+ /*
74
+ * call-seq:
75
+ * CPU.state(cpu_num=0)
76
+ *
77
+ * Returns a string indicating the cpu state of +cpu_num+, or CPU 0 if no
78
+ * number is specified. Raises a CPUError if an invalid +cpu_num+ is provided.
79
+ */
80
+ static VALUE cpu_state(int argc, VALUE *argv)
81
+ {
82
+ int cpu = 0; /* Default value */
83
+ char* value = NULL;
84
+ processor_info_t pi;
85
+ VALUE cpu_num = Qnil;
86
+
87
+ rb_scan_args(argc, argv, "01", &cpu_num);
88
+
89
+ if(cpu_num != Qnil)
90
+ cpu = NUM2INT(cpu_num);
91
+
92
+ if(processor_info(cpu, &pi) == 0){
93
+ switch (pi.pi_state)
94
+ {
95
+ case P_ONLINE:
96
+ value = "online";
97
+ break;
98
+ case P_OFFLINE:
99
+ value = "offline";
100
+ break;
101
+ case P_POWEROFF:
102
+ value = "poweroff";
103
+ break;
104
+ default:
105
+ value = "unknown";
106
+ }
107
+ }
108
+ else{
109
+ rb_raise(cCPUError, "state() call failed - invalid cpu num?");
110
+ }
111
+
112
+ return rb_str_new2(value);
113
+ }
114
+
115
+ /*
116
+ * call-seq:
117
+ * CPU.num_cpu
118
+ *
119
+ * Returns the number of CPU's on your system.
120
+ */
121
+ static VALUE cpu_num()
122
+ {
123
+ int num_cpu;
124
+ num_cpu = sysconf(_SC_NPROCESSORS_ONLN);
125
+ return INT2NUM(num_cpu);
126
+ }
127
+
128
+ /*
129
+ * call-seq:
130
+ * CPU.type
131
+ *
132
+ * Returns a string indicating the type of processor. This is the
133
+ * architecture (e.g. sparcv9), not the exact model (e.g. Ultra-IIe).
134
+ * Returns nil if not found.
135
+ *--
136
+ * All cpu must be the same type (right?)
137
+ */
138
+ static VALUE cpu_type()
139
+ {
140
+ int cpu = 0;
141
+ char* value = NULL;
142
+ processor_info_t pi;
143
+
144
+ /* Some systems start the cpu num at 0, others start at 1 */
145
+ if(processor_info(cpu, &pi) == 0)
146
+ value = pi.pi_processor_type;
147
+ else if(processor_info(cpu+1, &pi) == 0)
148
+ value = pi.pi_processor_type;
149
+ else
150
+ return Qnil;
151
+
152
+ return rb_str_new2(value);
153
+ }
154
+
155
+ /*
156
+ * call-seq:
157
+ * CPU.fpu_type
158
+ *
159
+ * Returns a string indicating the type of floating point unit, or nil if
160
+ * not found.
161
+ */
162
+ static VALUE cpu_fpu_type()
163
+ {
164
+ int cpu = 0;
165
+ char* value = NULL;
166
+ processor_info_t pi;
167
+
168
+ /* Some systems start the cpu num at 0, others start at 1 */
169
+ if(processor_info(cpu, &pi) == 0)
170
+ value = pi.pi_fputypes;
171
+ else if(processor_info(cpu+1, &pi) == 0)
172
+ value = pi.pi_fputypes;
173
+ else
174
+ return Qnil;
175
+
176
+ return rb_str_new2(value);
177
+ }
178
+
179
+ /*
180
+ * call-seq:
181
+ * CPU.model
182
+ *
183
+ * Returns a string indicating the cpu model. For now, this is the
184
+ * architecture type, rather than the exact model.
185
+ */
186
+ static VALUE cpu_model()
187
+ {
188
+ struct utsname u;
189
+ uname(&u);
190
+ return rb_str_new2(u.machine);
191
+ }
192
+
193
+ /*
194
+ * call-seq:
195
+ * CPU.load_avg
196
+ *
197
+ * Returns an array of 3 floats, the load averages for the last 1, 5 and 15
198
+ * minutes.
199
+ */
200
+ static VALUE cpu_load_avg()
201
+ {
202
+ VALUE la_ary = rb_ary_new();
203
+
204
+ #ifdef HAVE_GETLOADAVG
205
+ double load_avg[3];
206
+
207
+ if(getloadavg(load_avg, sizeof(load_avg)) < 0)
208
+ rb_raise(cCPUError, "getloadavg() error");
209
+
210
+ rb_ary_push(la_ary, rb_float_new(load_avg[0]));
211
+ rb_ary_push(la_ary, rb_float_new(load_avg[1]));
212
+ rb_ary_push(la_ary, rb_float_new(load_avg[2]));
213
+ #else
214
+ kstat_ctl_t* kc;
215
+ kstat_t* ksp;
216
+ kstat_named_t* kn1;
217
+ kstat_named_t* kn5;
218
+ kstat_named_t* kn15;
219
+
220
+ kc = kstat_open();
221
+
222
+ if(kc == 0)
223
+ rb_raise(cCPUError, "kstat_open() error");
224
+
225
+ ksp = kstat_lookup(kc, "unix", 0, "system_misc");
226
+
227
+ if(ksp == 0)
228
+ rb_raise(cCPUError, "kstat_lookup() error");
229
+
230
+ if(kstat_read(kc,ksp,0) == -1)
231
+ rb_raise(cCPUError, "kstat_read() error");
232
+
233
+ kn1 = kstat_data_lookup(ksp, "avenrun_1min");
234
+ kn5 = kstat_data_lookup(ksp, "avenrun_5min");
235
+ kn15 = kstat_data_lookup(ksp, "avenrun_15min");
236
+
237
+ if( (kn1 == 0) || (kn5 == 0) || (kn15 == 0) )
238
+ rb_raise(cCPUError, "kstat_lookup() error");
239
+
240
+ rb_ary_push(la_ary, rb_float_new((double)kn1->value.ui32/FSCALE));
241
+ rb_ary_push(la_ary, rb_float_new((double)kn5->value.ui32/FSCALE));
242
+ rb_ary_push(la_ary, rb_float_new((double)kn15->value.ui32/FSCALE));
243
+
244
+ kstat_close(kc);
245
+ #endif
246
+
247
+ return la_ary;
248
+ }
249
+
250
+ /*
251
+ * Provides information about your CPU, including load average information.
252
+ */
253
+ void Init_cpu()
254
+ {
255
+ VALUE sys_mSys, cCPU;
256
+
257
+ /* Modules and Classes */
258
+ sys_mSys = rb_define_module("Sys");
259
+ cCPU = rb_define_class_under(sys_mSys, "CPU", rb_cObject);
260
+ cCPUError = rb_define_class_under(sys_mSys, "CPUError", rb_eStandardError);
261
+
262
+ /* Constants */
263
+ rb_define_const(cCPU, "VERSION", rb_str_new2(SYS_CPU_VERSION));
264
+
265
+ /* Class Methods */
266
+ rb_define_singleton_method(cCPU, "freq", cpu_freq, -1);
267
+ rb_define_singleton_method(cCPU, "state", cpu_state, -1);
268
+ rb_define_singleton_method(cCPU, "num_cpu", cpu_num, 0);
269
+ rb_define_singleton_method(cCPU, "type", cpu_type, 0);
270
+ rb_define_singleton_method(cCPU, "fpu_type", cpu_fpu_type, 0);
271
+ rb_define_singleton_method(cCPU, "model", cpu_model, 0);
272
+ rb_define_singleton_method(cCPU, "load_avg", cpu_load_avg, 0);
273
+
274
+ }
275
+
276
+ #ifdef __cplusplus
277
+ }
278
+ #endif
data/lib/version.h ADDED
@@ -0,0 +1,2 @@
1
+ /* version.h - one version to rule them all */
2
+ #define SYS_CPU_VERSION "0.5.4"
@@ -0,0 +1,71 @@
1
+ ###########################################################
2
+ # tc_freebsd.rb
3
+ #
4
+ # Test suite for sys-cpu on FreeBSD. This should only be
5
+ # run *after* the make process.
6
+ ###########################################################
7
+ base = File.basename(Dir.pwd)
8
+ if base == "test" || base =~ /sys-cpu/
9
+ require "ftools"
10
+ Dir.chdir ".." if base == "test"
11
+
12
+ Dir.mkdir("sys") unless File.exist?("sys")
13
+
14
+ if File.exist?("cpu.so")
15
+ File.copy("cpu.so","sys")
16
+ else
17
+ puts "No cpu.so file found. Please run extconf.rb and make first"
18
+ exit
19
+ end
20
+
21
+ $LOAD_PATH.unshift Dir.pwd
22
+ end
23
+
24
+ require "sys/cpu"
25
+ require "test/unit"
26
+ include Sys
27
+
28
+ class TC_FreeBSD < Test::Unit::TestCase
29
+ def test_architecture
30
+ assert_respond_to(CPU, :architecture)
31
+ assert_nothing_raised{ CPU.architecture }
32
+ assert_kind_of(String,CPU.architecture)
33
+ assert_raises(ArgumentError){ CPU.architecture(0) }
34
+ end
35
+
36
+ def test_cpu_freq
37
+ assert_respond_to(CPU, :freq)
38
+ assert_nothing_raised{ CPU.freq }
39
+ assert_kind_of(Integer,CPU.freq)
40
+ assert_raises(ArgumentError){ CPU.freq(0) }
41
+ end
42
+
43
+ def test_load_avg
44
+ assert_respond_to(CPU, :load_avg)
45
+ assert_nothing_raised{ CPU.load_avg }
46
+ assert_kind_of(Array,CPU.load_avg)
47
+ assert_equal(3,CPU.load_avg.length)
48
+ assert_raises(ArgumentError){ CPU.load_avg(0) }
49
+ end
50
+
51
+ def test_machine
52
+ assert_respond_to(CPU, :machine)
53
+ assert_nothing_raised{ CPU.machine }
54
+ assert_kind_of(String,CPU.machine)
55
+ assert_raises(ArgumentError){ CPU.machine(0) }
56
+ end
57
+
58
+ def test_model
59
+ assert_respond_to(CPU, :model)
60
+ assert_nothing_raised{ CPU.model }
61
+ assert_kind_of(String,CPU.model)
62
+ assert_raises(ArgumentError){ CPU.model(0) }
63
+ end
64
+
65
+ def test_num_cpu
66
+ assert_respond_to(CPU, :num_cpu)
67
+ assert_nothing_raised{ CPU.num_cpu }
68
+ assert_kind_of(Integer,CPU.num_cpu)
69
+ assert_raises(ArgumentError){ CPU.num_cpu(0) }
70
+ end
71
+ end
data/test/tc_hpux.rb ADDED
@@ -0,0 +1,63 @@
1
+ ####################################################
2
+ # tc_hpux.rb
3
+ #
4
+ # Test suite for the HP-UX platform. Note that this should only
5
+ # be run *after* the make process.
6
+ ####################################################
7
+ base = File.basename(Dir.pwd)
8
+ if base == "test" || base =~ /sys-cpu/
9
+ require "ftools"
10
+ Dir.chdir ".." if base == "test"
11
+
12
+ Dir.mkdir("sys") unless File.exists?("sys")
13
+ if File.exist?("cpu.sl")
14
+ File.copy("cpu.sl","sys")
15
+ else
16
+ puts "No cpu.sl file found. Please run extconf.rb and make first"
17
+ exit
18
+ end
19
+ $LOAD_PATH.unshift Dir.pwd
20
+ end
21
+
22
+ require "sys/cpu"
23
+ require "test/unit"
24
+ include Sys
25
+
26
+ class TC_HPUX < Test::Unit::TestCase
27
+ def test_cpu_freq
28
+ assert_respond_to(CPU, :freq)
29
+ assert_nothing_raised{ CPU.freq }
30
+ assert_nothing_raised{ CPU.freq(0) }
31
+ assert_kind_of(Integer,CPU.freq,"Invalid Type")
32
+ end
33
+
34
+ def test_num_cpu
35
+ assert_respond_to(CPU, :num_cpu)
36
+ assert_nothing_raised{ CPU.num_cpu }
37
+ assert_kind_of(Integer,CPU.num_cpu,"Invalid Type")
38
+ end
39
+
40
+ def test_num_active_cpu
41
+ assert_respond_to(CPU, :num_active_cpu)
42
+ assert_nothing_raised{ CPU.num_active_cpu }
43
+ assert_kind_of(Integer,CPU.num_active_cpu,"Invalid Type")
44
+ end
45
+
46
+ def test_cpu_architecture
47
+ assert_respond_to(CPU, :architecture)
48
+ assert_nothing_raised{ CPU.architecture }
49
+ assert_kind_of(String,CPU.architecture,"Invalid Type")
50
+ end
51
+
52
+ def test_load_avg
53
+ assert_respond_to(CPU, :load_avg)
54
+ assert_nothing_raised{ CPU.load_avg }
55
+ assert_nothing_raised{ CPU.load_avg(0) }
56
+ assert_nothing_raised{ CPU.load_avg{ |e| } }
57
+ assert_raises(ArgumentError){ CPU.load_avg(0){ } }
58
+ assert_kind_of(Array,CPU.load_avg,"Invalid Type")
59
+ assert_kind_of(Array,CPU.load_avg(0),"Invalid Type")
60
+ assert_equal(3,CPU.load_avg.length,"Bad number of elements")
61
+ assert_equal(3,CPU.load_avg(0).length,"Bad number of elements")
62
+ end
63
+ end
data/test/tc_linux.rb ADDED
@@ -0,0 +1,41 @@
1
+ ########################################
2
+ # tc_linux.rb
3
+ #
4
+ # Test Suite for sys-cpu for Linux
5
+ ########################################
6
+ base = File.basename(Dir.pwd)
7
+ if base == "test" || base =~ /sys-cpu/
8
+ require "ftools"
9
+ Dir.chdir ".." if base == "test"
10
+ Dir.mkdir("sys") unless File.exists?("sys")
11
+ File.copy("lib/os/linux.rb","sys/cpu.rb")
12
+ $LOAD_PATH.unshift Dir.pwd
13
+ end
14
+
15
+ require "sys/cpu"
16
+ require "test/unit"
17
+ include Sys
18
+
19
+ class TC_Linux < Test::Unit::TestCase
20
+ def test_all_dynamic_methods
21
+ assert_nothing_raised{
22
+ CPU.processors{ |cs|
23
+ cs.members.each{ |m|
24
+ puts "#{m}: " + cs[m].to_s
25
+ }
26
+ }
27
+ }
28
+ end
29
+
30
+ def test_load_avg
31
+ assert_nothing_raised{ CPU.load_avg }
32
+ assert_equal(3, CPU.load_avg.length)
33
+ end
34
+
35
+ def test_cpu_stats
36
+ assert_nothing_raised{ CPU.cpu_stats }
37
+ assert_kind_of(Hash, CPU.cpu_stats)
38
+ assert_equal(true, CPU.cpu_stats["cpu0"].length >= 4)
39
+ end
40
+ end
41
+
data/test/tc_sunos.rb ADDED
@@ -0,0 +1,82 @@
1
+ ###########################################################
2
+ # tc_sunos.rb
3
+ #
4
+ # Test suite for sys-cpu on Solaris. This should only be
5
+ # run *after* the make process.
6
+ ###########################################################
7
+ base = File.basename(Dir.pwd)
8
+ if base == "test" || base =~ /sys-cpu/
9
+ require "ftools"
10
+ Dir.chdir ".." if base == "test"
11
+
12
+ Dir.mkdir("sys") unless File.exist?("sys")
13
+
14
+ if File.exist?("cpu.so")
15
+ File.copy("cpu.so","sys")
16
+ else
17
+ puts "No cpu.so file found. Please run extconf.rb and make first"
18
+ exit
19
+ end
20
+
21
+ $LOAD_PATH.unshift Dir.pwd
22
+ end
23
+
24
+ require "sys/cpu"
25
+ require "test/unit"
26
+ include Sys
27
+
28
+ # I could really use a mock object here
29
+ class TC_SunOS < Test::Unit::TestCase
30
+ def test_cpu_freq
31
+ assert_respond_to(CPU, :freq)
32
+ assert_nothing_raised{ CPU.freq }
33
+ assert_nothing_raised{ CPU.freq(0) }
34
+ assert_kind_of(Integer, CPU.freq(0))
35
+ end
36
+
37
+ def test_cpu_type
38
+ assert_respond_to(CPU, :type)
39
+ assert_nothing_raised{ CPU.type }
40
+ assert_kind_of(String, CPU.type)
41
+ end
42
+
43
+ def test_fpu_type
44
+ assert_respond_to(CPU, :fpu_type)
45
+ assert_nothing_raised{ CPU.fpu_type }
46
+ assert_kind_of(String, CPU.fpu_type)
47
+ end
48
+
49
+ def test_load_avg
50
+ assert_respond_to(CPU, :load_avg)
51
+ assert_nothing_raised{ CPU.load_avg }
52
+ assert_kind_of(Array, CPU.load_avg)
53
+ assert_equal(3, CPU.load_avg.length)
54
+ assert_kind_of(Float, CPU.load_avg.first)
55
+ end
56
+
57
+ def test_cpu_model
58
+ assert_respond_to(CPU, :model)
59
+ assert_nothing_raised{ CPU.model }
60
+ assert_kind_of(String, CPU.model)
61
+ end
62
+
63
+ def test_num_cpu
64
+ assert_respond_to(CPU, :num_cpu)
65
+ assert_nothing_raised{ CPU.num_cpu }
66
+ assert_kind_of(Integer, CPU.num_cpu)
67
+ end
68
+
69
+ def test_state
70
+ assert_respond_to(CPU, :state)
71
+ assert_nothing_raised{ CPU.state }
72
+ assert_nothing_raised{ CPU.state(0) }
73
+ assert_kind_of(String, CPU.state(0))
74
+ end
75
+
76
+ def test_exceptions
77
+ assert_raises(Sys::CPUError){ CPU.state(55) }
78
+ assert_raises(TypeError){ CPU.state("yo") }
79
+ assert_raises(Sys::CPUError){ CPU.freq(999) }
80
+ assert_raises(TypeError){ CPU.freq("yo") }
81
+ end
82
+ end
@@ -0,0 +1,33 @@
1
+ ###########################################################
2
+ # tc_version.rb
3
+ #
4
+ # The sole purpose of this test case is to verify the
5
+ # version. This reduces the pain of having separate tests
6
+ # for the VERSION constant in every single test case.
7
+ ###########################################################
8
+ base = File.basename(Dir.pwd)
9
+ if base == "test" || base =~ /sys-cpu/
10
+ require "ftools"
11
+ Dir.chdir ".." if base == "test"
12
+
13
+ Dir.mkdir("sys") unless File.exist?("sys")
14
+
15
+ if File.exist?("cpu.so")
16
+ File.copy("cpu.so","sys")
17
+ else
18
+ puts "No cpu.so file found. Please run extconf.rb and make first"
19
+ exit
20
+ end
21
+
22
+ $LOAD_PATH.unshift Dir.pwd
23
+ end
24
+
25
+ require "sys/cpu"
26
+ require "test/unit"
27
+ include Sys
28
+
29
+ class TC_Sys_CPU_VERSION < Test::Unit::TestCase
30
+ def test_version
31
+ assert_equal('0.5.4', CPU::VERSION)
32
+ end
33
+ end
@@ -0,0 +1,76 @@
1
+ ######################################################################
2
+ # tc_windows.rb
3
+ #
4
+ # Test suite for Win32 systems.
5
+ ######################################################################
6
+ base = File.basename(Dir.pwd)
7
+ if base == "test" || base =~ /sys-cpu/
8
+ require "ftools" if base == "test"
9
+ Dir.chdir '..'
10
+ Dir.mkdir("sys") unless File.exists?("sys")
11
+ File.copy("lib/os/windows.rb","sys/cpu.rb")
12
+ $LOAD_PATH.unshift Dir.pwd
13
+ end
14
+
15
+ require "test/unit"
16
+ require "sys/cpu"
17
+ require "socket"
18
+ include Sys
19
+
20
+ class TC_Windows_CPU < Test::Unit::TestCase
21
+ def setup
22
+ @host = Socket.gethostname
23
+ end
24
+
25
+ def test_architecture
26
+ assert_respond_to(CPU, :architecture)
27
+ assert_nothing_raised{ CPU.architecture }
28
+ assert_nothing_raised{ CPU.architecture(@host) }
29
+ assert_kind_of(String,CPU.architecture,"Invalid Type")
30
+ end
31
+
32
+ def test_freq
33
+ assert_respond_to(CPU, :freq)
34
+ assert_nothing_raised{ CPU.freq }
35
+ assert_nothing_raised{ CPU.freq(0) }
36
+ assert_nothing_raised{ CPU.freq(0,@host) }
37
+ assert_kind_of(Integer,CPU.freq,"Invalid Type")
38
+ end
39
+
40
+ def test_model
41
+ assert_respond_to(CPU, :model)
42
+ assert_nothing_raised{ CPU.model }
43
+ assert_nothing_raised{ CPU.model(@host) }
44
+ assert_kind_of(String,CPU.model,"Invalid Type")
45
+ end
46
+
47
+ def test_num_cpu
48
+ assert_respond_to(CPU, :num_cpu)
49
+ assert_nothing_raised{ CPU.num_cpu }
50
+ assert_nothing_raised{ CPU.num_cpu(@host) }
51
+ assert_kind_of(Integer,CPU.num_cpu,"Invalid Type")
52
+ end
53
+
54
+ def test_type
55
+ assert_respond_to(CPU, :type)
56
+ assert_nothing_raised{ CPU.type }
57
+ assert_nothing_raised{ CPU.type(@host) }
58
+ assert_kind_of(String,CPU.type,"Invalid Type")
59
+ end
60
+
61
+ def test_load_avg
62
+ assert_respond_to(CPU, :load_avg)
63
+ assert_nothing_raised{ CPU.load_avg }
64
+ assert_nothing_raised{ CPU.load_avg(0,@host) }
65
+ assert_kind_of(Integer,CPU.load_avg,"Invalid Type")
66
+ end
67
+
68
+ def test_processors
69
+ assert_respond_to(CPU, :processors)
70
+ assert_nothing_raised{ CPU.processors{} }
71
+ end
72
+
73
+ def teardown
74
+ @host = nil
75
+ end
76
+ end
data/test/ts_all.rb ADDED
@@ -0,0 +1,17 @@
1
+ $LOAD_PATH.unshift Dir.pwd
2
+ $LOAD_PATH.unshift Dir.pwd + '/test'
3
+
4
+ require 'tc_version'
5
+
6
+ case RUBY_PLATFORM
7
+ when /sunos|solaris/i
8
+ require 'tc_sunos'
9
+ when /linux/i
10
+ require 'tc_linux'
11
+ when /mswin|cygwin|mingw/i
12
+ require 'tc_windows'
13
+ when /hpux/i
14
+ require 'tc_hpux'
15
+ when /bsd/i
16
+ require 'tc_freebsd'
17
+ end
metadata ADDED
@@ -0,0 +1,63 @@
1
+ --- !ruby/object:Gem::Specification
2
+ rubygems_version: 0.9.0
3
+ specification_version: 1
4
+ name: sys-cpu
5
+ version: !ruby/object:Gem::Version
6
+ version: 0.5.4
7
+ date: 2006-07-12 00:00:00 -06:00
8
+ summary: A Ruby interface for providing CPU information
9
+ require_paths:
10
+ - lib
11
+ email: djberg96@gmail.com
12
+ homepage: http://www.rubyforge.org/projects/sysutils
13
+ rubyforge_project: sysutils
14
+ description: A Ruby interface for providing CPU information
15
+ autorequire:
16
+ default_executable:
17
+ bindir: bin
18
+ has_rdoc: true
19
+ required_ruby_version: !ruby/object:Gem::Version::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.8.0
24
+ version:
25
+ platform: ruby
26
+ signing_key:
27
+ cert_chain:
28
+ post_install_message:
29
+ authors:
30
+ - Daniel J. Berger
31
+ files:
32
+ - doc/freebsd.txt
33
+ - doc/hpux.txt
34
+ - doc/linux.txt
35
+ - doc/sunos.txt
36
+ - doc/windows.txt
37
+ - test/tc_freebsd.rb
38
+ - test/tc_hpux.rb
39
+ - test/tc_linux.rb
40
+ - test/tc_sunos.rb
41
+ - test/tc_version.rb
42
+ - test/tc_windows.rb
43
+ - test/ts_all.rb
44
+ - CHANGES
45
+ - README
46
+ - extconf.rb
47
+ - lib/version.h
48
+ - lib/sys/sunos.c
49
+ test_files:
50
+ - test/ts_all.rb
51
+ rdoc_options: []
52
+
53
+ extra_rdoc_files:
54
+ - CHANGES
55
+ - README
56
+ executables: []
57
+
58
+ extensions:
59
+ - extconf.rb
60
+ requirements: []
61
+
62
+ dependencies: []
63
+