sys-cpu 0.7.2 → 0.8.0

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
- SHA1:
3
- metadata.gz: 5a8e944d3ba7367653fde3b252a10381b3e20871
4
- data.tar.gz: 9791c3ff4bd7adcc847a67d7064517bd818e9f0f
2
+ SHA256:
3
+ metadata.gz: de4fef13495a9b0d229eea6796851de82b4ccadc4a8e45dcea91b42d9f6ec074
4
+ data.tar.gz: 6da5868da52f3237d14d42a9a8823292711687957da05bda73136e7936f6946d
5
5
  SHA512:
6
- metadata.gz: a71eca1b427859d7486637ca9016f209fad1c1cccce23b6c370ed0f33090b93077ec4946485621bfdeddd9d54c9a5852aa5c4ebfe5888921e38e8c17b7070dab
7
- data.tar.gz: 86571ddb4165ba50cf9afa7c073d55b345cf36f4a6dceb56af67672ec209b01a1c6d7160da137c17233de79b09e379621cd425fd7fb5c3473abe17d09f589776
6
+ metadata.gz: 07ec871287015c0bb7ab832e7c679156e83d26a48eb78d27258799c301c3e33626496eb6519efe487f206bb3e2239845ba1a405b4050847f2b7099f9d9f79eec
7
+ data.tar.gz: dfaa9832d07510d6bea73c8a775404362fa09c3fe945e88331d0486e7be707db0bd756c128350fac4d9fcbf668b3f0e54fca3f295df2f940d93e974684bf530a
checksums.yaml.gz.sig CHANGED
Binary file
data.tar.gz.sig CHANGED
Binary file
data/CHANGES CHANGED
@@ -1,3 +1,9 @@
1
+ == 0.8.0 - 17-Oct-2018
2
+ * Switched license to Apache 2.0.
3
+ * Updated documentation for the cpu_stats method on Linux.
4
+ * The VERSION constant is now frozen.
5
+ * Now uses require_relative internally where needed.
6
+
1
7
  == 0.7.2 - 5-Sep-2015
2
8
  * Replaced a global array with a constant in the Linux version. Thanks go
3
9
  to Yorick Peterse for the patch.
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ namespace 'gem' do
12
12
  require 'rubygems/package'
13
13
  spec = eval(IO.read('sys-cpu.gemspec'))
14
14
  spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
15
- Gem::Package.build(spec)
15
+ Gem::Package.build(spec, true)
16
16
  end
17
17
 
18
18
  desc "Install the sys-cpu gem"
@@ -1,21 +1,26 @@
1
1
  -----BEGIN CERTIFICATE-----
2
- MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
2
+ MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
3
3
  cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
4
- MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
4
+ MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
5
5
  ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
6
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
7
- Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI
8
- S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M
9
- gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi
10
- FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O
11
- zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl
12
- DtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe
13
- nn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEm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BgNV
15
+ HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
16
+ AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
17
+ YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
18
+ /3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
19
+ h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
20
+ 6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
21
+ ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
22
+ 1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
23
+ DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
24
+ ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
25
+ WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
21
26
  -----END CERTIFICATE-----
data/lib/sys/cpu.rb CHANGED
@@ -5,15 +5,15 @@ require 'rbconfig'
5
5
  module Sys
6
6
  class CPU
7
7
  # The version of the sys-cpu gem.
8
- VERSION = '0.7.2'
8
+ VERSION = '0.8.0'.freeze
9
9
  end
10
10
  end
11
11
 
12
12
  case RbConfig::CONFIG['host_os']
13
13
  when /linux/i
14
- require File.join(File.dirname(__FILE__), 'linux', 'sys', 'cpu')
14
+ require_relative('linux/sys/cpu')
15
15
  when /windows|mswin|mingw|cygwin|dos/i
16
- require File.join(File.dirname(__FILE__), 'windows', 'sys', 'cpu')
16
+ require_relative('windows/sys/cpu')
17
17
  else
