sys-cpu 0.6.1 → 0.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES +13 -0
- data/MANIFEST +11 -10
- data/README +24 -24
- data/Rakefile +95 -0
- data/doc/bsd.txt +7 -25
- data/doc/hpux.txt +7 -28
- data/doc/sunos.txt +7 -29
- data/doc/windows.txt +8 -30
- 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 +25 -0
- data/examples/example_sys_cpu_sunos.rb +21 -0
- data/examples/example_sys_cpu_windows.rb +24 -0
- data/ext/bsd/bsd.c +39 -23
- data/ext/hpux/hpux.c +219 -0
- data/ext/sunos/sunos.c +281 -0
- data/ext/version.h +1 -1
- data/install.rb +84 -0
- data/lib/linux/sys/cpu.rb +122 -0
- data/lib/windows/sys/cpu.rb +784 -0
- data/sys-cpu.gemspec +47 -0
- data/test/test_sys_cpu.rb +23 -0
- data/test/{tc_bsd.rb → test_sys_cpu_bsd.rb} +33 -12
- data/test/{tc_hpux.rb → test_sys_cpu_hpux.rb} +16 -13
- data/test/test_sys_cpu_linux.rb +34 -0
- data/test/{tc_sunos.rb → test_sys_cpu_sunos.rb} +10 -8
- data/test/{tc_version.rb → test_sys_cpu_version.rb} +5 -2
- data/test/{tc_windows.rb → test_sys_cpu_windows.rb} +25 -22
- metadata +42 -19
- data/test/tc_cpu.rb +0 -17
- data/test/tc_linux.rb +0 -34
data/test/tc_cpu.rb
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
$LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__))
|
2
|
-
require 'tc_version'
|
3
|
-
|
4
|
-
case RUBY_PLATFORM
|
5
|
-
when /bsd|darwin|mach|osx/i
|
6
|
-
require 'tc_bsd'
|
7
|
-
when /hpux/i
|
8
|
-
require 'tc_hpux'
|
9
|
-
when /linux/i
|
10
|
-
require 'tc_linux'
|
11
|
-
when /sunos|solaris/i
|
12
|
-
require 'tc_sunos'
|
13
|
-
when /mswin|win32|dos|mingw|cygwin/i
|
14
|
-
require 'tc_windows'
|
15
|
-
else
|
16
|
-
raise "Platform not supported"
|
17
|
-
end
|
data/test/tc_linux.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
###########################################################
|
2
|
-
# tc_linux.rb
|
3
|
-
#
|
4
|
-
# Test Suite for sys-cpu for Linux. This should be run via
|
5
|
-
# the 'rake test' task.
|
6
|
-
###########################################################
|
7
|
-
require "sys/cpu"
|
8
|
-
require "test/unit"
|
9
|
-
require "tc_version"
|
10
|
-
include Sys
|
11
|
-
|
12
|
-
class TC_Linux < Test::Unit::TestCase
|
13
|
-
def test_all_dynamic_methods
|
14
|
-
assert_nothing_raised{
|
15
|
-
CPU.processors{ |cs|
|
16
|
-
cs.members.each{ |m|
|
17
|
-
puts "#{m}: " + cs[m].to_s
|
18
|
-
}
|
19
|
-
}
|
20
|
-
}
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_load_avg
|
24
|
-
assert_nothing_raised{ CPU.load_avg }
|
25
|
-
assert_equal(3, CPU.load_avg.length)
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_cpu_stats
|
29
|
-
assert_nothing_raised{ CPU.cpu_stats }
|
30
|
-
assert_kind_of(Hash, CPU.cpu_stats)
|
31
|
-
assert_equal(true, CPU.cpu_stats["cpu0"].length >= 4)
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|