linux_stat 0.9.0 → 1.0.3
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
- data/README.md +115 -75
- data/ext/sysconf/sysconf.c +52 -13
- data/lib/linux_stat.rb +1 -0
- data/lib/linux_stat/battery.rb +166 -11
- data/lib/linux_stat/cpu.rb +55 -10
- data/lib/linux_stat/mounts.rb +4 -4
- data/lib/linux_stat/net.rb +6 -2
- data/lib/linux_stat/os.rb +9 -5
- data/lib/linux_stat/process_info.rb +3 -2
- data/lib/linux_stat/usb.rb +194 -0
- data/lib/linux_stat/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01f83a838dcd8dcb7e9a0777a68fbad83284103ddc12e8c1ef9a1358df7c4965
|
4
|
+
data.tar.gz: ba699f7a8bcb56469f44ab36e3a48888421dd23295287b56896f4c931c99a6e5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7350b44b72c7385eb552d029668577c4cda06f1130104437e0baaf853cd119c8eb27aac99e7070a7191110faef4f3ba85773bcadf646485f94856b7ff859564e
|
7
|
+
data.tar.gz: 5ae2a2344cdff502a559e4feefd028feb0194fbfe63197f0969a78c87328077dc033acedf78f99844c338082937b3d72270f44666528fec45ee06ca129265431
|
data/README.md
CHANGED
@@ -85,27 +85,42 @@ LinuxStat::BIOS.version()
|
|
85
85
|
|
86
86
|
### LinuxStat::Battery
|
87
87
|
```
|
88
|
-
# File: battery.rb | Line:
|
88
|
+
# File: battery.rb | Line: 105
|
89
89
|
# Definition: def charge
|
90
90
|
LinuxStat::Battery.charge()
|
91
91
|
=> 100.0
|
92
92
|
|
93
|
-
# File: battery.rb | Line:
|
93
|
+
# File: battery.rb | Line: 122
|
94
|
+
# Definition: def charge_full_design_wh
|
95
|
+
LinuxStat::Battery.charge_full_design_wh()
|
96
|
+
=> 42.0
|
97
|
+
|
98
|
+
# File: battery.rb | Line: 141
|
99
|
+
# Definition: def charge_full_wh
|
100
|
+
LinuxStat::Battery.charge_full_wh()
|
101
|
+
=> 23.79
|
102
|
+
|
103
|
+
# File: battery.rb | Line: 78
|
94
104
|
# Definition: def charging?
|
95
105
|
LinuxStat::Battery.charging?()
|
96
106
|
=> true
|
97
107
|
|
98
|
-
# File: battery.rb | Line:
|
108
|
+
# File: battery.rb | Line: 184
|
109
|
+
# Definition: def devices_stat
|
110
|
+
LinuxStat::Battery.devices_stat()
|
111
|
+
=> {:AC=>{:type=>"Mains", :online=>1}, :BAT0=>{:model=>"DELL CYMGM77", :manufacturer=>"Samsung SDI", :type=>"Battery", :status=>"Full", :capacity=>100, :voltage_min_design=>11.4, :charge_full_design=>3.684, :charge_full_design_wh=>42.0, :voltage_now=>12....
|
112
|
+
|
113
|
+
# File: battery.rb | Line: 87
|
99
114
|
# Definition: def discharging?
|
100
115
|
LinuxStat::Battery.discharging?()
|
101
116
|
=> false
|
102
117
|
|
103
|
-
# File: battery.rb | Line:
|
118
|
+
# File: battery.rb | Line: 96
|
104
119
|
# Definition: def full?
|
105
120
|
LinuxStat::Battery.full?()
|
106
121
|
=> true
|
107
122
|
|
108
|
-
# File: battery.rb | Line:
|
123
|
+
# File: battery.rb | Line: 47
|
109
124
|
# Definition: def manufacturer
|
110
125
|
LinuxStat::Battery.manufacturer()
|
111
126
|
=> "Samsung SDI"
|
@@ -125,26 +140,26 @@ LinuxStat::Battery.present?()
|
|
125
140
|
LinuxStat::Battery.stat()
|
126
141
|
=> {:model=>"DELL CYMGM77", :manufacturer=>"Samsung SDI", :technology=>"Li-ion", :status=>"Full", :charge=>100.0, :charging=>true, :discharging=>false, :full=>true}
|
127
142
|
|
128
|
-
# File: battery.rb | Line:
|
143
|
+
# File: battery.rb | Line: 68
|
129
144
|
# Definition: def status
|
130
145
|
LinuxStat::Battery.status()
|
131
146
|
=> "Full"
|
132
147
|
|
133
|
-
# File: battery.rb | Line:
|
148
|
+
# File: battery.rb | Line: 57
|
134
149
|
# Definition: def technology
|
135
150
|
LinuxStat::Battery.technology()
|
136
151
|
=> "Li-ion"
|
137
152
|
|
138
|
-
# File: battery.rb | Line:
|
153
|
+
# File: battery.rb | Line: 160
|
139
154
|
# Definition: def voltage_now
|
140
155
|
LinuxStat::Battery.voltage_now()
|
141
|
-
=> 12.
|
156
|
+
=> 12.453
|
142
157
|
|
143
158
|
```
|
144
159
|
|
145
160
|
### LinuxStat::CPU
|
146
161
|
```
|
147
|
-
# File: cpu.rb | Line:
|
162
|
+
# File: cpu.rb | Line: 287
|
148
163
|
# Definition: def available_governors
|
149
164
|
LinuxStat::CPU.available_governors()
|
150
165
|
=> {"cpu0"=>["performance", "powersave"], "cpu1"=>["performance", "powersave"], "cpu2"=>["performance", "powersave"], "cpu3"=>["performance", "powersave"]}
|
@@ -154,37 +169,42 @@ LinuxStat::CPU.available_governors()
|
|
154
169
|
LinuxStat::CPU.count()
|
155
170
|
=> 4
|
156
171
|
|
157
|
-
# File: cpu.rb | Line:
|
172
|
+
# File: cpu.rb | Line: 103
|
173
|
+
# Definition: def count_online
|
174
|
+
LinuxStat::CPU.count_online()
|
175
|
+
=> 4
|
176
|
+
|
177
|
+
# File: cpu.rb | Line: 197
|
158
178
|
# Definition: def cur_freq
|
159
179
|
LinuxStat::CPU.cur_freq()
|
160
|
-
=> {"cpu0"=>
|
180
|
+
=> {"cpu0"=>1971347, "cpu1"=>2000253, "cpu2"=>1916631, "cpu3"=>2000064}
|
161
181
|
|
162
|
-
# File: cpu.rb | Line:
|
182
|
+
# File: cpu.rb | Line: 265
|
163
183
|
# Definition: def governor
|
164
184
|
LinuxStat::CPU.governor()
|
165
185
|
=> {"cpu0"=>"performance", "cpu1"=>"performance", "cpu2"=>"performance", "cpu3"=>"performance"}
|
166
186
|
|
167
|
-
# File: cpu.rb | Line:
|
187
|
+
# File: cpu.rb | Line: 241
|
168
188
|
# Definition: def max_freq
|
169
189
|
LinuxStat::CPU.max_freq()
|
170
190
|
=> {"cpu0"=>2000000, "cpu1"=>2000000, "cpu2"=>2000000, "cpu3"=>2000000}
|
171
191
|
|
172
|
-
# File: cpu.rb | Line:
|
192
|
+
# File: cpu.rb | Line: 219
|
173
193
|
# Definition: def min_freq
|
174
194
|
LinuxStat::CPU.min_freq()
|
175
195
|
=> {"cpu0"=>2000000, "cpu1"=>2000000, "cpu2"=>2000000, "cpu3"=>2000000}
|
176
196
|
|
177
|
-
# File: cpu.rb | Line:
|
197
|
+
# File: cpu.rb | Line: 184
|
178
198
|
# Definition: def model
|
179
199
|
LinuxStat::CPU.model()
|
180
200
|
=> "Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz"
|
181
201
|
|
182
|
-
# File: cpu.rb | Line:
|
202
|
+
# File: cpu.rb | Line: 163
|
183
203
|
# Definition: def offline
|
184
204
|
LinuxStat::CPU.offline()
|
185
205
|
=> []
|
186
206
|
|
187
|
-
# File: cpu.rb | Line:
|
207
|
+
# File: cpu.rb | Line: 132
|
188
208
|
# Definition: def online
|
189
209
|
LinuxStat::CPU.online()
|
190
210
|
=> [0, 1, 2, 3]
|
@@ -192,29 +212,29 @@ LinuxStat::CPU.online()
|
|
192
212
|
# File: cpu.rb | Line: 23
|
193
213
|
# Definition: def stat(sleep = ticks_to_ms_t5)
|
194
214
|
LinuxStat::CPU.stat(sleep)
|
195
|
-
=> {0=>5.
|
215
|
+
=> {0=>5.0, 1=>16.67, 2=>0.0, 3=>0.0, 4=>16.67}
|
196
216
|
|
197
217
|
# File: cpu.rb | Line: 63
|
198
218
|
# Definition: def total_usage(sleep = ticks_to_ms_t5)
|
199
219
|
LinuxStat::CPU.total_usage(sleep)
|
200
|
-
=>
|
220
|
+
=> 5.26
|
201
221
|
|
202
222
|
# File: cpu.rb | Line: 63
|
203
223
|
# Definition: def total_usage(sleep = ticks_to_ms_t5)
|
204
224
|
LinuxStat::CPU.usage(sleep)
|
205
|
-
=>
|
225
|
+
=> 9.52
|
206
226
|
|
207
227
|
# File: cpu.rb | Line: 23
|
208
228
|
# Definition: def stat(sleep = ticks_to_ms_t5)
|
209
229
|
LinuxStat::CPU.usages(sleep)
|
210
|
-
=> {0=>5.
|
230
|
+
=> {0=>5.26, 1=>16.67, 2=>0.0, 3=>0.0, 4=>0.0}
|
211
231
|
|
212
232
|
```
|
213
233
|
|
214
234
|
### LinuxStat::FS
|
215
235
|
```
|
216
236
|
LinuxStat::FS.stat(arg = "/")
|
217
|
-
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>
|
237
|
+
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>11703573, :block_avail_unpriv=>11703573, :inodes=>58612160, :free_inodes=>56863418, :filesystem_id=>2050, :mount_flags=>1024, :max_filename_length=>255}
|
218
238
|
|
219
239
|
```
|
220
240
|
|
@@ -223,32 +243,32 @@ LinuxStat::FS.stat(arg = "/")
|
|
223
243
|
# File: filesystem.rb | Line: 92
|
224
244
|
# Definition: def available(fs = ?..freeze)
|
225
245
|
LinuxStat::Filesystem.available(fs)
|
226
|
-
=>
|
246
|
+
=> 47937835008
|
227
247
|
|
228
248
|
# File: filesystem.rb | Line: 58
|
229
249
|
# Definition: def free(fs = ?..freeze)
|
230
250
|
LinuxStat::Filesystem.free(fs)
|
231
|
-
=>
|
251
|
+
=> 47937835008
|
232
252
|
|
233
253
|
# File: filesystem.rb | Line: 19
|
234
254
|
# Definition: def stat(fs = ?..freeze)
|
235
255
|
LinuxStat::Filesystem.stat(fs)
|
236
|
-
=> {:total=>
|
256
|
+
=> {:total=>119981191168, :free=>47937835008, :used=>72043356160}
|
237
257
|
|
238
258
|
# File: filesystem.rb | Line: 108
|
239
259
|
# Definition: def stat_raw(fs = ?..freeze)
|
240
260
|
LinuxStat::Filesystem.stat_raw(fs)
|
241
|
-
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>
|
261
|
+
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>11703573, :block_avail_unpriv=>11703573, :inodes=>58612160, :free_inodes=>56863418, :filesystem_id=>2050, :mount_flags=>1024, :max_filename_length=>255}
|
242
262
|
|
243
263
|
# File: filesystem.rb | Line: 39
|
244
264
|
# Definition: def total(fs = ?..freeze)
|
245
265
|
LinuxStat::Filesystem.total(fs)
|
246
|
-
=>
|
266
|
+
=> 119981191168
|
247
267
|
|
248
268
|
# File: filesystem.rb | Line: 73
|
249
269
|
# Definition: def used(fs = ?..freeze)
|
250
270
|
LinuxStat::Filesystem.used(fs)
|
251
|
-
=>
|
271
|
+
=> 72043356160
|
252
272
|
|
253
273
|
```
|
254
274
|
|
@@ -311,22 +331,22 @@ LinuxStat::Kernel.version()
|
|
311
331
|
# File: memory.rb | Line: 50
|
312
332
|
# Definition: def available
|
313
333
|
LinuxStat::Memory.available()
|
314
|
-
=>
|
334
|
+
=> 1597312
|
315
335
|
|
316
336
|
# File: memory.rb | Line: 81
|
317
337
|
# Definition: def percent_available
|
318
338
|
LinuxStat::Memory.percent_available()
|
319
|
-
=>
|
339
|
+
=> 41.64
|
320
340
|
|
321
341
|
# File: memory.rb | Line: 70
|
322
342
|
# Definition: def percent_used
|
323
343
|
LinuxStat::Memory.percent_used()
|
324
|
-
=>
|
344
|
+
=> 58.36
|
325
345
|
|
326
346
|
# File: memory.rb | Line: 11
|
327
347
|
# Definition: def stat
|
328
348
|
LinuxStat::Memory.stat()
|
329
|
-
=> {:total=>3836236, :used=>
|
349
|
+
=> {:total=>3836236, :used=>2238924, :available=>1597312, :percent_used=>58.36, :percent_available=>41.64}
|
330
350
|
|
331
351
|
# File: memory.rb | Line: 40
|
332
352
|
# Definition: def total
|
@@ -336,7 +356,7 @@ LinuxStat::Memory.total()
|
|
336
356
|
# File: memory.rb | Line: 60
|
337
357
|
# Definition: def used
|
338
358
|
LinuxStat::Memory.used()
|
339
|
-
=>
|
359
|
+
=> 2238924
|
340
360
|
|
341
361
|
```
|
342
362
|
|
@@ -345,7 +365,7 @@ LinuxStat::Memory.used()
|
|
345
365
|
# File: mounts.rb | Line: 179
|
346
366
|
# Definition: def device_stat(dev = root)
|
347
367
|
LinuxStat::Mounts.device_stat(dev)
|
348
|
-
=> {:mountpoint=>"/", :total=>119981191168, :free=>
|
368
|
+
=> {:mountpoint=>"/", :total=>119981191168, :free=>47937835008, :available=>47937835008, :used=>72043356160, :percent_used=>60.05, :percent_free=>39.95, :percent_available=>39.95}
|
349
369
|
|
350
370
|
# File: mounts.rb | Line: 137
|
351
371
|
# Definition: def devices_stat
|
@@ -360,12 +380,12 @@ LinuxStat::Mounts.list()
|
|
360
380
|
# File: mounts.rb | Line: 20
|
361
381
|
# Definition: def list_devices
|
362
382
|
LinuxStat::Mounts.list_devices()
|
363
|
-
=> ["proc", "sys", "dev", "run", "/dev/sda2", "securityfs", "tmpfs", "devpts", "tmpfs", "cgroup2", "cgroup", "pstore", "none", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "systemd-1", "
|
383
|
+
=> ["proc", "sys", "dev", "run", "/dev/sda2", "securityfs", "tmpfs", "devpts", "tmpfs", "cgroup2", "cgroup", "pstore", "none", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "cgroup", "systemd-1", "tra...
|
364
384
|
|
365
385
|
# File: mounts.rb | Line: 109
|
366
386
|
# Definition: def list_devices_mount_point
|
367
387
|
LinuxStat::Mounts.list_devices_mount_point()
|
368
|
-
=> {"proc"=>"/proc", "sys"=>"/sys", "dev"=>"/dev", "run"=>"/run", "/dev/sda2"=>"/", "securityfs"=>"/sys/kernel/security", "tmpfs"=>"/run/user/1000", "devpts"=>"/dev/pts", "cgroup2"=>"/sys/fs/cgroup/unified", "cgroup"=>"/sys/fs/cgroup/
|
388
|
+
=> {"proc"=>"/proc", "sys"=>"/sys", "dev"=>"/dev", "run"=>"/run", "/dev/sda2"=>"/", "securityfs"=>"/sys/kernel/security", "tmpfs"=>"/run/user/1000", "devpts"=>"/dev/pts", "cgroup2"=>"/sys/fs/cgroup/unified", "cgroup"=>"/sys/fs/cgroup/memory", "pstore"=>"...
|
369
389
|
|
370
390
|
# File: mounts.rb | Line: 80
|
371
391
|
# Definition: def mount_point(dev = root)
|
@@ -409,17 +429,17 @@ LinuxStat::Net.ipv4_private()
|
|
409
429
|
# File: net.rb | Line: 23
|
410
430
|
# Definition: def total_bytes
|
411
431
|
LinuxStat::Net.total_bytes()
|
412
|
-
=> {:received=>
|
432
|
+
=> {:received=>687677565, :transmitted=>149550163}
|
413
433
|
|
414
434
|
# File: net.rb | Line: 41
|
415
435
|
# Definition: def total_bytes_received
|
416
436
|
LinuxStat::Net.total_bytes_received()
|
417
|
-
=>
|
437
|
+
=> 687677565
|
418
438
|
|
419
439
|
# File: net.rb | Line: 54
|
420
440
|
# Definition: def total_bytes_transmitted
|
421
441
|
LinuxStat::Net.total_bytes_transmitted()
|
422
|
-
=>
|
442
|
+
=> 149550163
|
423
443
|
|
424
444
|
# File: net.rb | Line: 80
|
425
445
|
# Definition: def usage(interval = 0.1)
|
@@ -428,10 +448,6 @@ LinuxStat::Net.usage(interval)
|
|
428
448
|
|
429
449
|
```
|
430
450
|
|
431
|
-
### LinuxStat::Nproc
|
432
|
-
```
|
433
|
-
```
|
434
|
-
|
435
451
|
### LinuxStat::OS
|
436
452
|
```
|
437
453
|
# File: os.rb | Line: 97
|
@@ -472,7 +488,7 @@ LinuxStat::OS.os_release()
|
|
472
488
|
# File: os.rb | Line: 110
|
473
489
|
# Definition: def uptime
|
474
490
|
LinuxStat::OS.uptime()
|
475
|
-
=> {:hour=>
|
491
|
+
=> {:hour=>6, :minute=>50, :second=>39.61}
|
476
492
|
|
477
493
|
```
|
478
494
|
|
@@ -480,23 +496,23 @@ LinuxStat::OS.uptime()
|
|
480
496
|
```
|
481
497
|
# File: prettify_bytes.rb | Line: 42
|
482
498
|
# Definition: def convert_binary(n)
|
483
|
-
LinuxStat::PrettifyBytes.convert_binary(n =
|
484
|
-
=> "
|
499
|
+
LinuxStat::PrettifyBytes.convert_binary(n = 200152828322898)
|
500
|
+
=> "182.04 tebibytes"
|
485
501
|
|
486
502
|
# File: prettify_bytes.rb | Line: 19
|
487
503
|
# Definition: def convert_decimal(n)
|
488
|
-
LinuxStat::PrettifyBytes.convert_decimal(n =
|
489
|
-
=> "
|
504
|
+
LinuxStat::PrettifyBytes.convert_decimal(n = 434440373786022)
|
505
|
+
=> "434.44 terabytes"
|
490
506
|
|
491
507
|
# File: prettify_bytes.rb | Line: 90
|
492
508
|
# Definition: def convert_short_binary(n)
|
493
|
-
LinuxStat::PrettifyBytes.convert_short_binary(n =
|
494
|
-
=> "
|
509
|
+
LinuxStat::PrettifyBytes.convert_short_binary(n = 88309228425306)
|
510
|
+
=> "80.32 TiB"
|
495
511
|
|
496
512
|
# File: prettify_bytes.rb | Line: 65
|
497
513
|
# Definition: def convert_short_decimal(n)
|
498
|
-
LinuxStat::PrettifyBytes.convert_short_decimal(n =
|
499
|
-
=> "
|
514
|
+
LinuxStat::PrettifyBytes.convert_short_decimal(n = 238518247519978)
|
515
|
+
=> "238.52 TB"
|
500
516
|
|
501
517
|
```
|
502
518
|
|
@@ -505,12 +521,12 @@ LinuxStat::PrettifyBytes.convert_short_decimal(n = 957289578618866)
|
|
505
521
|
# File: process.rb | Line: 19
|
506
522
|
# Definition: def count
|
507
523
|
LinuxStat::Process.count()
|
508
|
-
=>
|
524
|
+
=> 195
|
509
525
|
|
510
526
|
# File: process.rb | Line: 71
|
511
527
|
# Definition: def idle
|
512
528
|
LinuxStat::Process.idle()
|
513
|
-
=> [3, 4, 6, 9, 12, 23, 30, 37, 39, 49, 102, 103, 104, 106, 107, 108, 109, 110, 117, 118, 119, 121, 131, 134, 140, 152, 153,
|
529
|
+
=> [3, 4, 6, 9, 12, 23, 30, 37, 39, 49, 102, 103, 104, 106, 107, 108, 109, 110, 117, 118, 119, 121, 131, 134, 140, 152, 153, 173, 175, 177, 180, 182, 186, 187, 188, 189, 190, 191, 193, 237, 273, 325, 329, 335, 9051, 9055, 9056, 9057, 9058, 9059, 9060, 13...
|
514
530
|
|
515
531
|
# File: process.rb | Line: 8
|
516
532
|
# Definition: def list
|
@@ -525,12 +541,12 @@ LinuxStat::Process.names()
|
|
525
541
|
# File: process.rb | Line: 97
|
526
542
|
# Definition: def running
|
527
543
|
LinuxStat::Process.running()
|
528
|
-
=> [
|
544
|
+
=> [15978]
|
529
545
|
|
530
546
|
# File: process.rb | Line: 58
|
531
547
|
# Definition: def sleeping
|
532
548
|
LinuxStat::Process.sleeping()
|
533
|
-
=> [1, 2, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 26, 27, 28, 31, 32, 33, 34, 35, 38, 40, 41, 42, 46, 47, 48, 50, 51, 52, 112, 114, 115,
|
549
|
+
=> [1, 2, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 24, 25, 26, 27, 28, 31, 32, 33, 34, 35, 38, 40, 41, 42, 46, 47, 48, 50, 51, 52, 112, 114, 115, 172, 174, 192, 222, 238, 310, 311, 312, 313, 315, 324, 327, 332, 333, 334, 336, 347, 349, 351, 384, 412,...
|
534
550
|
|
535
551
|
# File: process.rb | Line: 37
|
536
552
|
# Definition: def types
|
@@ -549,7 +565,7 @@ LinuxStat::Process.zombie()
|
|
549
565
|
# File: process_info.rb | Line: 54
|
550
566
|
# Definition: def cmdline(pid = $$)
|
551
567
|
LinuxStat::ProcessInfo.cmdline(pid)
|
552
|
-
=> "ruby /
|
568
|
+
=> "/usr/bin/ruby /home/sourav/.gem/ruby/2.7.0/bin/linuxstat.rb -md"
|
553
569
|
|
554
570
|
# File: process_info.rb | Line: 78
|
555
571
|
# Definition: def command_name(pid = $$)
|
@@ -564,7 +580,7 @@ LinuxStat::ProcessInfo.count_cpu(pid)
|
|
564
580
|
# File: process_info.rb | Line: 247
|
565
581
|
# Definition: def cpu_stat(pid: $$, sleep: ticks_to_ms_t5)
|
566
582
|
LinuxStat::ProcessInfo.cpu_stat(pid:, sleep:)
|
567
|
-
=> {:cpu_usage=>0.0, :threads=>1, :last_executed_cpu=>
|
583
|
+
=> {:cpu_usage=>0.0, :threads=>1, :last_executed_cpu=>3}
|
568
584
|
|
569
585
|
# File: process_info.rb | Line: 307
|
570
586
|
# Definition: def cpu_usage(pid: $$, sleep: ticks_to_ms_t5)
|
@@ -579,17 +595,17 @@ LinuxStat::ProcessInfo.gid(pid)
|
|
579
595
|
# File: process_info.rb | Line: 433
|
580
596
|
# Definition: def last_executed_cpu(pid = $$)
|
581
597
|
LinuxStat::ProcessInfo.last_executed_cpu(pid)
|
582
|
-
=>
|
598
|
+
=> 3
|
583
599
|
|
584
600
|
# File: process_info.rb | Line: 114
|
585
601
|
# Definition: def mem_stat(pid = $$)
|
586
602
|
LinuxStat::ProcessInfo.mem_stat(pid)
|
587
|
-
=> {:memory=>
|
603
|
+
=> {:memory=>12627.968, :virtual_memory=>84221.952, :resident_memory=>18743.296}
|
588
604
|
|
589
605
|
# File: process_info.rb | Line: 147
|
590
606
|
# Definition: def memory(pid = $$)
|
591
607
|
LinuxStat::ProcessInfo.memory(pid)
|
592
|
-
=>
|
608
|
+
=> 12627.968
|
593
609
|
|
594
610
|
# File: process_info.rb | Line: 607
|
595
611
|
# Definition: def nice(pid = $$)
|
@@ -609,7 +625,7 @@ LinuxStat::ProcessInfo.owner(pid)
|
|
609
625
|
# File: process_info.rb | Line: 197
|
610
626
|
# Definition: def resident_memory(pid = $$)
|
611
627
|
LinuxStat::ProcessInfo.resident_memory(pid)
|
612
|
-
=>
|
628
|
+
=> 18743.296
|
613
629
|
|
614
630
|
# File: process_info.rb | Line: 563
|
615
631
|
# Definition: def running_time(pid = $$)
|
@@ -619,12 +635,12 @@ LinuxStat::ProcessInfo.running_time(pid)
|
|
619
635
|
# File: process_info.rb | Line: 544
|
620
636
|
# Definition: def start_time(pid = $$)
|
621
637
|
LinuxStat::ProcessInfo.start_time(pid)
|
622
|
-
=> 2020-12-
|
638
|
+
=> 2020-12-24 19:05:51 +0530
|
623
639
|
|
624
640
|
# File: process_info.rb | Line: 513
|
625
641
|
# Definition: def start_time_epoch(pid = $$)
|
626
642
|
LinuxStat::ProcessInfo.start_time_epoch(pid)
|
627
|
-
=>
|
643
|
+
=> 1608816951
|
628
644
|
|
629
645
|
# File: process_info.rb | Line: 592
|
630
646
|
# Definition: def state(pid = $$)
|
@@ -654,7 +670,7 @@ LinuxStat::ProcessInfo.uid(pid)
|
|
654
670
|
# File: process_info.rb | Line: 172
|
655
671
|
# Definition: def virtual_memory(pid = $$)
|
656
672
|
LinuxStat::ProcessInfo.virtual_memory(pid)
|
657
|
-
=>
|
673
|
+
=> 84221.952
|
658
674
|
|
659
675
|
```
|
660
676
|
|
@@ -668,27 +684,27 @@ LinuxStat::Swap.any?()
|
|
668
684
|
# File: swap.rb | Line: 68
|
669
685
|
# Definition: def available
|
670
686
|
LinuxStat::Swap.available()
|
671
|
-
=>
|
687
|
+
=> 4064380
|
672
688
|
|
673
689
|
# File: swap.rb | Line: 8
|
674
690
|
# Definition: def list
|
675
691
|
LinuxStat::Swap.list()
|
676
|
-
=> {"/dev/zram0"=>[:partition, 4194300,
|
692
|
+
=> {"/dev/zram0"=>[:partition, 4194300, 129920, -2]}
|
677
693
|
|
678
694
|
# File: swap.rb | Line: 103
|
679
695
|
# Definition: def percent_available
|
680
696
|
LinuxStat::Swap.percent_available()
|
681
|
-
=>
|
697
|
+
=> 96.9
|
682
698
|
|
683
699
|
# File: swap.rb | Line: 89
|
684
700
|
# Definition: def percent_used
|
685
701
|
LinuxStat::Swap.percent_used()
|
686
|
-
=>
|
702
|
+
=> 3.1
|
687
703
|
|
688
704
|
# File: swap.rb | Line: 32
|
689
705
|
# Definition: def stat
|
690
706
|
LinuxStat::Swap.stat()
|
691
|
-
=> {:total=>4194300, :used=>
|
707
|
+
=> {:total=>4194300, :used=>129920, :available=>4064380, :percent_used=>3.1, :percent_available=>96.9}
|
692
708
|
|
693
709
|
# File: swap.rb | Line: 57
|
694
710
|
# Definition: def total
|
@@ -698,14 +714,14 @@ LinuxStat::Swap.total()
|
|
698
714
|
# File: swap.rb | Line: 80
|
699
715
|
# Definition: def used
|
700
716
|
LinuxStat::Swap.used()
|
701
|
-
=>
|
717
|
+
=> 129920
|
702
718
|
|
703
719
|
```
|
704
720
|
|
705
721
|
### LinuxStat::Sysconf
|
706
722
|
```
|
707
723
|
LinuxStat::Sysconf.child_max()
|
708
|
-
=>
|
724
|
+
=> nil
|
709
725
|
|
710
726
|
LinuxStat::Sysconf.expr_nest_max()
|
711
727
|
=> 32
|
@@ -741,7 +757,7 @@ LinuxStat::Sysconf.pagesize()
|
|
741
757
|
=> 4096
|
742
758
|
|
743
759
|
LinuxStat::Sysconf.posix_version()
|
744
|
-
=>
|
760
|
+
=> 4201
|
745
761
|
|
746
762
|
LinuxStat::Sysconf.processor_configured()
|
747
763
|
=> 4
|
@@ -760,6 +776,25 @@ LinuxStat::Sysconf.tty_name_max()
|
|
760
776
|
|
761
777
|
```
|
762
778
|
|
779
|
+
### LinuxStat::USB
|
780
|
+
```
|
781
|
+
# File: usb.rb | Line: 74
|
782
|
+
# Definition: def count
|
783
|
+
LinuxStat::USB.count()
|
784
|
+
=> 10
|
785
|
+
|
786
|
+
# File: usb.rb | Line: 74
|
787
|
+
# Definition: def count
|
788
|
+
LinuxStat::USB.count_devices()
|
789
|
+
=> 10
|
790
|
+
|
791
|
+
# File: usb.rb | Line: 4
|
792
|
+
# Definition: def devices_stat(hwdata: true)
|
793
|
+
LinuxStat::USB.devices_stat(hwdata:)
|
794
|
+
=> [{:path=>"/sys/bus/usb/devices/1-1.2/", :id=>"04d9:1203", :vendor_id=>"04d9", :product_id=>"1203", :bus_num=>1, :dev_num=>4, :hwdata=>{:vendor=>"Holtek Semiconductor, Inc.", :product=>"Keyboard"}, :authorized=>true, :b_max_power=>"100mA", :b_max_packe...
|
795
|
+
|
796
|
+
```
|
797
|
+
|
763
798
|
### LinuxStat::Uname
|
764
799
|
```
|
765
800
|
LinuxStat::Uname.machine()
|
@@ -1009,7 +1044,12 @@ By using `LinuxStat::CPU.online.count` you count the actual online CPU on your s
|
|
1009
1044
|
|
1010
1045
|
Any n number of CPU can get hotplugged in and out, and this will report that correctly.
|
1011
1046
|
|
1012
|
-
It just gets the info from /sys/devices/system/cpu/online
|
1047
|
+
It just gets the info from /proc/stat; but if it fails it will read /sys/devices/system/cpu/online
|
1048
|
+
and parse the output to get an array.
|
1049
|
+
|
1050
|
+
4. The `LinuxStat::CPU.count_online`
|
1051
|
+
It's a more robust method that counts the online CPU. It shouldn't fail in most if not all cases!
|
1052
|
+
But if it fails for some really spooky reasons, it will return nil.
|
1013
1053
|
|
1014
1054
|
4. The `LinuxStat::CPU.offline()`:
|
1015
1055
|
|