sys-proctable 0.9.5-universal-linux → 0.9.6-universal-linux

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 99bb7edbbd342331c80b1f70d99ec18c31adbadf
4
- data.tar.gz: 90d82ed00cbdc63a9b28660314ef89f4eef2995f
3
+ metadata.gz: 6acee7cc47351454fd011763cc450bc245553ed5
4
+ data.tar.gz: 932bcdd1ef0b3f2ed44c24ca5ca8379c9a8f8abb
5
5
  SHA512:
6
- metadata.gz: 56a5e9be9e450baff6d52ed8354ad963b62b30a6d06e23388bded5264188428443f24c3a7589b862926a621ee9cb162d56316e66a642feba4467571779d3ae6a
7
- data.tar.gz: 78b4fbf16b223897686c2e9cfb9091d1ab125e011d7bba91a9f9d5ac8fca89b112ecad7a71d377ec6736b0f80619d894d3a918208f59d71c1acc8c2e2a58f8a9
6
+ metadata.gz: 60bc5d1992a2b9902d439a38301741b42f26f97b05a2fe1d735986fa0b6225c9f5d8ddc84a994e55390631ce0ba98d51beb31f954c6d3aad2e08389d2688110d
7
+ data.tar.gz: 64cda85c92b65f607ee85ab863f8ba3c5fd416b1724ae20099d4e2a71e61ea70d42a913ae92910ad60072f2722a59f8c7cb1e6eeed6bb5b97866f59b4d9b6a1f
data/CHANGES CHANGED
@@ -1,3 +1,6 @@
1
+ == 0.9.6 - 24-Feb-2015
2
+ * Added NLWP field on Linux. Thanks go to Rich Chatterton for the patch.
3
+
1
4
  == 0.9.5 - 10-Feb-2015
2
5
  * Significant cleanup and memory reduction of the OSX code. Thanks go
3
6
  to Ivan (toy) for the patches.
data/README CHANGED
@@ -11,6 +11,7 @@
11
11
  * Solaris 8+
12
12
  * HP-UX 10+
13
13
  * OS X 10.4+
14
+ * AIX 5.3+
14
15
 
15
16
  == Installation
16
17
  gem install sys-proctable
@@ -104,8 +105,14 @@
104
105
  Artistic 2.0
105
106
 
106
107
  == Copyright
107
- (C) 2003-2014 Daniel J. Berger
108
+ (C) 2003-2015 Daniel J. Berger
108
109
  All Rights Reserved.
109
110
 
111
+ == Contributions
112
+ Although this library is free, please consider having your company
113
+ setup a gittip if used by your company professionally.
114
+
115
+ http://www.gittip.com/djberg96/
116
+
110
117
  == Author
111
118
  Daniel J. Berger
@@ -11,7 +11,7 @@ module Sys
11
11
  private_class_method :new
12
12
 
13
13
  # The version of the sys-proctable library
14
- VERSION = '0.9.5'
14
+ VERSION = '0.9.6'
15
15
 
16
16
  private
17
17
 
@@ -70,8 +70,9 @@ module Sys
70
70
  'euid', # Effective user ID
71
71
  'gid', # Real group ID
72
72
  'egid', # Effective group ID
73
- 'pctcpu', # Percent of CPU usage (custom field)
74
- 'pctmem' # Percent of Memory usage (custom field)
73
+ 'pctcpu', # Percent of CPU usage (custom field)
74
+ 'pctmem', # Percent of Memory usage (custom field)
75
+ 'nlwp' # Number of Light-Weight Processes associated with the process (threads)
75
76
  ]
76
77
 
77
78
  public
@@ -160,6 +161,10 @@ module Sys
160
161
  # Get /proc/<pid>/stat information
161
162
  stat = IO.read("/proc/#{file}/stat") rescue next
162
163
 
164
+ # Get number of LWP, one directory for each in /proc/<pid>/task/
165
+ # Every process has at least one thread, so if we fail to read the task directory, set nlwp to 1.
166
+ struct.nlwp = Dir.glob("/proc/#{file}/task/*").length rescue struct.nlwp = 1
167
+
163
168
  # Deal with spaces in comm name. Courtesy of Ara Howard.
164
169
  re = %r/\([^\)]+\)/
165
170
  comm = stat[re]
@@ -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'
5
+ spec.version = '0.9.6'
6
6
  spec.author = 'Daniel J. Berger'
7
7
  spec.license = 'Artistic 2.0'
8
8
  spec.email = 'djberg96@gmail.com'
@@ -19,7 +19,7 @@ class TC_ProcTable_All < Test::Unit::TestCase
19
19
  end
20
20
 
21
21
  def test_version
22
- assert_equal('0.9.5', ProcTable::VERSION)
22
+ assert_equal('0.9.6', ProcTable::VERSION)
23
23
  end
24
24
 
25
25
  def test_fields
@@ -17,7 +17,7 @@ class TC_ProcTable_Linux < Test::Unit::TestCase
17
17
  stime cutime cstime priority nice itrealvalue starttime vsize
18
18
  rss rlim startcode endcode startstack kstkesp kstkeip signal blocked
19
19
  sigignore sigcatch wchan nswap cnswap exit_signal processor environ
20
- pctcpu pctmem
20
+ pctcpu pctmem nlwp
21
21
  /
22
22
  end
23
23
 
@@ -290,6 +290,11 @@ class TC_ProcTable_Linux < Test::Unit::TestCase
290
290
  assert_kind_of(Float, @ptable.pctcpu)
291
291
  end
292
292
 
293
+ def test_nlwp
294
+ assert_respond_to(@ptable, :nlwp)
295
+ assert_kind_of(Fixnum, @ptable.nlwp)
296
+ end
297
+
293
298
  def teardown
294
299
  @ptable = nil
295
300
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sys-proctable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: universal-linux
6
6
  authors:
7
7
  - Daniel J. Berger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-10 00:00:00.000000000 Z
11
+ date: 2015-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-unit