linux_stat 1.3.0 → 1.3.1
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 +230 -229
- data/exe/linuxstat.rb +15 -15
- data/lib/linux_stat/prettify_bytes.rb +9 -9
- data/lib/linux_stat/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7aac48f43d2e992c880104a6a4999033015864cba6b29da049551865c1b88d0a
|
4
|
+
data.tar.gz: ba6032aedb266b20bdd77755f7e436420f6c00a8216d2a93d7b3b1be1400f68d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a4c09eb48782bdcec010a9af8c4690c0def5d1c422449a693595272d9f5345216ac5c7c17225af2b8fcdfba371f2c68f8b2cd84791fd27ee5afe43041026de1
|
7
|
+
data.tar.gz: 536043d49a324a9d536acd473e5c6c7c0d581005ead2e56e73c791ffd570e5b1dff0f782cc9ff3f9cd1f336b9d24e1894313531228a69719f6c66df6a4e27148
|
data/README.md
CHANGED
@@ -87,22 +87,22 @@ For ease of use, LinuxStat is also assigned to the LS constant.
|
|
87
87
|
|
88
88
|
### LinuxStat::BIOS
|
89
89
|
```
|
90
|
-
# File: bios.rb | Line:
|
90
|
+
# File: bios.rb | Line: 58
|
91
91
|
# Definition: def date
|
92
92
|
LinuxStat::BIOS.date()
|
93
93
|
=> "04/10/2017"
|
94
94
|
|
95
|
-
# File: bios.rb | Line:
|
95
|
+
# File: bios.rb | Line: 12
|
96
96
|
# Definition: def model
|
97
97
|
LinuxStat::BIOS.model()
|
98
98
|
=> "Inspiron 5567"
|
99
99
|
|
100
|
-
# File: bios.rb | Line:
|
100
|
+
# File: bios.rb | Line: 29
|
101
101
|
# Definition: def vendor
|
102
102
|
LinuxStat::BIOS.vendor()
|
103
103
|
=> "Dell Inc."
|
104
104
|
|
105
|
-
# File: bios.rb | Line:
|
105
|
+
# File: bios.rb | Line: 44
|
106
106
|
# Definition: def version
|
107
107
|
LinuxStat::BIOS.version()
|
108
108
|
=> "1.1.2"
|
@@ -111,417 +111,417 @@ LinuxStat::BIOS.version()
|
|
111
111
|
|
112
112
|
### LinuxStat::Battery
|
113
113
|
```
|
114
|
-
# File: battery.rb | Line:
|
114
|
+
# File: battery.rb | Line: 107
|
115
115
|
# Definition: def charge
|
116
116
|
LinuxStat::Battery.charge()
|
117
117
|
=> 100.0
|
118
118
|
|
119
|
-
# File: battery.rb | Line:
|
119
|
+
# File: battery.rb | Line: 124
|
120
120
|
# Definition: def charge_full_design_wh
|
121
121
|
LinuxStat::Battery.charge_full_design_wh()
|
122
122
|
=> 42.0
|
123
123
|
|
124
|
-
# File: battery.rb | Line:
|
124
|
+
# File: battery.rb | Line: 143
|
125
125
|
# Definition: def charge_full_wh
|
126
126
|
LinuxStat::Battery.charge_full_wh()
|
127
127
|
=> 23.79
|
128
128
|
|
129
|
-
# File: battery.rb | Line:
|
129
|
+
# File: battery.rb | Line: 80
|
130
130
|
# Definition: def charging?
|
131
131
|
LinuxStat::Battery.charging?()
|
132
132
|
=> true
|
133
133
|
|
134
|
-
# File: battery.rb | Line:
|
134
|
+
# File: battery.rb | Line: 186
|
135
135
|
# Definition: def devices_stat
|
136
136
|
LinuxStat::Battery.devices_stat()
|
137
137
|
=> {: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....
|
138
138
|
|
139
|
-
# File: battery.rb | Line:
|
139
|
+
# File: battery.rb | Line: 89
|
140
140
|
# Definition: def discharging?
|
141
141
|
LinuxStat::Battery.discharging?()
|
142
142
|
=> false
|
143
143
|
|
144
|
-
# File: battery.rb | Line:
|
144
|
+
# File: battery.rb | Line: 98
|
145
145
|
# Definition: def full?
|
146
146
|
LinuxStat::Battery.full?()
|
147
147
|
=> true
|
148
148
|
|
149
|
-
# File: battery.rb | Line:
|
149
|
+
# File: battery.rb | Line: 49
|
150
150
|
# Definition: def manufacturer
|
151
151
|
LinuxStat::Battery.manufacturer()
|
152
152
|
=> "Samsung SDI"
|
153
153
|
|
154
|
-
# File: battery.rb | Line:
|
154
|
+
# File: battery.rb | Line: 38
|
155
155
|
# Definition: def model
|
156
156
|
LinuxStat::Battery.model()
|
157
157
|
=> "DELL CYMGM77"
|
158
158
|
|
159
|
-
# File: battery.rb | Line:
|
159
|
+
# File: battery.rb | Line: 10
|
160
160
|
# Definition: def present?
|
161
161
|
LinuxStat::Battery.present?()
|
162
162
|
=> true
|
163
163
|
|
164
|
-
# File: battery.rb | Line:
|
164
|
+
# File: battery.rb | Line: 18
|
165
165
|
# Definition: def stat
|
166
166
|
LinuxStat::Battery.stat()
|
167
167
|
=> {:model=>"DELL CYMGM77", :manufacturer=>"Samsung SDI", :technology=>"Li-ion", :status=>"Full", :charge=>100.0, :charging=>true, :discharging=>false, :full=>true}
|
168
168
|
|
169
|
-
# File: battery.rb | Line:
|
169
|
+
# File: battery.rb | Line: 70
|
170
170
|
# Definition: def status
|
171
171
|
LinuxStat::Battery.status()
|
172
172
|
=> "Full"
|
173
173
|
|
174
|
-
# File: battery.rb | Line:
|
174
|
+
# File: battery.rb | Line: 59
|
175
175
|
# Definition: def technology
|
176
176
|
LinuxStat::Battery.technology()
|
177
177
|
=> "Li-ion"
|
178
178
|
|
179
|
-
# File: battery.rb | Line:
|
179
|
+
# File: battery.rb | Line: 162
|
180
180
|
# Definition: def voltage_now
|
181
181
|
LinuxStat::Battery.voltage_now()
|
182
|
-
=> 12.
|
182
|
+
=> 12.568
|
183
183
|
|
184
184
|
```
|
185
185
|
|
186
186
|
### LinuxStat::CPU
|
187
187
|
```
|
188
|
-
# File: cpu.rb | Line:
|
188
|
+
# File: cpu.rb | Line: 289
|
189
189
|
# Definition: def available_governors
|
190
190
|
LinuxStat::CPU.available_governors()
|
191
191
|
=> {"cpu0"=>["performance", "powersave"], "cpu1"=>["performance", "powersave"], "cpu2"=>["performance", "powersave"], "cpu3"=>["performance", "powersave"]}
|
192
192
|
|
193
|
-
# File: cpu.rb | Line:
|
193
|
+
# File: cpu.rb | Line: 88
|
194
194
|
# Definition: def count
|
195
195
|
LinuxStat::CPU.count()
|
196
196
|
=> 4
|
197
197
|
|
198
|
-
# File: cpu.rb | Line:
|
198
|
+
# File: cpu.rb | Line: 105
|
199
199
|
# Definition: def count_online
|
200
200
|
LinuxStat::CPU.count_online()
|
201
201
|
=> 4
|
202
202
|
|
203
|
-
# File: cpu.rb | Line:
|
203
|
+
# File: cpu.rb | Line: 199
|
204
204
|
# Definition: def cur_freq
|
205
205
|
LinuxStat::CPU.cur_freq()
|
206
|
-
=> {"cpu0"=>
|
206
|
+
=> {"cpu0"=>2000039, "cpu1"=>1974506, "cpu2"=>2000003, "cpu3"=>2000119}
|
207
207
|
|
208
|
-
# File: cpu.rb | Line:
|
208
|
+
# File: cpu.rb | Line: 267
|
209
209
|
# Definition: def governor
|
210
210
|
LinuxStat::CPU.governor()
|
211
211
|
=> {"cpu0"=>"performance", "cpu1"=>"performance", "cpu2"=>"performance", "cpu3"=>"performance"}
|
212
212
|
|
213
|
-
# File: cpu.rb | Line:
|
213
|
+
# File: cpu.rb | Line: 243
|
214
214
|
# Definition: def max_freq
|
215
215
|
LinuxStat::CPU.max_freq()
|
216
216
|
=> {"cpu0"=>2000000, "cpu1"=>2000000, "cpu2"=>2000000, "cpu3"=>2000000}
|
217
217
|
|
218
|
-
# File: cpu.rb | Line:
|
218
|
+
# File: cpu.rb | Line: 221
|
219
219
|
# Definition: def min_freq
|
220
220
|
LinuxStat::CPU.min_freq()
|
221
221
|
=> {"cpu0"=>2000000, "cpu1"=>2000000, "cpu2"=>2000000, "cpu3"=>2000000}
|
222
222
|
|
223
|
-
# File: cpu.rb | Line:
|
223
|
+
# File: cpu.rb | Line: 186
|
224
224
|
# Definition: def model
|
225
225
|
LinuxStat::CPU.model()
|
226
226
|
=> "Intel(R) Core(TM) i3-6006U CPU @ 2.00GHz"
|
227
227
|
|
228
|
-
# File: cpu.rb | Line:
|
228
|
+
# File: cpu.rb | Line: 165
|
229
229
|
# Definition: def offline
|
230
230
|
LinuxStat::CPU.offline()
|
231
231
|
=> []
|
232
232
|
|
233
|
-
# File: cpu.rb | Line:
|
233
|
+
# File: cpu.rb | Line: 134
|
234
234
|
# Definition: def online
|
235
235
|
LinuxStat::CPU.online()
|
236
236
|
=> [0, 1, 2, 3]
|
237
237
|
|
238
|
-
# File: cpu.rb | Line:
|
238
|
+
# File: cpu.rb | Line: 25
|
239
239
|
# Definition: def stat(sleep = ticks_to_ms_t5)
|
240
240
|
LinuxStat::CPU.stat(sleep)
|
241
|
-
=> {0=>10.0, 1=>
|
241
|
+
=> {0=>10.0, 1=>20.0, 2=>0.0, 3=>0.0, 4=>0.0}
|
242
242
|
|
243
|
-
# File: cpu.rb | Line:
|
243
|
+
# File: cpu.rb | Line: 65
|
244
244
|
# Definition: def total_usage(sleep = ticks_to_ms_t5)
|
245
245
|
LinuxStat::CPU.total_usage(sleep)
|
246
|
-
=>
|
246
|
+
=> 10.53
|
247
247
|
|
248
|
-
# File: cpu.rb | Line:
|
248
|
+
# File: cpu.rb | Line: 65
|
249
249
|
# Definition: def total_usage(sleep = ticks_to_ms_t5)
|
250
250
|
LinuxStat::CPU.usage(sleep)
|
251
251
|
=> 5.26
|
252
252
|
|
253
|
-
# File: cpu.rb | Line:
|
253
|
+
# File: cpu.rb | Line: 25
|
254
254
|
# Definition: def stat(sleep = ticks_to_ms_t5)
|
255
255
|
LinuxStat::CPU.usages(sleep)
|
256
|
-
=> {0=>
|
256
|
+
=> {0=>19.05, 1=>16.67, 2=>20.0, 3=>16.67, 4=>20.0}
|
257
257
|
|
258
258
|
```
|
259
259
|
|
260
260
|
### LinuxStat::FS
|
261
261
|
```
|
262
262
|
LinuxStat::FS.stat(arg = "/")
|
263
|
-
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>
|
263
|
+
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>7973766, :block_avail_unpriv=>7973766, :inodes=>58612160, :free_inodes=>57034519, :filesystem_id=>2050, :mount_flags=>1024, :max_filename_length=>255}
|
264
264
|
|
265
265
|
```
|
266
266
|
|
267
267
|
### LinuxStat::Filesystem
|
268
268
|
```
|
269
|
-
# File: filesystem.rb | Line:
|
269
|
+
# File: filesystem.rb | Line: 94
|
270
270
|
# Definition: def available(fs = ?..freeze)
|
271
271
|
LinuxStat::Filesystem.available(fs)
|
272
|
-
=>
|
272
|
+
=> 32660545536
|
273
273
|
|
274
|
-
# File: filesystem.rb | Line:
|
274
|
+
# File: filesystem.rb | Line: 60
|
275
275
|
# Definition: def free(fs = ?..freeze)
|
276
276
|
LinuxStat::Filesystem.free(fs)
|
277
|
-
=>
|
277
|
+
=> 32660545536
|
278
278
|
|
279
|
-
# File: filesystem.rb | Line:
|
279
|
+
# File: filesystem.rb | Line: 21
|
280
280
|
# Definition: def stat(fs = ?..freeze)
|
281
281
|
LinuxStat::Filesystem.stat(fs)
|
282
|
-
=> {:total=>119981191168, :free=>
|
282
|
+
=> {:total=>119981191168, :free=>32660545536, :used=>87320645632}
|
283
283
|
|
284
|
-
# File: filesystem.rb | Line:
|
284
|
+
# File: filesystem.rb | Line: 110
|
285
285
|
# Definition: def stat_raw(fs = ?..freeze)
|
286
286
|
LinuxStat::Filesystem.stat_raw(fs)
|
287
|
-
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>
|
287
|
+
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>7973766, :block_avail_unpriv=>7973766, :inodes=>58612160, :free_inodes=>57034519, :filesystem_id=>2050, :mount_flags=>1024, :max_filename_length=>255}
|
288
288
|
|
289
|
-
# File: filesystem.rb | Line:
|
289
|
+
# File: filesystem.rb | Line: 41
|
290
290
|
# Definition: def total(fs = ?..freeze)
|
291
291
|
LinuxStat::Filesystem.total(fs)
|
292
292
|
=> 119981191168
|
293
293
|
|
294
|
-
# File: filesystem.rb | Line:
|
294
|
+
# File: filesystem.rb | Line: 75
|
295
295
|
# Definition: def used(fs = ?..freeze)
|
296
296
|
LinuxStat::Filesystem.used(fs)
|
297
|
-
=>
|
297
|
+
=> 87320645632
|
298
298
|
|
299
299
|
```
|
300
300
|
|
301
301
|
### LinuxStat::Kernel
|
302
302
|
```
|
303
|
-
# File: kernel.rb | Line:
|
303
|
+
# File: kernel.rb | Line: 88
|
304
304
|
# Definition: def build_date
|
305
305
|
LinuxStat::Kernel.build_date()
|
306
|
-
=> 2020-
|
306
|
+
=> 2020-11-20 07:44:55 +0000
|
307
307
|
|
308
|
-
# File: kernel.rb | Line:
|
308
|
+
# File: kernel.rb | Line: 142
|
309
309
|
# Definition: def build_date_string
|
310
310
|
LinuxStat::Kernel.build_date_string()
|
311
|
-
=> "
|
311
|
+
=> "20 Nov 2020 07:44:55 +0000"
|
312
312
|
|
313
|
-
# File: kernel.rb | Line:
|
313
|
+
# File: kernel.rb | Line: 23
|
314
314
|
# Definition: def build_user
|
315
315
|
LinuxStat::Kernel.build_user()
|
316
316
|
=> "souravgoswami@archlinux"
|
317
317
|
|
318
|
-
# File: kernel.rb | Line:
|
318
|
+
# File: kernel.rb | Line: 181
|
319
319
|
# Definition: def ticks
|
320
320
|
LinuxStat::Kernel.clk_tck()
|
321
321
|
=> 100
|
322
322
|
|
323
|
-
# File: kernel.rb | Line:
|
323
|
+
# File: kernel.rb | Line: 35
|
324
324
|
# Definition: def compiler
|
325
325
|
LinuxStat::Kernel.compiler()
|
326
326
|
=> [:gcc, "10.2.0"]
|
327
327
|
|
328
|
-
# File: kernel.rb | Line:
|
328
|
+
# File: kernel.rb | Line: 57
|
329
329
|
# Definition: def compiler_version
|
330
330
|
LinuxStat::Kernel.compiler_version()
|
331
331
|
=> "10.2.0"
|
332
332
|
|
333
|
-
# File: kernel.rb | Line:
|
333
|
+
# File: kernel.rb | Line: 12
|
334
334
|
# Definition: def version
|
335
335
|
LinuxStat::Kernel.release()
|
336
|
-
=> "5.
|
336
|
+
=> "5.9.9-xanmod1-1"
|
337
337
|
|
338
|
-
# File: kernel.rb | Line:
|
338
|
+
# File: kernel.rb | Line: 171
|
339
339
|
# Definition: def string
|
340
340
|
LinuxStat::Kernel.string()
|
341
|
-
=> "Linux version 5.
|
341
|
+
=> "Linux version 5.9.9-xanmod1-1 (souravgoswami@archlinux) (gcc (GCC) 10.2.0, GNU ld (GNU Binutils) 2.35.1) #1 SMP PREEMPT Fri, 20 Nov 2020 07:44:55 +0000"
|
342
342
|
|
343
|
-
# File: kernel.rb | Line:
|
343
|
+
# File: kernel.rb | Line: 181
|
344
344
|
# Definition: def ticks
|
345
345
|
LinuxStat::Kernel.ticks()
|
346
346
|
=> 100
|
347
347
|
|
348
|
-
# File: kernel.rb | Line:
|
348
|
+
# File: kernel.rb | Line: 12
|
349
349
|
# Definition: def version
|
350
350
|
LinuxStat::Kernel.version()
|
351
|
-
=> "5.
|
351
|
+
=> "5.9.9-xanmod1-1"
|
352
352
|
|
353
353
|
```
|
354
354
|
|
355
355
|
### LinuxStat::Memory
|
356
356
|
```
|
357
|
-
# File: memory.rb | Line:
|
357
|
+
# File: memory.rb | Line: 52
|
358
358
|
# Definition: def available
|
359
359
|
LinuxStat::Memory.available()
|
360
|
-
=>
|
360
|
+
=> 234436
|
361
361
|
|
362
|
-
# File: memory.rb | Line:
|
362
|
+
# File: memory.rb | Line: 83
|
363
363
|
# Definition: def percent_available
|
364
364
|
LinuxStat::Memory.percent_available()
|
365
|
-
=>
|
365
|
+
=> 6.11
|
366
366
|
|
367
|
-
# File: memory.rb | Line:
|
367
|
+
# File: memory.rb | Line: 72
|
368
368
|
# Definition: def percent_used
|
369
369
|
LinuxStat::Memory.percent_used()
|
370
|
-
=>
|
370
|
+
=> 93.89
|
371
371
|
|
372
|
-
# File: memory.rb | Line:
|
372
|
+
# File: memory.rb | Line: 13
|
373
373
|
# Definition: def stat
|
374
374
|
LinuxStat::Memory.stat()
|
375
|
-
=> {:total=>
|
375
|
+
=> {:total=>3836236, :used=>3601552, :available=>234684, :percent_used=>93.88, :percent_available=>6.12}
|
376
376
|
|
377
|
-
# File: memory.rb | Line:
|
377
|
+
# File: memory.rb | Line: 42
|
378
378
|
# Definition: def total
|
379
379
|
LinuxStat::Memory.total()
|
380
|
-
=>
|
380
|
+
=> 3836236
|
381
381
|
|
382
|
-
# File: memory.rb | Line:
|
382
|
+
# File: memory.rb | Line: 62
|
383
383
|
# Definition: def used
|
384
384
|
LinuxStat::Memory.used()
|
385
|
-
=>
|
385
|
+
=> 3601552
|
386
386
|
|
387
387
|
```
|
388
388
|
|
389
389
|
### LinuxStat::Mounts
|
390
390
|
```
|
391
|
-
# File: mounts.rb | Line:
|
391
|
+
# File: mounts.rb | Line: 181
|
392
392
|
# Definition: def device_stat(dev = root)
|
393
393
|
LinuxStat::Mounts.device_stat(dev)
|
394
|
-
=> {:mountpoint=>"/", :total=>119981191168, :free=>
|
394
|
+
=> {:mountpoint=>"/", :total=>119981191168, :free=>32660545536, :available=>32660545536, :used=>87320645632, :percent_used=>72.78, :percent_free=>27.22, :percent_available=>27.22}
|
395
395
|
|
396
|
-
# File: mounts.rb | Line:
|
396
|
+
# File: mounts.rb | Line: 139
|
397
397
|
# Definition: def devices_stat
|
398
398
|
LinuxStat::Mounts.devices_stat()
|
399
399
|
=> {"proc"=>{:mountpoint=>"/proc", :total=>0, :free=>0, :available=>0, :used=>0, :percent_used=>NaN, :percent_free=>NaN, :percent_available=>NaN}, "sys"=>{:mountpoint=>"/sys", :total=>0, :free=>0, :available=>0, :used=>0, :percent_used=>NaN, :percent_fre...
|
400
400
|
|
401
|
-
# File: mounts.rb | Line:
|
401
|
+
# File: mounts.rb | Line: 13
|
402
402
|
# Definition: def list
|
403
403
|
LinuxStat::Mounts.list()
|
404
|
-
=> ["proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0", "sys /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0", "dev /dev devtmpfs rw,nosuid,relatime,size=
|
404
|
+
=> ["proc /proc proc rw,nosuid,nodev,noexec,relatime 0 0", "sys /sys sysfs rw,nosuid,nodev,noexec,relatime 0 0", "dev /dev devtmpfs rw,nosuid,relatime,size=1892892k,nr_inodes=473223,mode=755 0 0", "run /run tmpfs rw,nosuid,nodev,relatime,mode=755 0 0", "...
|
405
405
|
|
406
|
-
# File: mounts.rb | Line:
|
406
|
+
# File: mounts.rb | Line: 22
|
407
407
|
# Definition: def list_devices
|
408
408
|
LinuxStat::Mounts.list_devices()
|
409
|
-
=> ["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", "
|
409
|
+
=> ["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", "deb...
|
410
410
|
|
411
|
-
# File: mounts.rb | Line:
|
411
|
+
# File: mounts.rb | Line: 111
|
412
412
|
# Definition: def list_devices_mount_point
|
413
413
|
LinuxStat::Mounts.list_devices_mount_point()
|
414
|
-
=> {"proc"=>"/proc", "sys"=>"/sys", "dev"=>"/dev", "run"=>"/run", "/dev/sda2"=>"/", "securityfs"=>"/sys/kernel/security", "tmpfs"=>"/run/user/
|
414
|
+
=> {"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/rdma", "pstore"=>"/s...
|
415
415
|
|
416
|
-
# File: mounts.rb | Line:
|
416
|
+
# File: mounts.rb | Line: 82
|
417
417
|
# Definition: def mount_point(dev = root)
|
418
418
|
LinuxStat::Mounts.mount_point(dev)
|
419
419
|
=> "/"
|
420
420
|
|
421
|
-
# File: mounts.rb | Line:
|
421
|
+
# File: mounts.rb | Line: 31
|
422
422
|
# Definition: def root
|
423
423
|
LinuxStat::Mounts.root()
|
424
424
|
=> "/dev/sda2"
|
425
425
|
|
426
|
-
# File: mounts.rb | Line:
|
426
|
+
# File: mounts.rb | Line: 40
|
427
427
|
# Definition: def root_fs
|
428
428
|
LinuxStat::Mounts.root_fs()
|
429
429
|
=> "xfs"
|
430
430
|
|
431
|
-
# File: mounts.rb | Line:
|
431
|
+
# File: mounts.rb | Line: 49
|
432
432
|
# Definition: def root_mount_options
|
433
433
|
LinuxStat::Mounts.root_mount_options()
|
434
434
|
=> "rw,noatime,attr2,inode64,logbufs=8,logbsize=32k,noquota"
|
435
435
|
|
436
|
-
# File: mounts.rb | Line:
|
436
|
+
# File: mounts.rb | Line: 58
|
437
437
|
# Definition: def tmpfs
|
438
438
|
LinuxStat::Mounts.tmpfs()
|
439
|
-
=> {"/dev/shm"=>"tmpfs /dev/shm tmpfs rw,nosuid,nodev
|
439
|
+
=> {"/dev/shm"=>"tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0", "/sys/fs/cgroup"=>"tmpfs /sys/fs/cgroup tmpfs ro,nosuid,nodev,noexec,size=4096k,nr_inodes=1024,mode=755 0 0", "/cache"=>"tmpfs /cache tmpfs rw,nosuid,nodev,relatime,size=2097152k 0 0", "/ramdisk...
|
440
440
|
|
441
441
|
```
|
442
442
|
|
443
443
|
### LinuxStat::Net
|
444
444
|
```
|
445
|
-
# File: net.rb | Line:
|
445
|
+
# File: net.rb | Line: 86
|
446
446
|
# Definition: def usage(interval = 0.1)
|
447
447
|
LinuxStat::Net.current_usage(interval)
|
448
|
-
=> {:received=>
|
448
|
+
=> {:received=>0.0, :transmitted=>0.0}
|
449
449
|
|
450
|
-
# File: net.rb | Line:
|
450
|
+
# File: net.rb | Line: 12
|
451
451
|
# Definition: def ipv4_private
|
452
452
|
LinuxStat::Net.ipv4_private()
|
453
|
-
=> "192.168.0.
|
453
|
+
=> "192.168.0.103"
|
454
454
|
|
455
|
-
# File: net.rb | Line:
|
455
|
+
# File: net.rb | Line: 27
|
456
456
|
# Definition: def total_bytes
|
457
457
|
LinuxStat::Net.total_bytes()
|
458
|
-
=> {:received=>
|
458
|
+
=> {:received=>397930237, :transmitted=>54027033}
|
459
459
|
|
460
|
-
# File: net.rb | Line:
|
460
|
+
# File: net.rb | Line: 45
|
461
461
|
# Definition: def total_bytes_received
|
462
462
|
LinuxStat::Net.total_bytes_received()
|
463
|
-
=>
|
463
|
+
=> 397930237
|
464
464
|
|
465
|
-
# File: net.rb | Line:
|
465
|
+
# File: net.rb | Line: 58
|
466
466
|
# Definition: def total_bytes_transmitted
|
467
467
|
LinuxStat::Net.total_bytes_transmitted()
|
468
|
-
=>
|
468
|
+
=> 54027033
|
469
469
|
|
470
|
-
# File: net.rb | Line:
|
470
|
+
# File: net.rb | Line: 86
|
471
471
|
# Definition: def usage(interval = 0.1)
|
472
472
|
LinuxStat::Net.usage(interval)
|
473
|
-
=> {:received=>
|
473
|
+
=> {:received=>0.0, :transmitted=>0.0}
|
474
474
|
|
475
475
|
```
|
476
476
|
|
477
477
|
### LinuxStat::OS
|
478
478
|
```
|
479
|
-
# File: os.rb | Line:
|
479
|
+
# File: os.rb | Line: 129
|
480
480
|
# Definition: def bits
|
481
481
|
LinuxStat::OS.bits()
|
482
482
|
=> 64
|
483
483
|
|
484
|
-
# File: os.rb | Line:
|
484
|
+
# File: os.rb | Line: 84
|
485
485
|
# Definition: def version
|
486
486
|
LinuxStat::OS.distrib_version()
|
487
487
|
=> "rolling"
|
488
488
|
|
489
|
-
# File: os.rb | Line:
|
489
|
+
# File: os.rb | Line: 46
|
490
490
|
# Definition: def distribution
|
491
491
|
LinuxStat::OS.distribution()
|
492
492
|
=> "Arch Linux"
|
493
493
|
|
494
|
-
# File: os.rb | Line:
|
494
|
+
# File: os.rb | Line: 117
|
495
495
|
# Definition: def hostname
|
496
496
|
LinuxStat::OS.hostname()
|
497
497
|
=> "archlinux"
|
498
498
|
|
499
|
-
# File: os.rb | Line:
|
499
|
+
# File: os.rb | Line: 35
|
500
500
|
# Definition: def lsb_release
|
501
501
|
LinuxStat::OS.lsb_release()
|
502
502
|
=> {:LSB_VERSION=>"1.4", :DISTRIB_ID=>"Arch", :DISTRIB_RELEASE=>"rolling", :DISTRIB_DESCRIPTION=>"Arch Linux"}
|
503
503
|
|
504
|
-
# File: os.rb | Line:
|
504
|
+
# File: os.rb | Line: 100
|
505
505
|
# Definition: def machine
|
506
506
|
LinuxStat::OS.machine()
|
507
507
|
=> "x86_64"
|
508
508
|
|
509
|
-
# File: os.rb | Line:
|
509
|
+
# File: os.rb | Line: 108
|
510
510
|
# Definition: def nodename
|
511
511
|
LinuxStat::OS.nodename()
|
512
512
|
=> "archlinux"
|
513
513
|
|
514
|
-
# File: os.rb | Line:
|
514
|
+
# File: os.rb | Line: 19
|
515
515
|
# Definition: def os_release
|
516
516
|
LinuxStat::OS.os_release()
|
517
517
|
=> {:NAME=>"Arch Linux", :PRETTY_NAME=>"Arch Linux", :ID=>"arch", :BUILD_ID=>"rolling", :ANSI_COLOR=>"38;2;23;147;209", :HOME_URL=>"https://www.archlinux.org/", :DOCUMENTATION_URL=>"https://wiki.archlinux.org/", :SUPPORT_URL=>"https://bbs.archlinux.org/"...
|
518
518
|
|
519
|
-
# File: os.rb | Line:
|
519
|
+
# File: os.rb | Line: 144
|
520
520
|
# Definition: def uptime
|
521
521
|
LinuxStat::OS.uptime()
|
522
|
-
=> {:hour=>
|
522
|
+
=> {:hour=>4, :minute=>6, :second=>10.08}
|
523
523
|
|
524
|
-
# File: os.rb | Line:
|
524
|
+
# File: os.rb | Line: 84
|
525
525
|
# Definition: def version
|
526
526
|
LinuxStat::OS.version()
|
527
527
|
=> "rolling"
|
@@ -530,37 +530,37 @@ LinuxStat::OS.version()
|
|
530
530
|
|
531
531
|
### LinuxStat::PCI
|
532
532
|
```
|
533
|
-
# File: pci.rb | Line:
|
533
|
+
# File: pci.rb | Line: 216
|
534
534
|
# Definition: def count
|
535
535
|
LinuxStat::PCI.count()
|
536
536
|
=> 13
|
537
537
|
|
538
|
-
# File: pci.rb | Line:
|
538
|
+
# File: pci.rb | Line: 216
|
539
539
|
# Definition: def count
|
540
540
|
LinuxStat::PCI.count_devices()
|
541
541
|
=> 13
|
542
542
|
|
543
|
-
# File: pci.rb | Line:
|
543
|
+
# File: pci.rb | Line: 54
|
544
544
|
# Definition: def devices_info(hwdata: true)
|
545
545
|
LinuxStat::PCI.devices_info(hwdata:)
|
546
546
|
=> [{:id=>"8086:1904", :vendor=>"8086", :device=>"1904", :irq=>0, :kernel_driver=>"skl_uncore", :hwdata=>{:vendor=>"Intel Corporation", :product=>"Xeon E3-1200 v5/E3-1500 v5/6th Gen Core Processor Host Bridge/DRAM Registers"}}, {:id=>"8086:1916", :vendor...
|
547
547
|
|
548
|
-
# File: pci.rb | Line:
|
548
|
+
# File: pci.rb | Line: 130
|
549
549
|
# Definition: def devices_stat(hwdata: true)
|
550
550
|
LinuxStat::PCI.devices_stat(hwdata:)
|
551
551
|
=> [{:path=>"/sys/bus/pci/devices/0000:00:00.0/", :id=>"8086:1904", :vendor=>"8086", :device=>"1904", :sub_vendor=>"1028", :sub_device=>"077d", :kernel_driver=>"skl_uncore", :revision=>"0x08", :irq=>0, :enable=>false, :hwdata=>{:vendor=>"Intel Corporatio...
|
552
552
|
|
553
|
-
# File: pci.rb | Line:
|
553
|
+
# File: pci.rb | Line: 264
|
554
554
|
# Definition: def hwdata_file
|
555
555
|
LinuxStat::PCI.hwdata_file()
|
556
556
|
=> "/usr/share/hwdata/pci.ids"
|
557
557
|
|
558
|
-
# File: pci.rb | Line:
|
558
|
+
# File: pci.rb | Line: 253
|
559
559
|
# Definition: def hwdata_file_set?
|
560
560
|
LinuxStat::PCI.hwdata_file_set?()
|
561
561
|
=> true
|
562
562
|
|
563
|
-
# File: pci.rb | Line:
|
563
|
+
# File: pci.rb | Line: 280
|
564
564
|
# Definition: def initialize_hwdata
|
565
565
|
LinuxStat::PCI.initialize_hwdata()
|
566
566
|
=> false
|
@@ -569,66 +569,66 @@ LinuxStat::PCI.initialize_hwdata()
|
|
569
569
|
|
570
570
|
### LinuxStat::PrettifyBytes
|
571
571
|
```
|
572
|
-
# File: prettify_bytes.rb | Line:
|
573
|
-
# Definition: def convert_binary(n)
|
574
|
-
LinuxStat::PrettifyBytes.convert_binary(n =
|
575
|
-
=> "
|
572
|
+
# File: prettify_bytes.rb | Line: 49
|
573
|
+
# Definition: def convert_binary(n, precision: 2)
|
574
|
+
LinuxStat::PrettifyBytes.convert_binary(n = 869660338047082, precision:)
|
575
|
+
=> "790.95 tebibytes"
|
576
576
|
|
577
|
-
# File: prettify_bytes.rb | Line:
|
578
|
-
# Definition: def convert_decimal(n)
|
579
|
-
LinuxStat::PrettifyBytes.convert_decimal(n =
|
580
|
-
=> "
|
577
|
+
# File: prettify_bytes.rb | Line: 26
|
578
|
+
# Definition: def convert_decimal(n, precision: 2)
|
579
|
+
LinuxStat::PrettifyBytes.convert_decimal(n = 670910793487164, precision:)
|
580
|
+
=> "670.91 terabytes"
|
581
581
|
|
582
|
-
# File: prettify_bytes.rb | Line:
|
583
|
-
# Definition: def convert_short_binary(n)
|
584
|
-
LinuxStat::PrettifyBytes.convert_short_binary(n =
|
585
|
-
=> "
|
582
|
+
# File: prettify_bytes.rb | Line: 97
|
583
|
+
# Definition: def convert_short_binary(n, precision: 2)
|
584
|
+
LinuxStat::PrettifyBytes.convert_short_binary(n = 219452702414885, precision:)
|
585
|
+
=> "199.59 TiB"
|
586
586
|
|
587
|
-
# File: prettify_bytes.rb | Line:
|
588
|
-
# Definition: def convert_short_decimal(n)
|
589
|
-
LinuxStat::PrettifyBytes.convert_short_decimal(n =
|
590
|
-
=> "
|
587
|
+
# File: prettify_bytes.rb | Line: 72
|
588
|
+
# Definition: def convert_short_decimal(n, precision: 2)
|
589
|
+
LinuxStat::PrettifyBytes.convert_short_decimal(n = 65685406640389, precision:)
|
590
|
+
=> "65.69 TB"
|
591
591
|
|
592
592
|
```
|
593
593
|
|
594
594
|
### LinuxStat::Process
|
595
595
|
```
|
596
|
-
# File: process.rb | Line:
|
596
|
+
# File: process.rb | Line: 29
|
597
597
|
# Definition: def count
|
598
598
|
LinuxStat::Process.count()
|
599
|
-
=>
|
599
|
+
=> 211
|
600
600
|
|
601
|
-
# File: process.rb | Line:
|
601
|
+
# File: process.rb | Line: 96
|
602
602
|
# Definition: def idle
|
603
603
|
LinuxStat::Process.idle()
|
604
|
-
=> [3, 4,
|
604
|
+
=> [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, 166, 168, 170, 171, 174, 176, 181, 182, 183, 184, 185, 186, 187, 189, 230, 234, 286, 427, 428, 430, 4921, 4922, 4923, 4924, 4925, 4926, 103...
|
605
605
|
|
606
|
-
# File: process.rb | Line:
|
606
|
+
# File: process.rb | Line: 11
|
607
607
|
# Definition: def list
|
608
608
|
LinuxStat::Process.list()
|
609
|
-
=> [1, 2, 3, 4,
|
609
|
+
=> [1, 2, 3, 4, 6, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 23, 24, 25, 26, 27, 28, 30, 31, 32, 33, 34, 35, 37, 38, 39, 40, 41, 42, 46, 47, 48, 49, 50, 51, 52, 102, 103, 104, 106, 107, 108, 109, 110, 112, 114, 115, 117, 118, 119, 121, 131, 134,...
|
610
610
|
|
611
|
-
# File: process.rb | Line:
|
611
|
+
# File: process.rb | Line: 35
|
612
612
|
# Definition: def names
|
613
613
|
LinuxStat::Process.names()
|
614
|
-
=> {1=>"systemd", 2=>"kthreadd", 3=>"rcu_gp", 4=>"rcu_par_gp",
|
614
|
+
=> {1=>"systemd", 2=>"kthreadd", 3=>"rcu_gp", 4=>"rcu_par_gp", 6=>"kworker/0:0H-kblockd", 9=>"mm_percpu_wq", 10=>"ksoftirqd/0", 11=>"rcuc/0", 12=>"rcu_preempt", 13=>"rcub/0", 14=>"migration/0", 15=>"idle_inject/0", 16=>"cpuhp/0", 17=>"cpuhp/1", 18=>"idle...
|
615
615
|
|
616
|
-
# File: process.rb | Line:
|
616
|
+
# File: process.rb | Line: 122
|
617
617
|
# Definition: def running
|
618
618
|
LinuxStat::Process.running()
|
619
|
-
=> [
|
619
|
+
=> [15720]
|
620
620
|
|
621
|
-
# File: process.rb | Line:
|
621
|
+
# File: process.rb | Line: 83
|
622
622
|
# Definition: def sleeping
|
623
623
|
LinuxStat::Process.sleeping()
|
624
|
-
=> [1, 2, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 24, 25, 26, 27, 28, 31, 32, 33, 34, 35, 38, 40, 41, 42,
|
624
|
+
=> [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, 165, 167, 190, 218, 235, 236, 275, 360, 377, 379, 381, 386, 426, 429, 445, 446, 447, 449, 465, 467, 472,...
|
625
625
|
|
626
|
-
# File: process.rb | Line:
|
626
|
+
# File: process.rb | Line: 54
|
627
627
|
# Definition: def types
|
628
628
|
LinuxStat::Process.types()
|
629
|
-
=> {1=>:sleeping, 2=>:sleeping, 3=>:idle, 4=>:idle,
|
629
|
+
=> {1=>:sleeping, 2=>:sleeping, 3=>:idle, 4=>:idle, 6=>:idle, 9=>:idle, 10=>:sleeping, 11=>:sleeping, 12=>:idle, 13=>:sleeping, 14=>:sleeping, 15=>:sleeping, 16=>:sleeping, 17=>:sleeping, 18=>:sleeping, 19=>:sleeping, 20=>:sleeping, 21=>:sleeping, 23=>:i...
|
630
630
|
|
631
|
-
# File: process.rb | Line:
|
631
|
+
# File: process.rb | Line: 109
|
632
632
|
# Definition: def zombie
|
633
633
|
LinuxStat::Process.zombie()
|
634
634
|
=> []
|
@@ -637,166 +637,166 @@ LinuxStat::Process.zombie()
|
|
637
637
|
|
638
638
|
### LinuxStat::ProcessInfo
|
639
639
|
```
|
640
|
-
# File: process_info.rb | Line:
|
640
|
+
# File: process_info.rb | Line: 61
|
641
641
|
# Definition: def cmdline(pid = $$)
|
642
642
|
LinuxStat::ProcessInfo.cmdline(pid)
|
643
|
-
=> "/usr/bin/ruby /home/sourav/.gem/ruby/2.7.0/bin/linuxstat.rb
|
643
|
+
=> "/usr/bin/ruby /home/sourav/.gem/ruby/2.7.0/bin/linuxstat.rb -md"
|
644
644
|
|
645
|
-
# File: process_info.rb | Line:
|
645
|
+
# File: process_info.rb | Line: 85
|
646
646
|
# Definition: def command_name(pid = $$)
|
647
647
|
LinuxStat::ProcessInfo.command_name(pid)
|
648
648
|
=> "ruby"
|
649
649
|
|
650
|
-
# File: process_info.rb | Line:
|
650
|
+
# File: process_info.rb | Line: 647
|
651
651
|
# Definition: def nproc(pid = $$)
|
652
652
|
LinuxStat::ProcessInfo.count_cpu(pid)
|
653
653
|
=> 4
|
654
654
|
|
655
|
-
# File: process_info.rb | Line:
|
655
|
+
# File: process_info.rb | Line: 254
|
656
656
|
# Definition: def cpu_stat(pid: $$, sleep: ticks_to_ms_t5)
|
657
657
|
LinuxStat::ProcessInfo.cpu_stat(pid:, sleep:)
|
658
|
-
=> {:cpu_usage=>0.0, :threads=>1, :last_executed_cpu=>
|
658
|
+
=> {:cpu_usage=>0.0, :threads=>1, :last_executed_cpu=>2}
|
659
659
|
|
660
|
-
# File: process_info.rb | Line:
|
660
|
+
# File: process_info.rb | Line: 314
|
661
661
|
# Definition: def cpu_usage(pid: $$, sleep: ticks_to_ms_t5)
|
662
662
|
LinuxStat::ProcessInfo.cpu_usage(pid:, sleep:)
|
663
663
|
=> 0.0
|
664
664
|
|
665
|
-
# File: process_info.rb | Line:
|
665
|
+
# File: process_info.rb | Line: 477
|
666
666
|
# Definition: def gid(pid = $$)
|
667
667
|
LinuxStat::ProcessInfo.gid(pid)
|
668
668
|
=> {:real=>1000, :effective=>1000, :saved_set=>1000, :filesystem_uid=>1000}
|
669
669
|
|
670
|
-
# File: process_info.rb | Line:
|
670
|
+
# File: process_info.rb | Line: 440
|
671
671
|
# Definition: def last_executed_cpu(pid = $$)
|
672
672
|
LinuxStat::ProcessInfo.last_executed_cpu(pid)
|
673
|
-
=>
|
673
|
+
=> 2
|
674
674
|
|
675
|
-
# File: process_info.rb | Line:
|
675
|
+
# File: process_info.rb | Line: 121
|
676
676
|
# Definition: def mem_stat(pid = $$)
|
677
677
|
LinuxStat::ProcessInfo.mem_stat(pid)
|
678
|
-
=> {:memory=>
|
678
|
+
=> {:memory=>25968.64, :virtual_memory=>97329.152, :resident_memory=>32104.448}
|
679
679
|
|
680
|
-
# File: process_info.rb | Line:
|
680
|
+
# File: process_info.rb | Line: 154
|
681
681
|
# Definition: def memory(pid = $$)
|
682
682
|
LinuxStat::ProcessInfo.memory(pid)
|
683
|
-
=>
|
683
|
+
=> 25968.64
|
684
684
|
|
685
|
-
# File: process_info.rb | Line:
|
685
|
+
# File: process_info.rb | Line: 614
|
686
686
|
# Definition: def nice(pid = $$)
|
687
687
|
LinuxStat::ProcessInfo.nice(pid)
|
688
688
|
=> 0
|
689
689
|
|
690
|
-
# File: process_info.rb | Line:
|
690
|
+
# File: process_info.rb | Line: 647
|
691
691
|
# Definition: def nproc(pid = $$)
|
692
692
|
LinuxStat::ProcessInfo.nproc(pid)
|
693
693
|
=> 4
|
694
694
|
|
695
|
-
# File: process_info.rb | Line:
|
695
|
+
# File: process_info.rb | Line: 498
|
696
696
|
# Definition: def owner(pid = $$)
|
697
697
|
LinuxStat::ProcessInfo.owner(pid)
|
698
698
|
=> "sourav"
|
699
699
|
|
700
|
-
# File: process_info.rb | Line:
|
700
|
+
# File: process_info.rb | Line: 204
|
701
701
|
# Definition: def resident_memory(pid = $$)
|
702
702
|
LinuxStat::ProcessInfo.resident_memory(pid)
|
703
|
-
=>
|
703
|
+
=> 32374.784
|
704
704
|
|
705
|
-
# File: process_info.rb | Line:
|
705
|
+
# File: process_info.rb | Line: 570
|
706
706
|
# Definition: def running_time(pid = $$)
|
707
707
|
LinuxStat::ProcessInfo.running_time(pid)
|
708
|
-
=> 1.
|
708
|
+
=> 1.02
|
709
709
|
|
710
|
-
# File: process_info.rb | Line:
|
710
|
+
# File: process_info.rb | Line: 551
|
711
711
|
# Definition: def start_time(pid = $$)
|
712
712
|
LinuxStat::ProcessInfo.start_time(pid)
|
713
|
-
=>
|
713
|
+
=> 2021-01-14 06:39:27 +0530
|
714
714
|
|
715
|
-
# File: process_info.rb | Line:
|
715
|
+
# File: process_info.rb | Line: 520
|
716
716
|
# Definition: def start_time_epoch(pid = $$)
|
717
717
|
LinuxStat::ProcessInfo.start_time_epoch(pid)
|
718
|
-
=>
|
718
|
+
=> 1610586567
|
719
719
|
|
720
|
-
# File: process_info.rb | Line:
|
720
|
+
# File: process_info.rb | Line: 599
|
721
721
|
# Definition: def state(pid = $$)
|
722
722
|
LinuxStat::ProcessInfo.state(pid)
|
723
723
|
=> "R"
|
724
724
|
|
725
|
-
# File: process_info.rb | Line:
|
725
|
+
# File: process_info.rb | Line: 366
|
726
726
|
# Definition: def thread_usage(pid: $$, sleep: ticks_to_ms_t5)
|
727
727
|
LinuxStat::ProcessInfo.thread_usage(pid:, sleep:)
|
728
728
|
=> 0.0
|
729
729
|
|
730
|
-
# File: process_info.rb | Line:
|
730
|
+
# File: process_info.rb | Line: 415
|
731
731
|
# Definition: def threads(pid = $$)
|
732
732
|
LinuxStat::ProcessInfo.threads(pid)
|
733
733
|
=> 1
|
734
734
|
|
735
|
-
# File: process_info.rb | Line:
|
735
|
+
# File: process_info.rb | Line: 30
|
736
736
|
# Definition: def total_io(pid = $$)
|
737
737
|
LinuxStat::ProcessInfo.total_io(pid)
|
738
|
-
=> {:read_bytes=>
|
738
|
+
=> {:read_bytes=>0, :write_bytes=>0}
|
739
739
|
|
740
|
-
# File: process_info.rb | Line:
|
740
|
+
# File: process_info.rb | Line: 453
|
741
741
|
# Definition: def uid(pid = $$)
|
742
742
|
LinuxStat::ProcessInfo.uid(pid)
|
743
743
|
=> {:real=>1000, :effective=>1000, :saved_set=>1000, :filesystem_uid=>1000}
|
744
744
|
|
745
|
-
# File: process_info.rb | Line:
|
745
|
+
# File: process_info.rb | Line: 179
|
746
746
|
# Definition: def virtual_memory(pid = $$)
|
747
747
|
LinuxStat::ProcessInfo.virtual_memory(pid)
|
748
|
-
=>
|
748
|
+
=> 97599.488
|
749
749
|
|
750
750
|
```
|
751
751
|
|
752
752
|
### LinuxStat::Swap
|
753
753
|
```
|
754
|
-
# File: swap.rb | Line:
|
754
|
+
# File: swap.rb | Line: 24
|
755
755
|
# Definition: def any?
|
756
756
|
LinuxStat::Swap.any?()
|
757
757
|
=> true
|
758
758
|
|
759
|
-
# File: swap.rb | Line:
|
759
|
+
# File: swap.rb | Line: 70
|
760
760
|
# Definition: def available
|
761
761
|
LinuxStat::Swap.available()
|
762
|
-
=>
|
762
|
+
=> 2814716
|
763
763
|
|
764
|
-
# File: swap.rb | Line:
|
764
|
+
# File: swap.rb | Line: 10
|
765
765
|
# Definition: def list
|
766
766
|
LinuxStat::Swap.list()
|
767
|
-
=> {"/dev/zram0"=>[:partition, 4194300,
|
767
|
+
=> {"/dev/zram0"=>[:partition, 4194300, 1379584, -2]}
|
768
768
|
|
769
|
-
# File: swap.rb | Line:
|
769
|
+
# File: swap.rb | Line: 105
|
770
770
|
# Definition: def percent_available
|
771
771
|
LinuxStat::Swap.percent_available()
|
772
|
-
=>
|
772
|
+
=> 67.11
|
773
773
|
|
774
|
-
# File: swap.rb | Line:
|
774
|
+
# File: swap.rb | Line: 91
|
775
775
|
# Definition: def percent_used
|
776
776
|
LinuxStat::Swap.percent_used()
|
777
|
-
=>
|
777
|
+
=> 32.89
|
778
778
|
|
779
|
-
# File: swap.rb | Line:
|
779
|
+
# File: swap.rb | Line: 34
|
780
780
|
# Definition: def stat
|
781
781
|
LinuxStat::Swap.stat()
|
782
|
-
=> {:total=>4194300, :used=>
|
782
|
+
=> {:total=>4194300, :used=>1379584, :available=>2814716, :percent_used=>32.89, :percent_available=>67.11}
|
783
783
|
|
784
|
-
# File: swap.rb | Line:
|
784
|
+
# File: swap.rb | Line: 59
|
785
785
|
# Definition: def total
|
786
786
|
LinuxStat::Swap.total()
|
787
787
|
=> 4194300
|
788
788
|
|
789
|
-
# File: swap.rb | Line:
|
789
|
+
# File: swap.rb | Line: 82
|
790
790
|
# Definition: def used
|
791
791
|
LinuxStat::Swap.used()
|
792
|
-
=>
|
792
|
+
=> 1379584
|
793
793
|
|
794
794
|
```
|
795
795
|
|
796
796
|
### LinuxStat::Sysconf
|
797
797
|
```
|
798
798
|
LinuxStat::Sysconf.child_max()
|
799
|
-
=>
|
799
|
+
=> 14788
|
800
800
|
|
801
801
|
LinuxStat::Sysconf.expr_nest_max()
|
802
802
|
=> 32
|
@@ -856,7 +856,7 @@ LinuxStat::Sysconf.tty_name_max()
|
|
856
856
|
|
857
857
|
### LinuxStat::Thermal
|
858
858
|
```
|
859
|
-
# File: thermal.rb | Line:
|
859
|
+
# File: thermal.rb | Line: 59
|
860
860
|
# Definition: def count_fans
|
861
861
|
LinuxStat::Thermal.count_fans()
|
862
862
|
=> 1
|
@@ -869,43 +869,43 @@ LinuxStat::Thermal.count_sensors()
|
|
869
869
|
# File: thermal.rb | Line: 41
|
870
870
|
# Definition: def fans
|
871
871
|
LinuxStat::Thermal.fans()
|
872
|
-
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"Processor Fan", :rpm=>
|
872
|
+
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"Processor Fan", :rpm=>2729}]
|
873
873
|
|
874
874
|
# File: thermal.rb | Line: 23
|
875
875
|
# Definition: def temperatures
|
876
876
|
LinuxStat::Thermal.temperatures()
|
877
|
-
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"SODIMM", :temperature=>
|
877
|
+
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"SODIMM", :temperature=>32.0}, {:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"CPU", :temperature=>39.0}, {:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"Ambi...
|
878
878
|
|
879
879
|
```
|
880
880
|
|
881
881
|
### LinuxStat::USB
|
882
882
|
```
|
883
|
-
# File: usb.rb | Line:
|
883
|
+
# File: usb.rb | Line: 139
|
884
884
|
# Definition: def count
|
885
885
|
LinuxStat::USB.count()
|
886
886
|
=> 10
|
887
887
|
|
888
|
-
# File: usb.rb | Line:
|
888
|
+
# File: usb.rb | Line: 139
|
889
889
|
# Definition: def count
|
890
890
|
LinuxStat::USB.count_devices()
|
891
891
|
=> 10
|
892
892
|
|
893
|
-
# File: usb.rb | Line:
|
893
|
+
# File: usb.rb | Line: 49
|
894
894
|
# Definition: def devices_stat(hwdata: true)
|
895
895
|
LinuxStat::USB.devices_stat(hwdata:)
|
896
896
|
=> [{:path=>"/sys/bus/usb/devices/1-1.2/", :id=>"04d9:1203", :vendor_id=>"04d9", :product_id=>"1203", :bus_num=>1, :dev_num=>7, :hwdata=>{:vendor=>"Holtek Semiconductor, Inc.", :product=>"Keyboard"}, :authorized=>true, :b_max_power=>"100mA", :b_max_packe...
|
897
897
|
|
898
|
-
# File: usb.rb | Line:
|
898
|
+
# File: usb.rb | Line: 179
|
899
899
|
# Definition: def hwdata_file
|
900
900
|
LinuxStat::USB.hwdata_file()
|
901
901
|
=> "/usr/share/hwdata/usb.ids"
|
902
902
|
|
903
|
-
# File: usb.rb | Line:
|
903
|
+
# File: usb.rb | Line: 168
|
904
904
|
# Definition: def hwdata_file_set?
|
905
905
|
LinuxStat::USB.hwdata_file_set?()
|
906
906
|
=> true
|
907
907
|
|
908
|
-
# File: usb.rb | Line:
|
908
|
+
# File: usb.rb | Line: 195
|
909
909
|
# Definition: def initialize_hwdata
|
910
910
|
LinuxStat::USB.initialize_hwdata()
|
911
911
|
=> false
|
@@ -921,110 +921,111 @@ LinuxStat::Uname.nodename()
|
|
921
921
|
=> "archlinux"
|
922
922
|
|
923
923
|
LinuxStat::Uname.release()
|
924
|
-
=> "5.
|
924
|
+
=> "5.9.9-xanmod1-1"
|
925
925
|
|
926
926
|
LinuxStat::Uname.sysname()
|
927
927
|
=> "Linux"
|
928
928
|
|
929
929
|
LinuxStat::Uname.version()
|
930
|
-
=> "#1 SMP PREEMPT
|
930
|
+
=> "#1 SMP PREEMPT Fri, 20 Nov 2020 07:44:55 +0000"
|
931
931
|
|
932
932
|
```
|
933
933
|
|
934
934
|
### LinuxStat::User
|
935
935
|
```
|
936
|
-
# File: user.rb | Line:
|
936
|
+
# File: user.rb | Line: 101
|
937
937
|
# Definition: def get_user
|
938
938
|
LinuxStat::User.get_current_user()
|
939
939
|
=> "sourav"
|
940
940
|
|
941
|
-
# File: user.rb | Line:
|
941
|
+
# File: user.rb | Line: 140
|
942
942
|
# Definition: def get_euid
|
943
943
|
LinuxStat::User.get_euid()
|
944
944
|
=> 1000
|
945
945
|
|
946
|
-
# File: user.rb | Line:
|
946
|
+
# File: user.rb | Line: 132
|
947
947
|
# Definition: def get_gid
|
948
948
|
LinuxStat::User.get_gid()
|
949
949
|
=> 1000
|
950
950
|
|
951
|
-
# File: user.rb | Line:
|
951
|
+
# File: user.rb | Line: 155
|
952
952
|
# Definition: def get_login
|
953
953
|
LinuxStat::User.get_login()
|
954
954
|
=> "sourav"
|
955
955
|
|
956
|
-
# File: user.rb | Line:
|
956
|
+
# File: user.rb | Line: 124
|
957
957
|
# Definition: def get_uid
|
958
958
|
LinuxStat::User.get_uid()
|
959
959
|
=> 1000
|
960
960
|
|
961
|
-
# File: user.rb | Line:
|
961
|
+
# File: user.rb | Line: 101
|
962
962
|
# Definition: def get_user
|
963
963
|
LinuxStat::User.get_user()
|
964
964
|
=> "sourav"
|
965
965
|
|
966
|
-
# File: user.rb | Line:
|
966
|
+
# File: user.rb | Line: 218
|
967
967
|
# Definition: def gid_by_username(username = get_user)
|
968
968
|
LinuxStat::User.gid_by_username(username)
|
969
969
|
=> 1000
|
970
970
|
|
971
|
-
# File: user.rb | Line:
|
971
|
+
# File: user.rb | Line: 58
|
972
972
|
# Definition: def gids
|
973
973
|
LinuxStat::User.gids()
|
974
974
|
=> {:root=>0, :bin=>1, :daemon=>2, :mail=>12, :ftp=>11, :http=>33, :nobody=>65534, :dbus=>81, :"systemd-journal-remote"=>982, :"systemd-network"=>981, :"systemd-resolve"=>980, :"systemd-timesync"=>979, :"systemd-coredump"=>978, :uuidd=>68, :avahi=>977, :...
|
975
975
|
|
976
|
-
# File: user.rb | Line:
|
976
|
+
# File: user.rb | Line: 317
|
977
977
|
# Definition: def home_by_gid(id = get_gid)
|
978
978
|
LinuxStat::User.home_by_gid(id)
|
979
979
|
=> "/home/sourav"
|
980
980
|
|
981
|
-
# File: user.rb | Line:
|
981
|
+
# File: user.rb | Line: 269
|
982
982
|
# Definition: def home_by_username(user = get_user)
|
983
983
|
LinuxStat::User.home_by_username(user)
|
984
984
|
=> "/home/sourav"
|
985
985
|
|
986
|
-
# File: user.rb | Line:
|
986
|
+
# File: user.rb | Line: 75
|
987
987
|
# Definition: def home_directories
|
988
988
|
LinuxStat::User.home_directories()
|
989
989
|
=> {:root=>"/root", :bin=>"/", :daemon=>"/", :mail=>"/var/spool/mail", :ftp=>"/srv/ftp", :http=>"/srv/http", :nobody=>"/", :dbus=>"/", :"systemd-journal-remote"=>"/", :"systemd-network"=>"/", :"systemd-resolve"=>"/", :"systemd-timesync"=>"/", :"systemd-c...
|
990
990
|
|
991
|
-
# File: user.rb | Line:
|
991
|
+
# File: user.rb | Line: 296
|
992
992
|
# Definition: def homes_by_uid(id = get_uid)
|
993
993
|
LinuxStat::User.homes_by_uid(id)
|
994
994
|
=> ["/home/sourav"]
|
995
995
|
|
996
|
-
# File: user.rb | Line:
|
996
|
+
# File: user.rb | Line: 25
|
997
997
|
# Definition: def ids
|
998
998
|
LinuxStat::User.ids()
|
999
999
|
=> {:root=>{:uid=>0, :gid=>0}, :bin=>{:uid=>1, :gid=>1}, :daemon=>{:uid=>2, :gid=>2}, :mail=>{:uid=>8, :gid=>12}, :ftp=>{:uid=>14, :gid=>11}, :http=>{:uid=>33, :gid=>33}, :nobody=>{:uid=>65534, :gid=>65534}, :dbus=>{:uid=>81, :gid=>81}, :"systemd-journal...
|
1000
1000
|
|
1001
|
-
# File: user.rb | Line:
|
1001
|
+
# File: user.rb | Line: 13
|
1002
1002
|
# Definition: def list
|
1003
1003
|
LinuxStat::User.list()
|
1004
1004
|
=> ["root", "bin", "daemon", "mail", "ftp", "http", "nobody", "dbus", "systemd-journal-remote", "systemd-network", "systemd-resolve", "systemd-timesync", "systemd-coredump", "uuidd", "avahi", "colord", "git", "lxdm", "polkitd", "rtkit", "usbmux", "sourav...
|
1005
1005
|
|
1006
|
-
# File: user.rb | Line:
|
1006
|
+
# File: user.rb | Line: 247
|
1007
1007
|
# Definition: def uid_by_username(username = get_user)
|
1008
1008
|
LinuxStat::User.uid_by_username(username)
|
1009
1009
|
=> 1000
|
1010
1010
|
|
1011
|
-
# File: user.rb | Line:
|
1011
|
+
# File: user.rb | Line: 42
|
1012
1012
|
# Definition: def uids
|
1013
1013
|
LinuxStat::User.uids()
|
1014
1014
|
=> {:root=>0, :bin=>1, :daemon=>2, :mail=>8, :ftp=>14, :http=>33, :nobody=>65534, :dbus=>81, :"systemd-journal-remote"=>982, :"systemd-network"=>981, :"systemd-resolve"=>980, :"systemd-timesync"=>979, :"systemd-coredump"=>978, :uuidd=>68, :avahi=>977, :c...
|
1015
1015
|
|
1016
|
-
# File: user.rb | Line:
|
1016
|
+
# File: user.rb | Line: 190
|
1017
1017
|
# Definition: def username_by_gid(gid = get_gid)
|
1018
1018
|
LinuxStat::User.username_by_gid(gid)
|
1019
1019
|
=> "sourav"
|
1020
1020
|
|
1021
|
-
# File: user.rb | Line:
|
1021
|
+
# File: user.rb | Line: 172
|
1022
1022
|
# Definition: def usernames_by_uid(uid = get_uid)
|
1023
1023
|
LinuxStat::User.usernames_by_uid(uid)
|
1024
1024
|
=> ["sourav"]
|
1025
1025
|
|
1026
1026
|
```
|
1027
1027
|
|
1028
|
+
|
1028
1029
|
---
|
1029
1030
|
|
1030
1031
|
## Note 1: CPU usage, and Net usage
|
data/exe/linuxstat.rb
CHANGED
@@ -113,10 +113,20 @@ execute.sort.each do |c|
|
|
113
113
|
|
114
114
|
meths.each do |meth|
|
115
115
|
arg = nil
|
116
|
-
params = e.method(meth).parameters
|
117
116
|
|
118
|
-
|
117
|
+
arity = e.method(meth).arity
|
118
|
+
if arity > 0 || arity == -2
|
119
|
+
if c == :PrettifyBytes
|
120
|
+
arg = rand(10 ** 15)
|
121
|
+
elsif c == :FS
|
122
|
+
arg = '/'
|
123
|
+
else
|
124
|
+
next
|
125
|
+
end
|
126
|
+
end
|
119
127
|
|
128
|
+
params = e.method(meth).parameters
|
129
|
+
param = ''
|
120
130
|
params.each do |p|
|
121
131
|
case p[0]
|
122
132
|
when :opt
|
@@ -124,24 +134,14 @@ execute.sort.each do |c|
|
|
124
134
|
when :key
|
125
135
|
param << "#{p[1]}:, "
|
126
136
|
when :req
|
127
|
-
|
137
|
+
_arg = arg ? " = #{arg.inspect}" : ''.freeze
|
138
|
+
param << "#{p[1] || 'arg'}#{_arg}, "
|
128
139
|
end
|
129
140
|
end
|
130
|
-
|
131
141
|
param.delete_suffix!(", ")
|
132
142
|
|
133
|
-
if e.method(meth).arity > 0
|
134
|
-
if c == :PrettifyBytes
|
135
|
-
arg = rand(10 ** 15)
|
136
|
-
elsif c == :FS
|
137
|
-
arg = '/'
|
138
|
-
else
|
139
|
-
next
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
143
|
disp_meth = "#{meth}"
|
144
|
-
disp_meth.concat(arg ? "(#{param}
|
144
|
+
disp_meth.concat(arg ? "(#{param})" : "(#{param})")
|
145
145
|
|
146
146
|
time = Time.now
|
147
147
|
ret = arg ? e.send(meth, arg) : e.send(meth)
|
@@ -23,13 +23,13 @@ module LinuxStat
|
|
23
23
|
# LinuxStat::PrettifyBytes.convert_decimal(1024 ** 3)
|
24
24
|
#
|
25
25
|
# => "1.07 gigabytes"
|
26
|
-
def convert_decimal(n)
|
26
|
+
def convert_decimal(n, precision: 2)
|
27
27
|
@@d_units ||= %W(#{''} kilo mega giga tera peta exa zetta)
|
28
28
|
.map.with_index { |x, i| [x, 1000.**(i + 1)] }
|
29
29
|
unit = @@d_units.find { |x| n < x[1] } || ['yotta'.freeze, 10 ** 27]
|
30
30
|
|
31
31
|
converted = n.fdiv(unit[1] / 1000).round(2)
|
32
|
-
"#{pad_left(converted)} #{unit[0]}byte#{?s.freeze if converted != 1}"
|
32
|
+
"#{pad_left(converted, precision)} #{unit[0]}byte#{?s.freeze if converted != 1}"
|
33
33
|
end
|
34
34
|
|
35
35
|
# Converts a number to binary byte units and outputs with the IEC prefix
|
@@ -46,13 +46,13 @@ module LinuxStat
|
|
46
46
|
# LinuxStat::PrettifyBytes.convert_binary(1024 ** 3)
|
47
47
|
#
|
48
48
|
# => "1.0 gibibyte"
|
49
|
-
def convert_binary(n)
|
49
|
+
def convert_binary(n, precision: 2)
|
50
50
|
@@b_units ||= %W(#{''} kibi mebi gibi tebi pebi exbi zebi)
|
51
51
|
.map.with_index { |x, i| [x, 1024.**(i + 1)] }
|
52
52
|
unit = @@b_units.find { |x| n < x[1] } || ['yobi'.freeze, 10 ** 27]
|
53
53
|
|
54
54
|
converted = n.fdiv(unit[1] / 1024).round(2)
|
55
|
-
"#{pad_left(converted)} #{unit[0]}byte#{?s.freeze if converted != 1}"
|
55
|
+
"#{pad_left(converted, precision)} #{unit[0]}byte#{?s.freeze if converted != 1}"
|
56
56
|
end
|
57
57
|
|
58
58
|
# Converts a number to decimal byte units
|
@@ -69,13 +69,13 @@ module LinuxStat
|
|
69
69
|
# LinuxStat::PrettifyBytes.convert_short_decimal(1024 ** 3)
|
70
70
|
#
|
71
71
|
# => "1.07 GB"
|
72
|
-
def convert_short_decimal(n)
|
72
|
+
def convert_short_decimal(n, precision: 2)
|
73
73
|
@@sd_units ||= %W(#{''} k M G T P E Z)
|
74
74
|
.map.with_index { |x, i| [x, 1000.**(i + 1)] }
|
75
75
|
unit = @@sd_units.find { |x| n < x[1] } || [?Y.freeze, 10 ** 27]
|
76
76
|
|
77
77
|
converted = n.fdiv(unit[1] / 1000).round(2)
|
78
|
-
"#{pad_left(converted)} #{unit[0]}B"
|
78
|
+
"#{pad_left(converted, precision)} #{unit[0]}B"
|
79
79
|
end
|
80
80
|
|
81
81
|
##
|
@@ -94,15 +94,15 @@ module LinuxStat
|
|
94
94
|
# LinuxStat::PrettifyBytes.convert_short_binary(1024 ** 3)
|
95
95
|
#
|
96
96
|
# => "1.0 GiB"
|
97
|
-
def convert_short_binary(n)
|
98
|
-
return "#{n} B" if n < 1024
|
97
|
+
def convert_short_binary(n, precision: 2)
|
98
|
+
return "#{pad_left(n, precision)} B" if n < 1024
|
99
99
|
|
100
100
|
@@sb_units ||= %W(#{''} K M G T P E Z)
|
101
101
|
.map.with_index { |x, i| [x, 1024.**(i + 1)] }
|
102
102
|
unit = @@sb_units.find { |x| n < x[1] } || [?Y.freeze, 1024 ** 9]
|
103
103
|
|
104
104
|
converted = n.fdiv(unit[1] / 1024).round(2)
|
105
|
-
"#{pad_left(converted)} #{unit[0]}iB"
|
105
|
+
"#{pad_left(converted, precision)} #{unit[0]}iB"
|
106
106
|
end
|
107
107
|
|
108
108
|
private
|
data/lib/linux_stat/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: linux_stat
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sourav Goswami
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-14 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Linux only, efficient linux system utilization reporting and system monitoring
|
14
14
|
gem
|