sys-cpu 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGES.md +4 -0
- data/lib/sys/cpu.rb +1 -1
- data/lib/sys/darwin/sys/cpu.rb +17 -0
- data/spec/sys_cpu_bsd_spec.rb +17 -0
- data/spec/sys_cpu_shared.rb +1 -1
- data/sys-cpu.gemspec +1 -1
- data.tar.gz.sig +0 -0
- metadata +6 -6
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 240d4766057d3b5e6099092e037a858a527598955f303a6b1e958e78dd55f10e
|
4
|
+
data.tar.gz: 9a1041ac81a63a1205d28d94c59373a5868f17eb9e46b1cf4226f3488f7dafd9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb252c92d2460f38fdf65656c2d3875c55b6d3d2ec73863be3fcdd878d3d66a49a33f9a9d1d49ae65aa4c8d3d5a405bac2aa3bdaaa4edbc5d6854e12e6a29af
|
7
|
+
data.tar.gz: 993afd63ee978e9bd24682309221f9f4fbddb177f8ed748b9cf512317bf72ea5243b529d114e9407fbf198f00c685fc1a6a0afc4646e2230acce9a5dce8d0d08
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGES.md
CHANGED
data/lib/sys/cpu.rb
CHANGED
data/lib/sys/darwin/sys/cpu.rb
CHANGED
@@ -15,16 +15,22 @@ module Sys
|
|
15
15
|
|
16
16
|
CTL_HW = 6 # Generic hardware/cpu
|
17
17
|
|
18
|
+
private_constant :CTL_HW
|
19
|
+
|
18
20
|
HW_MACHINE = 1 # Machine class
|
19
21
|
HW_MODEL = 2 # Specific machine model
|
20
22
|
HW_NCPU = 3 # Number of CPU's
|
21
23
|
HW_CPU_FREQ = 15 # CPU frequency
|
22
24
|
HW_MACHINE_ARCH = 12 # Machine architecture
|
23
25
|
|
26
|
+
private_constant :HW_MACHINE, :HW_MODEL, :HW_NCPU, :HW_CPU_FREQ, :HW_MACHINE_ARCH
|
27
|
+
|
24
28
|
SI_MACHINE = 5
|
25
29
|
SI_ARCHITECTURE = 6
|
26
30
|
SC_NPROCESSORS_ONLN = 15
|
27
31
|
|
32
|
+
private_constant :SI_MACHINE, :SI_ARCHITECTURE, :SC_NPROCESSORS_ONLN
|
33
|
+
|
28
34
|
P_OFFLINE = 1
|
29
35
|
P_ONLINE = 2
|
30
36
|
P_FAULTED = 4
|
@@ -32,12 +38,19 @@ module Sys
|
|
32
38
|
P_NOINTR = 6
|
33
39
|
P_SPARE = 7
|
34
40
|
|
41
|
+
private_constant :P_OFFLINE, :P_ONLINE, :P_FAULTED, :P_POWEROFF, :P_NOINTR, :P_SPARE
|
42
|
+
|
35
43
|
CPU_ARCH_ABI64 = 0x01000000
|
36
44
|
CPU_TYPE_X86 = 7
|
37
45
|
CPU_TYPE_X86_64 = (CPU_TYPE_X86 | CPU_ARCH_ABI64)
|
46
|
+
CPU_TYPE_ARM = 12
|
38
47
|
CPU_TYPE_SPARC = 14
|
39
48
|
CPU_TYPE_POWERPC = 18
|
40
49
|
CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC | CPU_ARCH_ABI64
|
50
|
+
CPU_TYPE_ARM64 = CPU_TYPE_ARM | CPU_ARCH_ABI64
|
51
|
+
|
52
|
+
private_constant :CPU_ARCH_ABI64, :CPU_TYPE_X86, :CPU_TYPE_X86_64, :CPU_TYPE_ARM
|
53
|
+
private_constant :CPU_TYPE_SPARC, :CPU_TYPE_POWERPC, :CPU_TYPE_POWERPC64
|
41
54
|
|
42
55
|
attach_function(
|
43
56
|
:sysctl,
|
@@ -73,6 +86,8 @@ module Sys
|
|
73
86
|
)
|
74
87
|
end
|
75
88
|
|
89
|
+
private_constant :ClockInfo
|
90
|
+
|
76
91
|
# Returns the cpu's architecture. On most systems this will be identical
|
77
92
|
# to the CPU.machine method. On OpenBSD it will be identical to the CPU.model
|
78
93
|
# method.
|
@@ -145,6 +160,8 @@ module Sys
|
|
145
160
|
'Sparc'
|
146
161
|
when CPU_TYPE_POWERPC, CPU_TYPE_POWERPC64
|
147
162
|
'PowerPC'
|
163
|
+
when CPU_TYPE_ARM, CPU_TYPE_ARM64
|
164
|
+
'ARM'
|
148
165
|
else
|
149
166
|
'Unknown'
|
150
167
|
end
|
data/spec/sys_cpu_bsd_spec.rb
CHANGED
@@ -93,4 +93,21 @@ RSpec.describe Sys::CPU, :bsd => true do
|
|
93
93
|
example 'num_cpu method does not accept any arguments' do
|
94
94
|
expect{ described_class.num_cpu(0) }.to raise_error(ArgumentError)
|
95
95
|
end
|
96
|
+
|
97
|
+
context "ffi methods and constants are private" do
|
98
|
+
example "ffi constants are private" do
|
99
|
+
constants = described_class.constants
|
100
|
+
expect(constants).not_to include(:CTL_HW)
|
101
|
+
expect(constants).not_to include(:CPU_TYPE_X86)
|
102
|
+
expect(constants).not_to include(:CPU_TYPE_X86_64)
|
103
|
+
expect(constants).not_to include(:HW_MACHINE)
|
104
|
+
expect(constants).not_to include(:ClockInfo)
|
105
|
+
end
|
106
|
+
|
107
|
+
example "ffi methods are private" do
|
108
|
+
methods = described_class.methods(false)
|
109
|
+
expect(methods).not_to include(:sysctl)
|
110
|
+
expect(methods).not_to include(:sysctlbyname)
|
111
|
+
end
|
112
|
+
end
|
96
113
|
end
|
data/spec/sys_cpu_shared.rb
CHANGED
data/sys-cpu.gemspec
CHANGED
data.tar.gz.sig
CHANGED
Binary file
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sys-cpu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel J. Berger
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain:
|
11
11
|
- |
|
@@ -35,7 +35,7 @@ cert_chain:
|
|
35
35
|
ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
|
36
36
|
WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
|
37
37
|
-----END CERTIFICATE-----
|
38
|
-
date: 2022-08-
|
38
|
+
date: 2022-08-12 00:00:00.000000000 Z
|
39
39
|
dependencies:
|
40
40
|
- !ruby/object:Gem::Dependency
|
41
41
|
name: ffi
|
@@ -159,7 +159,7 @@ metadata:
|
|
159
159
|
source_code_uri: https://github.com/djberg96/sys-cpu
|
160
160
|
wiki_uri: https://github.com/djberg96/sys-cpu/wiki
|
161
161
|
rubygems_mfa_required: 'true'
|
162
|
-
post_install_message:
|
162
|
+
post_install_message:
|
163
163
|
rdoc_options: []
|
164
164
|
require_paths:
|
165
165
|
- lib
|
@@ -174,8 +174,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
174
|
- !ruby/object:Gem::Version
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
|
-
rubygems_version: 3.
|
178
|
-
signing_key:
|
177
|
+
rubygems_version: 3.3.15
|
178
|
+
signing_key:
|
179
179
|
specification_version: 4
|
180
180
|
summary: A Ruby interface for providing CPU information
|
181
181
|
test_files:
|
metadata.gz.sig
CHANGED
Binary file
|