solaris-kstat 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,35 +1,30 @@
1
1
  require 'rubygems'
2
2
 
3
- spec = Gem::Specification.new do |gem|
4
- gem.name = 'solaris-kstat'
5
- gem.version = '1.0.1'
6
- gem.author = 'Daniel J. Berger'
7
- gem.license = 'Artistic 2.0'
8
- gem.email = 'djberg96@gmail.com'
9
- gem.homepage = 'http://www.rubyforge.org/projects/solarisutils'
10
- gem.platform = Gem::Platform::RUBY
11
- gem.summary = 'Interface for the Solaris kstat library'
12
- gem.has_rdoc = true
13
- gem.test_file = 'test/test_solaris_kstat.rb'
14
- gem.extensions = ['ext/extconf.rb']
15
- gem.files = Dir['**/*'].reject{ |f| f.include?('CVS') }
3
+ Gem::Specification.new do |spec|
4
+ spec.name = 'solaris-kstat'
5
+ spec.version = '1.0.2'
6
+ spec.author = 'Daniel J. Berger'
7
+ spec.license = 'Artistic 2.0'
8
+ spec.email = 'djberg96@gmail.com'
9
+ spec.homepage = 'http://www.rubyforge.org/projects/solarisutils'
10
+ spec.summary = 'Interface for the Solaris kstat library'
11
+ spec.test_file = 'test/test_solaris_kstat.rb'
12
+ spec.extensions = ['ext/extconf.rb']
13
+ spec.files = Dir['**/*'].reject{ |f| f.include?('git') }
16
14
 
17
- gem.rubyforge_project = 'solarisutils'
15
+ spec.rubyforge_project = 'solarisutils'
18
16
 
19
- gem.extra_rdoc_files = [
20
- 'README',
21
- 'CHANGES',
22
- 'MANIFEST',
23
- 'ext/solaris/rkstat.c'
24
- ]
17
+ spec.extra_rdoc_files = [
18
+ 'README',
19
+ 'CHANGES',
20
+ 'MANIFEST',
21
+ 'ext/solaris/rkstat.c'
22
+ ]
25
23
 
26
- gem.required_ruby_version = '>= 1.8.0'
27
-
28
- gem.description = <<-EOF
29
- The solaris-kstat library provides a Ruby interface for gathering kernel
30
- statistics from the operating system. Each matching statistic is provided
31
- with its module, instance, and name fields, as well as its actual value.
32
- EOF
24
+ spec.description = <<-EOF
25
+ The solaris-kstat library provides a Ruby interface for gathering kernel
26
+ statistics from the Solaris operating system. Each matching statistic is
27
+ provided with its module, instance, and name fields, as well as its actual
28
+ value.
29
+ EOF
33
30
  end
34
-
35
- Gem::Builder.new(spec).build
@@ -13,153 +13,159 @@ require 'set'
13
13
  include Solaris
14
14
 
15
15
  class TC_Solaris_Kstat < Test::Unit::TestCase