18
- require File.join(File.dirname(__FILE__), 'unix', 'sys', 'cpu')
18
+ require_relative('unix/sys/cpu')
19
19
  end
@@ -5,6 +5,8 @@ module Sys
5
5
 
6
6
  # :stopdoc:
7
7
 
8
+ private
9
+
8
10
  cpu_file = "/proc/cpuinfo"
9
11
  cpu_hash = {}
10
12
  CPU_ARRAY = []
@@ -37,6 +39,8 @@ module Sys
37
39
 
38
40
  CPU_ARRAY.push(cpu_hash)
39
41
 
42
+ public
43
+
40
44
  # :startdoc:
41
45
 
42
46
  class CPU
@@ -89,9 +93,21 @@ module Sys
89
93
  IO.readlines(load_avg_file).first.split[0..2].map{ |e| e.to_f }
90
94
  end
91
95
 
92
- # Returns a hash of arrays that contain the number of seconds that the
93
- # system spent in user mode, user mode with low priority (nice), system
94
- # mode, and the idle task, respectively.
96
+ # Returns a hash of arrays that contains an array of the following
97
+ # information (as of 2.6.33), respectively:
98
+ #
99
+ # * user: time spent in user mode.
100
+ # * nice: time spent in user mode with low priority.
101
+ # * system: time spent in system mode.
102
+ # * idle: time spent in the idle task.
103
+ # * iowait: time waiting for IO to complete.
104
+ # * irq: time servicing interrupts.
105
+ # * softirq: time servicing softirqs.
106
+ # * steal: time spent in other operating systems when running in a virtualized environment.
107
+ # * guest: time spent running a virtual CPU for guest operating systems.
108
+ # * guest_nice: time spent running a niced guest, i.e a virtual CPU for guest operating systems.
109
+ #
110
+ # Note that older kernels may not necessarily include some of these fields.
95
111
  #
96
112
  def self.cpu_stats
97
113
  cpu_stat_file = "/proc/stat"
data/sys-cpu.gemspec CHANGED
@@ -2,10 +2,10 @@ require 'rubygems'
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'sys-cpu'
5
- spec.version = '0.7.2'
5
+ spec.version = '0.8.0'
6
6
  spec.author = 'Daniel J. Berger'
7
- spec.email = 'djberg96 at nospam at gmail dot com'
8
- spec.license = 'Artistic 2.0'
7
+ spec.email = 'djberg96@gmail.com'
8
+ spec.license = 'Apache 2.0'
9
9
  spec.homepage = 'https://github.com/djberg96/sys-cpu'
10
10
  spec.summary = 'A Ruby interface for providing CPU information'
11
11
  spec.test_file = 'test/test_sys_cpu.rb'
@@ -10,6 +10,10 @@ require 'test-unit'
10
10
 
11
11
  class TC_Sys_CPU_VERSION < Test::Unit::TestCase
12
12
  test "version number is set to the expected value" do
13
- assert_equal('0.7.2', Sys::CPU::VERSION)
13
+ assert_equal('0.8.0', Sys::CPU::VERSION)
14
+ end
15
+
16
+ test "version number is frozen" do
17
+ assert_true(Sys::CPU::VERSION.frozen?)
14
18
  end
15
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sys-cpu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel J. Berger
@@ -10,27 +10,32 @@ bindir: bin
10
10
  cert_chain:
11
11
  - |
12
12
  -----BEGIN CERTIFICATE-----
13
- MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl
13
+ MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
14
14
  cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
15
- MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi
15
+ MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
16
16
  ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
17
- bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS
18
- Hmi8kRYbq9Vkf15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
+ ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
36
+ WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
32
37
  -----END CERTIFICATE-----
33
- date: 2015-09-05 00:00:00.000000000 Z
38
+ date: 2018-10-17 00:00:00.000000000 Z
34
39
  dependencies:
