sys-proctable 0.9.3-universal-solaris → 0.9.4-universal-solaris
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES +11 -0
- data/MANIFEST +5 -3
- data/README +8 -9
- data/Rakefile +32 -21
- data/lib/sunos/sys/proctable.rb +432 -444
- data/lib/sys/top.rb +6 -4
- data/sys-proctable.gemspec +3 -2
- data/test/test_sys_proctable_all.rb +2 -5
- data/test/test_sys_proctable_sunos.rb +295 -297
- metadata +49 -49
data/lib/sys/top.rb
CHANGED
@@ -7,19 +7,21 @@ module Sys
|
|
7
7
|
class Top
|
8
8
|
|
9
9
|
# The version of the sys-top library
|
10
|
-
VERSION = '1.0.
|
10
|
+
VERSION = '1.0.4'
|
11
11
|
|
12
12
|
# Returns an array of Struct::ProcTableStruct elements containing up
|
13
13
|
# to +num+ elements, sorted by +field+. The default number of elements
|
14
14
|
# is 10, while the default field is 'pctcpu'.
|
15
15
|
#
|
16
|
-
# Exception: the default sort field is 'pid' on
|
16
|
+
# Exception: the default sort field is 'pid' on AIX and Windows.
|
17
17
|
#
|
18
18
|
def self.top(num=10, field='pctcpu')
|
19
19
|
field = field.to_s if field.is_a?(Symbol)
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
aix = RbConfig::CONFIG['host_os'] =~ /aix/i
|
22
|
+
|
23
|
+
# Sort by pid on Windows and AIX by default
|
24
|
+
if (File::ALT_SEPARATOR || aix) && field == 'pctcpu'
|
23
25
|
field = 'pid'
|
24
26
|
end
|
25
27
|
|
data/sys-proctable.gemspec
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = 'sys-proctable'
|
5
|
-
spec.version = '0.9.
|
5
|
+
spec.version = '0.9.4'
|
6
6
|
spec.author = 'Daniel J. Berger'
|
7
7
|
spec.license = 'Artistic 2.0'
|
8
8
|
spec.email = 'djberg96@gmail.com'
|
@@ -26,7 +26,8 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.rubyforge_project = 'sysutils'
|
27
27
|
spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST', 'doc/top.txt']
|
28
28
|
|
29
|
-
spec.add_development_dependency('test-unit'
|
29
|
+
spec.add_development_dependency('test-unit')
|
30
|
+
spec.add_development_dependency('rake')
|
30
31
|
|
31
32
|
spec.description = <<-EOF
|
32
33
|
The sys-proctable library provides an interface for gathering information
|
@@ -4,10 +4,7 @@
|
|
4
4
|
# Test suite for methods common to all platforms. Generally speaking
|
5
5
|
# you should run this test case using the 'rake test' task.
|
6
6
|
#######################################################################
|
7
|
-
require '
|
8
|
-
gem 'test-unit'
|
9
|
-
|
10
|
-
require 'test/unit'
|
7
|
+
require 'test-unit'
|
11
8
|
require 'sys/proctable'
|
12
9
|
require 'test/test_sys_top'
|
13
10
|
include Sys
|
@@ -22,7 +19,7 @@ class TC_ProcTable_All < Test::Unit::TestCase
|
|
22
19
|
end
|
23
20
|
|
24
21
|
def test_version
|
25
|
-
assert_equal('0.9.
|
22
|
+
assert_equal('0.9.4', ProcTable::VERSION)
|
26
23
|
end
|
27
24
|
|
28
25
|
def test_fields
|
@@ -1,308 +1,306 @@
|
|
1
1
|
#######################################################################
|
2
|
-
#
|
2
|
+
# test_sys_proctable_sunos.rb
|
3
3
|
#
|
4
4
|
# Test suite for sys-proctable for SunOS/Solaris. This should be run
|
5
5
|
# run via the 'rake test' task.
|
6
6
|
#######################################################################
|
7
|
-
require '
|
8
|
-
gem 'test-unit'
|
9
|
-
|
7
|
+
require 'test-unit'
|
10
8
|
require 'sys/proctable'
|
11
9
|
require 'test/test_sys_proctable_all'
|
12
10
|
include Sys
|
13
11
|
|
14
12
|
class TC_ProcTable_SunOS < Test::Unit::TestCase
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
13
|
+
def self.startup
|
14
|
+
@@fields = %w//
|
15
|
+
end
|
16
|
+
|
17
|
+
def setup
|
18
|
+
@ptable = ProcTable.ps.first
|
19
|
+
end
|
20
|
+
|
21
|
+
# PSINFO
|
22
|
+
|
23
|
+
def test_flag
|
24
|
+
assert_respond_to(@ptable, :flag)
|
25
|
+
assert_kind_of(Integer, @ptable.flag)
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_nlwp
|
29
|
+
assert_respond_to(@ptable, :nlwp)
|
30
|
+
assert_kind_of(Integer, @ptable.nlwp)
|
31
|
+
assert_true(@ptable.nlwp >= 0)
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_pid
|
35
|
+
assert_respond_to(@ptable, :pid)
|
36
|
+
assert_kind_of(Integer, @ptable.pid)
|
37
|
+
assert_true(@ptable.pid >= 0)
|
38
|
+
end
|
39
|
+
|
40
|
+
def test_ppid
|
41
|
+
assert_respond_to(@ptable, :ppid)
|
42
|
+
assert_kind_of(Integer, @ptable.ppid)
|
43
|
+
assert_true(@ptable.ppid >= 0)
|
44
|
+
end
|
45
|
+
|
46
|
+
def test_pgid
|
47
|
+
assert_respond_to(@ptable, :pgid)
|
48
|
+
assert_kind_of(Integer, @ptable.pgid)
|
49
|
+
assert_true(@ptable.pgid >= 0)
|
50
|
+
end
|
51
|
+
|
52
|
+
def test_sid
|
53
|
+
assert_respond_to(@ptable, :sid)
|
54
|
+
assert_kind_of(Integer, @ptable.sid)
|
55
|
+
assert_true(@ptable.sid >= 0)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_uid
|
59
|
+
assert_respond_to(@ptable, :uid)
|
60
|
+
assert_kind_of(Integer, @ptable.uid)
|
61
|
+
assert_true(@ptable.uid >= 0)
|
62
|
+
end
|
63
|
+
|
64
|
+
def test_euid
|
65
|
+
assert_respond_to(@ptable, :euid)
|
66
|
+
assert_kind_of(Integer, @ptable.euid)
|
67
|
+
assert_true(@ptable.euid >= 0)
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_gid
|
71
|
+
assert_respond_to(@ptable, :gid)
|
72
|
+
assert_kind_of(Integer, @ptable.gid)
|
73
|
+
assert_true(@ptable.gid >= 0)
|
74
|
+
end
|
75
|
+
|
76
|
+
def test_egid
|
77
|
+
assert_respond_to(@ptable, :egid)
|
78
|
+
assert_kind_of(Integer, @ptable.egid)
|
79
|
+
assert_true(@ptable.egid >= 0)
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_addr
|
83
|
+
assert_respond_to(@ptable, :addr)
|
84
|
+
assert_kind_of(Integer, @ptable.addr)
|
85
|
+
assert_true(@ptable.addr >= 0)
|
86
|
+
end
|
87
|
+
|
88
|
+
def test_size
|
89
|
+
assert_respond_to(@ptable, :size)
|
90
|
+
assert_kind_of(Integer, @ptable.size)
|
91
|
+
assert_true(@ptable.size >= 0)
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_rssize
|
95
|
+
assert_respond_to(@ptable, :rssize)
|
96
|
+
assert_kind_of(Integer, @ptable.rssize)
|
97
|
+
assert_true(@ptable.rssize >= 0)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_ttydev
|
101
|
+
assert_respond_to(@ptable, :ttydev)
|
102
|
+
assert_kind_of(Integer, @ptable.ttydev)
|
103
|
+
assert_true(@ptable.ttydev >= 0 || @ptable.ttydev == -1)
|
104
|
+
end
|
105
|
+
|
106
|
+
def test_pctcpu
|
107
|
+
assert_respond_to(@ptable, :pctcpu)
|
108
|
+
assert_kind_of(Float, @ptable.pctcpu)
|
109
|
+
assert_true(@ptable.pctcpu >= 0)
|
110
|
+
end
|
111
|
+
|
112
|
+
def test_pctmem
|
113
|
+
assert_respond_to(@ptable, :pctmem)
|
114
|
+
assert_kind_of(Float, @ptable.pctmem)
|
115
|
+
assert_true(@ptable.pctmem >= 0)
|
116
|
+
end
|
117
|
+
|
118
|
+
def test_start
|
119
|
+
assert_respond_to(@ptable, :start)
|
120
|
+
assert_kind_of(Time, @ptable.start)
|
121
|
+
end
|
122
|
+
|
123
|
+
def test_time
|
124
|
+
assert_respond_to(@ptable, :time)
|
125
|
+
assert_kind_of(Integer, @ptable.time)
|
126
|
+
assert_true(@ptable.time >= 0)
|
127
|
+
end
|
128
|
+
|
129
|
+
def test_ctime
|
130
|
+
assert_respond_to(@ptable, :ctime)
|
131
|
+
assert_kind_of(Integer, @ptable.ctime)
|
132
|
+
assert_true(@ptable.ctime >= 0)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_fname
|
136
|
+
assert_respond_to(@ptable, :fname)
|
137
|
+
assert_kind_of(String, @ptable.fname)
|
138
|
+
assert_true(@ptable.fname.size > 0)
|
139
|
+
end
|
140
|
+
|
141
|
+
def test_comm_alias
|
142
|
+
assert_respond_to(@ptable, :comm)
|
143
|
+
assert_kind_of(String, @ptable.comm)
|
144
|
+
assert_true(@ptable.comm.size > 0)
|
145
|
+
end
|
146
|
+
|
147
|
+
def test_psargs
|
148
|
+
assert_respond_to(@ptable, :psargs)
|
149
|
+
assert_kind_of(String, @ptable.psargs)
|
150
|
+
assert_true(@ptable.psargs.size > 0)
|
151
|
+
end
|
152
|
+
|
153
|
+
def test_wstat
|
154
|
+
assert_respond_to(@ptable, :wstat)
|
155
|
+
assert_kind_of(Integer, @ptable.wstat)
|
156
|
+
assert_true(@ptable.wstat >= 0)
|
157
|
+
end
|
158
|
+
|
159
|
+
def test_argc
|
160
|
+
assert_respond_to(@ptable, :argc)
|
161
|
+
assert_kind_of(Integer, @ptable.argc)
|
162
|
+
assert_true(@ptable.argc >= 0)
|
163
|
+
end
|
164
|
+
|
165
|
+
def test_argv
|
166
|
+
assert_respond_to(@ptable, :argv)
|
167
|
+
assert_kind_of(Integer, @ptable.argv)
|
168
|
+
assert_true(@ptable.argv >= 0)
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_envp
|
172
|
+
assert_respond_to(@ptable, :envp)
|
173
|
+
assert_kind_of(Integer, @ptable.envp)
|
174
|
+
assert_true(@ptable.envp >= 0)
|
175
|
+
end
|
176
|
+
|
177
|
+
def test_dmodel
|
178
|
+
assert_respond_to(@ptable, :dmodel)
|
179
|
+
assert_kind_of(Integer, @ptable.dmodel)
|
180
|
+
assert_true(@ptable.dmodel >= 0)
|
181
|
+
end
|
182
|
+
|
183
|
+
def test_taskid
|
184
|
+
assert_respond_to(@ptable, :taskid)
|
185
|
+
assert_kind_of(Integer, @ptable.taskid)
|
186
|
+
assert_true(@ptable.taskid >= 0)
|
187
|
+
end
|
188
|
+
|
189
|
+
def test_projid
|
190
|
+
assert_respond_to(@ptable, :projid)
|
191
|
+
assert_kind_of(Integer, @ptable.projid)
|
192
|
+
assert_true(@ptable.projid >= 0)
|
193
|
+
end
|
194
|
+
|
195
|
+
def test_nzomb
|
196
|
+
assert_respond_to(@ptable, :nzomb)
|
197
|
+
assert_kind_of(Integer, @ptable.nzomb)
|
198
|
+
assert_true(@ptable.nzomb >= 0)
|
199
|
+
end
|
200
|
+
|
201
|
+
def test_poolid
|
202
|
+
assert_respond_to(@ptable, :poolid)
|
203
|
+
assert_kind_of(Integer, @ptable.poolid)
|
204
|
+
assert_true(@ptable.poolid >= 0)
|
205
|
+
end
|
206
|
+
|
207
|
+
def test_zoneid
|
208
|
+
assert_respond_to(@ptable, :zoneid)
|
209
|
+
assert_kind_of(Integer, @ptable.zoneid)
|
210
|
+
assert_true(@ptable.zoneid >= 0)
|
211
|
+
end
|
212
|
+
|
213
|
+
def test_contract
|
214
|
+
assert_respond_to(@ptable, :contract)
|
215
|
+
assert_kind_of(Integer, @ptable.contract)
|
216
|
+
assert_true(@ptable.contract >= 0 || @ptable.contract == -1)
|
217
|
+
end
|
218
|
+
|
219
|
+
# LWPSINFO
|
220
|
+
|
221
|
+
def test_lwpid
|
222
|
+
assert_respond_to(@ptable, :lwpid)
|
223
|
+
assert_kind_of(Integer, @ptable.lwpid)
|
224
|
+
assert_true(@ptable.lwpid >= 0)
|
225
|
+
end
|
226
|
+
|
227
|
+
def test_wchan
|
228
|
+
assert_respond_to(@ptable, :wchan)
|
229
|
+
assert_kind_of(Integer, @ptable.wchan)
|
230
|
+
assert_true(@ptable.wchan >= 0)
|
231
|
+
end
|
232
|
+
|
233
|
+
def test_stype
|
234
|
+
assert_respond_to(@ptable, :stype)
|
235
|
+
assert_kind_of(Fixnum, @ptable.stype)
|
236
|
+
assert_true(@ptable.stype >= 0)
|
237
|
+
end
|
238
|
+
|
239
|
+
def test_state
|
240
|
+
assert_respond_to(@ptable, :state)
|
241
|
+
assert_kind_of(Fixnum, @ptable.state)
|
242
|
+
assert_true(@ptable.state >= 0)
|
243
|
+
end
|
244
|
+
|
245
|
+
def test_sname
|
246
|
+
assert_respond_to(@ptable, :sname)
|
247
|
+
assert_kind_of(String, @ptable.sname)
|
248
|
+
assert_true(['S', 'R', 'Z', 'T', 'I', 'O'].include?(@ptable.sname))
|
249
|
+
end
|
250
|
+
|
251
|
+
def test_nice
|
252
|
+
assert_respond_to(@ptable, :nice)
|
253
|
+
assert_kind_of(Fixnum, @ptable.nice)
|
254
|
+
assert_true(@ptable.nice >= 0)
|
255
|
+
end
|
256
|
+
|
257
|
+
def test_syscall
|
258
|
+
assert_respond_to(@ptable, :syscall)
|
259
|
+
assert_kind_of(Fixnum, @ptable.syscall)
|
260
|
+
assert_true(@ptable.syscall >= 0)
|
261
|
+
end
|
262
|
+
|
263
|
+
def test_pri
|
264
|
+
assert_respond_to(@ptable, :pri)
|
265
|
+
assert_kind_of(Fixnum, @ptable.pri)
|
266
|
+
assert_true(@ptable.pri >= 0)
|
267
|
+
end
|
268
|
+
|
269
|
+
def test_clname
|
270
|
+
assert_respond_to(@ptable, :clname)
|
271
|
+
assert_kind_of(String, @ptable.clname)
|
272
|
+
assert_true(@ptable.clname.length >= 0 && @ptable.clname.length <= 8)
|
273
|
+
end
|
274
|
+
|
275
|
+
def test_name
|
276
|
+
assert_respond_to(@ptable, :name)
|
277
|
+
assert_kind_of(String, @ptable.name)
|
278
|
+
assert_true(@ptable.name.length >= 0 && @ptable.name.length <= 16)
|
279
|
+
end
|
280
|
+
|
281
|
+
def test_onpro
|
282
|
+
assert_respond_to(@ptable, :onpro)
|
283
|
+
assert_kind_of(Fixnum, @ptable.onpro)
|
284
|
+
assert_true(@ptable.onpro >= 0)
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_bindpro
|
288
|
+
assert_respond_to(@ptable, :bindpro)
|
289
|
+
assert_kind_of(Fixnum, @ptable.bindpro)
|
290
|
+
assert_true(@ptable.bindpro >= 0 || @ptable.bindpro == -1)
|
291
|
+
end
|
292
|
+
|
293
|
+
def test_bindpset
|
294
|
+
assert_respond_to(@ptable, :bindpset)
|
295
|
+
assert_kind_of(Fixnum, @ptable.bindpset)
|
296
|
+
assert_true(@ptable.bindpset >= 0 || @ptable.bindpset == -1)
|
297
|
+
end
|
298
|
+
|
299
|
+
def teardown
|
300
|
+
@ptable = nil
|
301
|
+
end
|
302
|
+
|
303
|
+
def self.shutdown
|
304
|
+
@@fields = nil
|
305
|
+
end
|
308
306
|
end
|