16
- def setup
17
- @k = Kstat.new
18
- end
19
-
20
- def test_version
21
- assert_equal('1.0.1', Kstat::VERSION)
22
- end
23
-
24
- def test_name
25
- assert_respond_to(@k, :name)
26
- assert_respond_to(@k, :name=)
27
- assert_nil(@k.name)
28
- assert_nothing_raised{ @k.name }
29
- assert_nothing_raised{ @k.name = 'foo' }
30
- end
31
-
32
- def test_module
33
- assert_respond_to(@k, :module)
34
- assert_respond_to(@k, :module=)
35
- assert_nil(@k.module)
36
- assert_nothing_raised{ @k.module }
37
- assert_nothing_raised{ @k.module = 'bar' }
38
- end
39
-
40
- def test_instance
41
- assert_respond_to(@k, :instance)
42
- assert_respond_to(@k, :instance=)
43
- assert_nil(@k.instance)
44
- assert_nothing_raised{ @k.instance }
45
- assert_nothing_raised{ @k.instance = 0 }
46
- end
47
-
48
- def test_constructor_valid_values
49
- assert_nothing_raised{ Kstat.new('cpu_info',0,'cpu_info0').record }
50
- assert_nothing_raised{ Kstat.new(nil,0,'cpu_info0').record }
51
- assert_nothing_raised{ Kstat.new('cpu_info',0,nil).record }
52
- end
53
-
54
- def test_constructor_invalid_values
55
- assert_raises(Kstat::Error){ Kstat.new('bogus').record }
56
- assert_raises(Kstat::Error){ Kstat.new('cpu_info',99).record }
57
- assert_raises(Kstat::Error){ Kstat.new('cpu_info',0,'bogus').record }
58
- assert_raises(TypeError){ Kstat.new('cpu_info','x').record }
59
- end
60
-
61
- def test_record_basic
62
- assert_respond_to(@k, :record)
63
- end
64
-
65
- def test_record_named
66
- assert_nothing_raised{ @k.record['cpu_info'][0]['cpu_info0'] }
67
- assert_kind_of(Hash, @k.record['cpu_info'][0]['cpu_info0'])
68
- end
69
-
70
- def test_record_io
71
- assert_nothing_raised{ @k.record['nfs'][1]['nfs1'] }
72
- assert_kind_of(Hash, @k.record['nfs'][1]['nfs1'])
73
- end
74
-
75
- def test_record_intr
76
- assert_nothing_raised{ @k.record['fd'][0]['fd0'] }
77
- assert_kind_of(Hash, @k.record['fd'][0]['fd0'])
78
- end
79
-
80
- def test_record_raw_vminfo
81
- keys = %w/freemem swap_alloc swap_avail swap_free swap_resv/
82
-
83
- assert_nothing_raised{ @k.record['unix'][0]['vminfo'] }
84
- assert_kind_of(Hash, @k.record['unix'][0]['vminfo'])
85
- assert_equal(keys, @k.record['unix'][0]['vminfo'].keys.sort)
86
- end
87
-
88
- def test_record_raw_var
89
- keys = %w/
90
- v_autoup v_buf v_bufhwm v_call v_clist v_hbuf v_hmask
91
- v_maxpmem v_maxsyspri v_maxup v_maxupttl v_nglobpris v_pbuf
92
- v_proc v_sptmap
93
- /
94
-
95
- assert_nothing_raised{ @k.record['unix'][0]['var'] }
96
- assert_kind_of(Hash, @k.record['unix'][0]['var'])
97
- assert_equal(keys, @k.record['unix'][0]['var'].keys.sort)
98
- end
99
-
100
- def test_record_raw_biostats
101
- keys = %w/
102
- buffer_cache_hits
103
- buffer_cache_lookups
104
- buffers_locked_by_someone
105
- duplicate_buffers_found
106
- new_buffer_requests
107
- waits_for_buffer_allocs
108
- /
109
-
110
- assert_nothing_raised{ @k.record['unix'][0]['biostats'] }
111
- assert_kind_of([Hash, NilClass], @k.record['unix'][0]['biostats'])
112
- assert_equal(keys, @k.record['unix'][0]['biostats'].keys.sort)
113
- end
114
-
115
- def test_record_raw_cpu_stat
116
- keys = %w/
117
- cpu_idle cpu_user cpu_kernel cpu_wait wait_io wait_swap
118
- wait_pio bread bwrite lread lwrite phread phwrite pswitch
119
- trap intr syscall sysread syswrite sysfork sysvfork sysexec
120
- readch writech rcvint xmtint mdmint rawch canch outch msg
121
- sema namei ufsiget ufsdirblk ufsipage ufsinopage inodeovf
122
- fileovf procovf intrthread intrblk idlethread inv_swtch
123
- nthreads cpumigrate xcalls mutex_adenters rw_rdfails
124
- rw_wrfails modload modunload bawrite
125
- /
126
-
127
- assert_nothing_raised{ @k.record['cpu_stat'][0]['cpu_stat0'] }
128
- assert_kind_of(Hash, @k.record['cpu_stat'][0]['cpu_stat0'])
129
-
130
- # Too big and difficult to sort manually - so use a Set
131
- set1 = Set.new(keys)
132
- set2 = Set.new(@k.record['cpu_stat'][0]['cpu_stat0'].keys)
133
- diff = set1 - set2
134
-
135
- assert_equal(set1,set2,'Diff was: #{diff.to_a}')
136
- end
137
-
138
- def test_record_ncstats
139
- keys = %w/
140
- dbl_enters
141
- enters
142
- hits
143
- long_enter
144
- long_look misses
145
- move_to_front
146
- purges
147
- /
148
-
149
- assert_nothing_raised{ @k.record['unix'][0]['ncstats'] }
150
- assert_kind_of(Hash, @k.record['unix'][0]['ncstats'])
151
- assert_equal(keys, @k.record['unix'][0]['ncstats'].keys.sort)
152
- end
153
-
154
- def test_record_sysinfo
155
- keys = %w/runocc runque swpocc swpque updates waiting/
156
-
157
- assert_nothing_raised{ @k.record['unix'][0]['sysinfo'] }
158
- assert_kind_of(Hash, @k.record['unix'][0]['sysinfo'])
159
- assert_equal(keys, @k.record['unix'][0]['sysinfo'].keys.sort)
160
- end
161
-
162
- def teardown
163
- @k = nil
164
- end
16
+ def setup
17
+ @kstat = Kstat.new
18
+ end
19
+
20
+ def test_version
21
+ assert_equal('1.0.2', Kstat::VERSION)
22
+ end
23
+
24
+ def test_name
25
+ assert_respond_to(@kstat, :name)
26
+ assert_respond_to(@kstat, :name=)
27
+ assert_nil(@kstat.name)
28
+ assert_nothing_raised{ @kstat.name }
29
+ assert_nothing_raised{ @kstat.name = 'foo' }
30
+ end
31
+
32
+ def test_module
33
+ assert_respond_to(@kstat, :module)
34
+ assert_respond_to(@kstat, :module=)
35
+ assert_nil(@kstat.module)
36
+ assert_nothing_raised{ @kstat.module }
37
+ assert_nothing_raised{ @kstat.module = 'bar' }
38
+ end
39
+
40
+ def test_instance
41
+ assert_respond_to(@kstat, :instance)
42
+ assert_respond_to(@kstat, :instance=)
43
+ assert_nil(@kstat.instance)
44
+ assert_nothing_raised{ @kstat.instance }
45
+ assert_nothing_raised{ @kstat.instance = 0 }
46
+ end
47
+
48
+ def test_constructor_valid_values
49
+ assert_nothing_raised{ Kstat.new('cpu_info',0,'cpu_info0').record }
50
+ assert_nothing_raised{ Kstat.new(nil,0,'cpu_info0').record }
51
+ assert_nothing_raised{ Kstat.new('cpu_info',0,nil).record }
52
+ end
53
+
54
+ def test_constructor_invalid_values
55
+ assert_raises(Kstat::Error){ Kstat.new('bogus').record }
56
+ assert_raises(Kstat::Error){ Kstat.new('cpu_info',99).record }
57
+ assert_raises(Kstat::Error){ Kstat.new('cpu_info',0,'bogus').record }
58
+ assert_raises(TypeError){ Kstat.new('cpu_info','x').record }
59
+ end
60
+
61
+ def test_record_basic
62
+ assert_respond_to(@kstat, :record)
63
+ end
64
+
65
+ def test_record_named
66
+ assert_nothing_raised{ @kstat.record['cpu_info'][0]['cpu_info0'] }
67
+ assert_kind_of(Hash, @kstat.record['cpu_info'][0]['cpu_info0'])
68
+ end
69
+
70
+ def test_record_io
71
+ assert_nothing_raised{ @kstat.record['nfs'][1]['nfs1'] }
72
+ assert_kind_of(Hash, @kstat.record['nfs'][1]['nfs1'])
73
+ end
74
+
75
+ def test_record_intr
76
+ assert_nothing_raised{ @kstat.record['fd'][0]['fd0'] }
77
+ assert_kind_of(Hash, @kstat.record['fd'][0]['fd0'])
78
+ end
79
+
80
+ def test_record_raw_vminfo
81
+ keys = %w/class freemem swap_alloc swap_avail swap_free swap_resv/
82
+
83
+ assert_nothing_raised{ @kstat.record['unix'][0]['vminfo'] }
84
+ assert_kind_of(Hash, @kstat.record['unix'][0]['vminfo'])
85
+ assert_equal(keys, @kstat.record['unix'][0]['vminfo'].keys.sort)
86
+ end
87
+
88
+ def test_record_raw_var
89
+ keys = %w/
90
+ class v_autoup v_buf v_bufhwm v_call v_clist v_hbuf v_hmask
91
+ v_maxpmem v_maxsyspri v_maxup v_maxupttl v_nglobpris v_pbuf
92
+ v_proc v_sptmap
93
+ /
94
+
95
+ assert_nothing_raised{ @kstat.record['unix'][0]['var'] }
96
+ assert_kind_of(Hash, @kstat.record['unix'][0]['var'])
97
+ assert_equal(keys, @kstat.record['unix'][0]['var'].keys.sort)
98
+ end
99
+
100
+ def test_record_raw_biostats
101
+ keys = %w/
102
+ buffer_cache_hits
103
+ buffer_cache_lookups
104
+ buffers_locked_by_someone
105
+ class
106
+ duplicate_buffers_found
107
+ new_buffer_requests
108
+ waits_for_buffer_allocs
109
+ /
110
+
111
+ assert_nothing_raised{ @kstat.record['unix'][0]['biostats'] }
112
+ assert_kind_of([Hash, NilClass], @kstat.record['unix'][0]['biostats'])
113
+ assert_equal(keys, @kstat.record['unix'][0]['biostats'].keys.sort)
114
+ end
115
+
116
+ def test_record_raw_cpu_stat
117
+ keys = %w/
118
+ class cpu_idle cpu_user cpu_kernel cpu_wait wait_io wait_swap
119
+ wait_pio bread bwrite lread lwrite phread phwrite pswitch
120
+ trap intr syscall sysread syswrite sysfork sysvfork sysexec
121
+ readch writech rcvint xmtint mdmint rawch canch outch msg
122
+ sema namei ufsiget ufsdirblk ufsipage ufsinopage inodeovf
123
+ fileovf procovf intrthread intrblk idlethread inv_swtch
124
+ nthreads cpumigrate xcalls mutex_adenters rw_rdfails
125
+ rw_wrfails modload modunload bawrite
126
+ /
127
+
128
+ assert_nothing_raised{ @kstat.record['cpu_stat'][0]['cpu_stat0'] }
129
+ assert_kind_of(Hash, @kstat.record['cpu_stat'][0]['cpu_stat0'])
130
+
131
+ # Too big and difficult to sort manually - so use a Set
132
+ set1 = Set.new(keys)
133
+ set2 = Set.new(@kstat.record['cpu_stat'][0]['cpu_stat0'].keys)
134
+ diff = set1 - set2
135
+
136
+ assert_equal(set1,set2,'Diff was: #{diff.to_a}')
137
+ end
138
+
139
+ def test_record_ncstats
140
+ keys = %w/
141
+ class
142
+ dbl_enters
143
+ enters
144
+ hits
145
+ long_enter
146
+ long_look misses
147
+ move_to_front
148
+ purges
149
+ /
150
+
151
+ assert_nothing_raised{ @kstat.record['unix'][0]['ncstats'] }
152
+ assert_kind_of(Hash, @kstat.record['unix'][0]['ncstats'])
153
+ assert_equal(keys, @kstat.record['unix'][0]['ncstats'].keys.sort)
154
+ end
155
+
156
+ def test_record_sysinfo
157
+ keys = %w/class runocc runque swpocc swpque updates waiting/
158
+
159
+ assert_nothing_raised{ @kstat.record['unix'][0]['sysinfo'] }
160
+ assert_kind_of(Hash, @kstat.record['unix'][0]['sysinfo'])
161
+ assert_equal(keys, @kstat.record['unix'][0]['sysinfo'].keys.sort)
162
+ end
163
+
164
+ def test_class_set
165
+ assert_equal("misc", @kstat.record['unix'][0]['sysinfo']['class'])
166
+ end
167
+
168
+ def teardown
169
+ @kstat = nil
170
+ end
165
171
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: solaris-kstat
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ hash: 19
5
+ prerelease:
6
+ segments:
7
+ - 1
8
+ - 0
9
+ - 2
10
+ version: 1.0.2
5
11
  platform: ruby