35
40
  - !ruby/object:Gem::Dependency
36
41
  name: ffi
@@ -78,7 +83,7 @@ description: |2
78
83
  The sys-cpu library provides an interface for gathering information
79
84
  about your system's processor(s). Information includes speed, type,
80
85
  and load average.
81
- email: djberg96 at nospam at gmail dot com
86
+ email: djberg96@gmail.com
82
87
  executables: []
83
88
  extensions: []
84
89
  extra_rdoc_files:
@@ -86,28 +91,40 @@ extra_rdoc_files:
86
91
  - README
87
92
  - MANIFEST
88
93
  files:
89
- - CHANGES
90
- - MANIFEST
91
- - README
92
- - Rakefile
94
+ - certs
93
95
  - certs/djberg96_pub.pem
96
+ - CHANGES
97
+ - doc
94
98
  - doc/bsd.txt
95
99
  - doc/hpux.txt
96
100
  - doc/linux.txt
97
101
  - doc/sunos.txt
98
102
  - doc/windows.txt
103
+ - examples
99
104
  - examples/example_sys_cpu_bsd.rb
100
105
  - examples/example_sys_cpu_hpux.rb
101
106
  - examples/example_sys_cpu_linux.rb
102
107
  - examples/example_sys_cpu_sunos.rb
103
108
  - examples/example_sys_cpu_windows.rb
104
109
  - install.rb
105
- - lib/sys-cpu.rb
110
+ - lib
111
+ - lib/sys
106
112
  - lib/sys/cpu.rb
113
+ - lib/sys/linux
114
+ - lib/sys/linux/sys
107
115
  - lib/sys/linux/sys/cpu.rb
116
+ - lib/sys/unix
117
+ - lib/sys/unix/sys
108
118
  - lib/sys/unix/sys/cpu.rb
119
+ - lib/sys/windows
120
+ - lib/sys/windows/sys
109
121
  - lib/sys/windows/sys/cpu.rb
122
+ - lib/sys-cpu.rb
123
+ - MANIFEST
124
+ - Rakefile
125
+ - README
110
126
  - sys-cpu.gemspec
127
+ - test
111
128
  - test/test_sys_cpu.rb
112
129
  - test/test_sys_cpu_bsd.rb
113
130
  - test/test_sys_cpu_hpux.rb
@@ -117,7 +134,7 @@ files:
117
134
  - test/test_sys_cpu_windows.rb
118
135
  homepage: https://github.com/djberg96/sys-cpu
119
136
  licenses:
120
- - Artistic 2.0
137
+ - Apache 2.0
121
138
  metadata: {}
122
139
  post_install_message:
123
140
  rdoc_options: []
@@ -135,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
152
  version: '0'
136
153
  requirements: []
137
154
  rubyforge_project:
138
- rubygems_version: 2.4.5
155
+ rubygems_version: 2.7.6
139
156
  signing_key:
140
157
  specification_version: 4
141
158
  summary: A Ruby interface for providing CPU information
metadata.gz.sig CHANGED
@@ -1,2 +1,4 @@
1
- U��2�����kKl h��k�Qp��`�����V~�1���8m�'9�=:�x���L��!c�
2
- �ڢ%��cU5����<�¶6�
1
+ 8H�*� f*&I��F׵|��E-��裭�N`�qV��@�B����������,�E
2
+ m"cW��7�����snF�M�� K�-�J����>�v��bCD 0�E���-lо~g�#�˂�B*C+��A�t6���j�P '����[�ٚ 8Ӵ�ٴ�������A�J�3��MC�)��}H�&Pm뺓����W!�����e�1�O�F ���!�w_�k��q�� ƫ5 /����x7�q���
3
+ �RB��>V����B�5V���ph����1�)��P��{��?����'6��w[1Jw���$�bv$c��m��MA
4
+ 3���]�@�C�V")��Y�lE �G������ٞP��=G`V�/8WE�����x�c;������o�E��