6
12
  authors:
7
13
  - Daniel J. Berger
@@ -9,11 +15,10 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2009-08-27 00:00:00 -06:00
13
- default_executable:
18
+ date: 2011-07-29 00:00:00 Z
14
19
  dependencies: []
15
20
 
16
- description: " The solaris-kstat library provides a Ruby interface for gathering kernel\n statistics from the operating system. Each matching statistic is provided\n with its module, instance, and name fields, as well as its actual value.\n"
21
+ description: " The solaris-kstat library provides a Ruby interface for gathering kernel\n statistics from the Solaris operating system. Each matching statistic is\n provided with its module, instance, and name fields, as well as its actual\n value.\n"
17
22
  email: djberg96@gmail.com
18
23
  executables: []
19
24
 
@@ -29,13 +34,12 @@ files:
29
34
  - MANIFEST
30
35
  - README
31
36
  - Rakefile
32
- - solaris-kstat.gemspec
33
37
  - examples/example_kstat.rb
34
38
  - ext/extconf.rb
35
39
  - ext/solaris/rkstat.c
36
40
  - ext/solaris/rkstat.h
41
+ - solaris-kstat.gemspec
37
42
  - test/test_solaris_kstat.rb
38
- has_rdoc: true
39
43
  homepage: http://www.rubyforge.org/projects/solarisutils
40
44
  licenses:
41
45
  - Artistic 2.0
@@ -45,21 +49,27 @@ rdoc_options: []
45
49
  require_paths:
46
50
  - lib
47
51
  required_ruby_version: !ruby/object:Gem::Requirement
52
+ none: false
48
53
  requirements:
49
54
  - - ">="
50
55
  - !ruby/object:Gem::Version
51
- version: 1.8.0
52
- version:
56
+ hash: 3
57
+ segments:
58
+ - 0
59
+ version: "0"
53
60
  required_rubygems_version: !ruby/object:Gem::Requirement
61
+ none: false
54
62
  requirements:
55
63
  - - ">="
56
64
  - !ruby/object:Gem::Version
65
+ hash: 3
66
+ segments:
67
+ - 0
57
68
  version: "0"
58
- version:
59
69
  requirements: []
60
70
 
61
71
  rubyforge_project: solarisutils
62
- rubygems_version: 1.3.5
72
+ rubygems_version: 1.8.5
63
73
  signing_key:
64
74
  specification_version: 3
65
75
  summary: Interface for the Solaris kstat library