linux_stat 1.3.1 → 2.1.0
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 +218 -108
- data/bin/console +7 -1
- data/exe/linuxstat.rb +8 -1
- data/ext/fs_stat/fs_stat.c +10 -10
- data/ext/nproc/nproc.c +2 -2
- data/ext/procfs/extconf.rb +11 -0
- data/ext/procfs/loadavg_pid.h +11 -0
- data/ext/procfs/procfs.c +42 -0
- data/ext/procfs/stat.h +98 -0
- data/ext/procfs/statm.h +109 -0
- data/ext/procfs/uptime.h +12 -0
- data/ext/sysconf/extconf.rb +1 -1
- data/ext/sysconf/sysconf.c +27 -27
- data/ext/sysinfo/extconf.rb +11 -0
- data/ext/sysinfo/sysinfo.c +177 -0
- data/ext/utsname/utsname.c +1 -1
- data/lib/linux_stat.rb +10 -4
- data/lib/linux_stat/battery.rb +8 -1
- data/lib/linux_stat/memory.rb +13 -3
- data/lib/linux_stat/net.rb +5 -5
- data/lib/linux_stat/os.rb +56 -9
- data/lib/linux_stat/process.rb +55 -23
- data/lib/linux_stat/process_info.rb +139 -99
- data/lib/linux_stat/swap.rb +36 -9
- data/lib/linux_stat/version.rb +1 -1
- metadata +13 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b86b9e971bbc4cba82696a08bed77a75d05ba88151ab39fe107ea9ce6902bfa1
|
4
|
+
data.tar.gz: efeb2d8994fc87b3fc6a059f106988df53b3b41ced83ca1099e96210f8dbc299
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2af9a6be65de9ed75f1d7e19fa4b19c4557a35dcffa375daef08355b6e468ba8c25f09937cfb6dbda8bc5d87999144db06408263a1f9a37901cded9bc56c7d5d
|
7
|
+
data.tar.gz: d67f4d12cc911c0d6abdc3bb08f8a913d028e39a454cca041af3b1cd6f59d5fa53d667620a698047db85dde1e9660d877576bb0e6f4aa8c1c2f40cfbb5b17acd
|
data/README.md
CHANGED
@@ -12,11 +12,16 @@ It only works for Linux, and detecting the OS is upto the user of this gem.
|
|
12
12
|
|
13
13
|
Languages Used:
|
14
14
|
|
15
|
-
<img src="https://linuxstatloc.herokuapp.com/
|
15
|
+
<img src="https://linuxstatloc.herokuapp.com/svg" width="260px">
|
16
16
|
|
17
17
|
---
|
18
18
|
|
19
|
-
## Dependencies:
|
19
|
+
## Runtime Dependencies:
|
20
|
+
|
21
|
+
1. Kernel: Any Linux distribution with Kernel 3.14+.
|
22
|
+
2. Ruby: Ruby 2.3.0 and above.
|
23
|
+
|
24
|
+
## Build Dependencies:
|
20
25
|
+ You need to have the C compiler installed to be able to compile the C extensions.
|
21
26
|
On Arch Linux:
|
22
27
|
```
|
@@ -25,19 +30,14 @@ On Arch Linux:
|
|
25
30
|
|
26
31
|
On Debian based systems:
|
27
32
|
```
|
28
|
-
# apt install gcc build-essential
|
33
|
+
# apt install gcc build-essential ruby-dev
|
29
34
|
```
|
30
35
|
|
31
|
-
+ You
|
32
|
-
```
|
33
|
-
# apt install ruby-dev
|
34
|
-
```
|
35
|
-
|
36
|
-
+ Once your are done, and you can compile the C file, you can follow the installation!
|
36
|
+
+ You can remove the packages once the program is installed.
|
37
37
|
|
38
38
|
---
|
39
39
|
|
40
|
-
## Optional Dependencies
|
40
|
+
## Optional Runtime Dependencies
|
41
41
|
|
42
42
|
You need hwdata to decode vendor and product ids if you use LinuxStat::USB and/or LinuxStat::PCI
|
43
43
|
|
@@ -73,11 +73,15 @@ gem 'linux_stat'
|
|
73
73
|
|
74
74
|
And then execute:
|
75
75
|
|
76
|
-
|
76
|
+
```
|
77
|
+
$ bundle install
|
78
|
+
```
|
77
79
|
|
78
80
|
Or install it yourself as:
|
79
81
|
|
80
|
-
|
82
|
+
```
|
83
|
+
$ gem install linux_stat
|
84
|
+
```
|
81
85
|
|
82
86
|
## Usage
|
83
87
|
Following are the LinuxStat modules and module functions.
|
@@ -131,7 +135,7 @@ LinuxStat::Battery.charge_full_wh()
|
|
131
135
|
LinuxStat::Battery.charging?()
|
132
136
|
=> true
|
133
137
|
|
134
|
-
# File: battery.rb | Line:
|
138
|
+
# File: battery.rb | Line: 193
|
135
139
|
# Definition: def devices_stat
|
136
140
|
LinuxStat::Battery.devices_stat()
|
137
141
|
=> {: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....
|
@@ -179,7 +183,7 @@ LinuxStat::Battery.technology()
|
|
179
183
|
# File: battery.rb | Line: 162
|
180
184
|
# Definition: def voltage_now
|
181
185
|
LinuxStat::Battery.voltage_now()
|
182
|
-
=> 12.
|
186
|
+
=> 12.627
|
183
187
|
|
184
188
|
```
|
185
189
|
|
@@ -203,7 +207,7 @@ LinuxStat::CPU.count_online()
|
|
203
207
|
# File: cpu.rb | Line: 199
|
204
208
|
# Definition: def cur_freq
|
205
209
|
LinuxStat::CPU.cur_freq()
|
206
|
-
=> {"cpu0"=>
|
210
|
+
=> {"cpu0"=>2000001, "cpu1"=>2000003, "cpu2"=>2000010, "cpu3"=>1999999}
|
207
211
|
|
208
212
|
# File: cpu.rb | Line: 267
|
209
213
|
# Definition: def governor
|
@@ -238,29 +242,29 @@ LinuxStat::CPU.online()
|
|
238
242
|
# File: cpu.rb | Line: 25
|
239
243
|
# Definition: def stat(sleep = ticks_to_ms_t5)
|
240
244
|
LinuxStat::CPU.stat(sleep)
|
241
|
-
=> {0=>
|
245
|
+
=> {0=>38.89, 1=>20.0, 2=>33.33, 3=>25.0, 4=>100.0}
|
242
246
|
|
243
247
|
# File: cpu.rb | Line: 65
|
244
248
|
# Definition: def total_usage(sleep = ticks_to_ms_t5)
|
245
249
|
LinuxStat::CPU.total_usage(sleep)
|
246
|
-
=>
|
250
|
+
=> 45.0
|
247
251
|
|
248
252
|
# File: cpu.rb | Line: 65
|
249
253
|
# Definition: def total_usage(sleep = ticks_to_ms_t5)
|
250
254
|
LinuxStat::CPU.usage(sleep)
|
251
|
-
=>
|
255
|
+
=> 47.37
|
252
256
|
|
253
257
|
# File: cpu.rb | Line: 25
|
254
258
|
# Definition: def stat(sleep = ticks_to_ms_t5)
|
255
259
|
LinuxStat::CPU.usages(sleep)
|
256
|
-
=> {0=>
|
260
|
+
=> {0=>44.44, 1=>20.0, 2=>20.0, 3=>20.0, 4=>100.0}
|
257
261
|
|
258
262
|
```
|
259
263
|
|
260
264
|
### LinuxStat::FS
|
261
265
|
```
|
262
266
|
LinuxStat::FS.stat(arg = "/")
|
263
|
-
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>
|
267
|
+
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>7715553, :block_avail_unpriv=>7715553, :inodes=>58612160, :free_inodes=>56766199, :filesystem_id=>2050, :mount_flags=>1024, :max_filename_length=>255}
|
264
268
|
|
265
269
|
```
|
266
270
|
|
@@ -269,22 +273,22 @@ LinuxStat::FS.stat(arg = "/")
|
|
269
273
|
# File: filesystem.rb | Line: 94
|
270
274
|
# Definition: def available(fs = ?..freeze)
|
271
275
|
LinuxStat::Filesystem.available(fs)
|
272
|
-
=>
|
276
|
+
=> 31602905088
|
273
277
|
|
274
278
|
# File: filesystem.rb | Line: 60
|
275
279
|
# Definition: def free(fs = ?..freeze)
|
276
280
|
LinuxStat::Filesystem.free(fs)
|
277
|
-
=>
|
281
|
+
=> 31602905088
|
278
282
|
|
279
283
|
# File: filesystem.rb | Line: 21
|
280
284
|
# Definition: def stat(fs = ?..freeze)
|
281
285
|
LinuxStat::Filesystem.stat(fs)
|
282
|
-
=> {:total=>119981191168, :free=>
|
286
|
+
=> {:total=>119981191168, :free=>31602905088, :used=>88378286080}
|
283
287
|
|
284
288
|
# File: filesystem.rb | Line: 110
|
285
289
|
# Definition: def stat_raw(fs = ?..freeze)
|
286
290
|
LinuxStat::Filesystem.stat_raw(fs)
|
287
|
-
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>
|
291
|
+
=> {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>7715553, :block_avail_unpriv=>7715553, :inodes=>58612160, :free_inodes=>56766199, :filesystem_id=>2050, :mount_flags=>1024, :max_filename_length=>255}
|
288
292
|
|
289
293
|
# File: filesystem.rb | Line: 41
|
290
294
|
# Definition: def total(fs = ?..freeze)
|
@@ -294,7 +298,7 @@ LinuxStat::Filesystem.total(fs)
|
|
294
298
|
# File: filesystem.rb | Line: 75
|
295
299
|
# Definition: def used(fs = ?..freeze)
|
296
300
|
LinuxStat::Filesystem.used(fs)
|
297
|
-
=>
|
301
|
+
=> 88378286080
|
298
302
|
|
299
303
|
```
|
300
304
|
|
@@ -354,35 +358,40 @@ LinuxStat::Kernel.version()
|
|
354
358
|
|
355
359
|
### LinuxStat::Memory
|
356
360
|
```
|
357
|
-
# File: memory.rb | Line:
|
361
|
+
# File: memory.rb | Line: 62
|
358
362
|
# Definition: def available
|
359
363
|
LinuxStat::Memory.available()
|
360
|
-
=>
|
364
|
+
=> 310424
|
361
365
|
|
362
|
-
# File: memory.rb | Line:
|
366
|
+
# File: memory.rb | Line: 52
|
367
|
+
# Definition: def free
|
368
|
+
LinuxStat::Memory.free()
|
369
|
+
=> 278680
|
370
|
+
|
371
|
+
# File: memory.rb | Line: 93
|
363
372
|
# Definition: def percent_available
|
364
373
|
LinuxStat::Memory.percent_available()
|
365
|
-
=>
|
374
|
+
=> 8.09
|
366
375
|
|
367
|
-
# File: memory.rb | Line:
|
376
|
+
# File: memory.rb | Line: 82
|
368
377
|
# Definition: def percent_used
|
369
378
|
LinuxStat::Memory.percent_used()
|
370
|
-
=>
|
379
|
+
=> 91.91
|
371
380
|
|
372
381
|
# File: memory.rb | Line: 13
|
373
382
|
# Definition: def stat
|
374
383
|
LinuxStat::Memory.stat()
|
375
|
-
=> {:total=>3836236, :used=>
|
384
|
+
=> {:total=>3836236, :used=>3525820, :available=>310416, :percent_used=>91.91, :percent_available=>8.09}
|
376
385
|
|
377
386
|
# File: memory.rb | Line: 42
|
378
387
|
# Definition: def total
|
379
388
|
LinuxStat::Memory.total()
|
380
389
|
=> 3836236
|
381
390
|
|
382
|
-
# File: memory.rb | Line:
|
391
|
+
# File: memory.rb | Line: 72
|
383
392
|
# Definition: def used
|
384
393
|
LinuxStat::Memory.used()
|
385
|
-
=>
|
394
|
+
=> 3525820
|
386
395
|
|
387
396
|
```
|
388
397
|
|
@@ -391,7 +400,7 @@ LinuxStat::Memory.used()
|
|
391
400
|
# File: mounts.rb | Line: 181
|
392
401
|
# Definition: def device_stat(dev = root)
|
393
402
|
LinuxStat::Mounts.device_stat(dev)
|
394
|
-
=> {:mountpoint=>"/", :total=>119981191168, :free=>
|
403
|
+
=> {:mountpoint=>"/", :total=>119981191168, :free=>31602905088, :available=>31602905088, :used=>88378286080, :percent_used=>73.66, :percent_free=>26.34, :percent_available=>26.34}
|
395
404
|
|
396
405
|
# File: mounts.rb | Line: 139
|
397
406
|
# Definition: def devices_stat
|
@@ -406,12 +415,12 @@ LinuxStat::Mounts.list()
|
|
406
415
|
# File: mounts.rb | Line: 22
|
407
416
|
# Definition: def list_devices
|
408
417
|
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", "
|
418
|
+
=> ["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", "hug...
|
410
419
|
|
411
420
|
# File: mounts.rb | Line: 111
|
412
421
|
# Definition: def list_devices_mount_point
|
413
422
|
LinuxStat::Mounts.list_devices_mount_point()
|
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/
|
423
|
+
=> {"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/cpuset", "pstore"=>"...
|
415
424
|
|
416
425
|
# File: mounts.rb | Line: 82
|
417
426
|
# Definition: def mount_point(dev = root)
|
@@ -450,22 +459,22 @@ LinuxStat::Net.current_usage(interval)
|
|
450
459
|
# File: net.rb | Line: 12
|
451
460
|
# Definition: def ipv4_private
|
452
461
|
LinuxStat::Net.ipv4_private()
|
453
|
-
=> "192.168.
|
462
|
+
=> "192.168.43.107"
|
454
463
|
|
455
464
|
# File: net.rb | Line: 27
|
456
465
|
# Definition: def total_bytes
|
457
466
|
LinuxStat::Net.total_bytes()
|
458
|
-
=> {:received=>
|
467
|
+
=> {:received=>850558466, :transmitted=>187230758}
|
459
468
|
|
460
469
|
# File: net.rb | Line: 45
|
461
470
|
# Definition: def total_bytes_received
|
462
471
|
LinuxStat::Net.total_bytes_received()
|
463
|
-
=>
|
472
|
+
=> 850558466
|
464
473
|
|
465
474
|
# File: net.rb | Line: 58
|
466
475
|
# Definition: def total_bytes_transmitted
|
467
476
|
LinuxStat::Net.total_bytes_transmitted()
|
468
|
-
=>
|
477
|
+
=> 187230758
|
469
478
|
|
470
479
|
# File: net.rb | Line: 86
|
471
480
|
# Definition: def usage(interval = 0.1)
|
@@ -496,6 +505,11 @@ LinuxStat::OS.distribution()
|
|
496
505
|
LinuxStat::OS.hostname()
|
497
506
|
=> "archlinux"
|
498
507
|
|
508
|
+
# File: os.rb | Line: 202
|
509
|
+
# Definition: def loadavg
|
510
|
+
LinuxStat::OS.loadavg()
|
511
|
+
=> {1=>4.5693359375, 5=>3.85400390625, 15=>3.53515625}
|
512
|
+
|
499
513
|
# File: os.rb | Line: 35
|
500
514
|
# Definition: def lsb_release
|
501
515
|
LinuxStat::OS.lsb_release()
|
@@ -516,10 +530,20 @@ LinuxStat::OS.nodename()
|
|
516
530
|
LinuxStat::OS.os_release()
|
517
531
|
=> {: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
532
|
|
519
|
-
# File: os.rb | Line:
|
533
|
+
# File: os.rb | Line: 146
|
520
534
|
# Definition: def uptime
|
521
535
|
LinuxStat::OS.uptime()
|
522
|
-
=> {:hour=>
|
536
|
+
=> {:hour=>16, :minute=>52, :second=>3.39}
|
537
|
+
|
538
|
+
# File: os.rb | Line: 174
|
539
|
+
# Definition: def uptime_f
|
540
|
+
LinuxStat::OS.uptime_f()
|
541
|
+
=> 60723.39
|
542
|
+
|
543
|
+
# File: os.rb | Line: 185
|
544
|
+
# Definition: def uptime_i
|
545
|
+
LinuxStat::OS.uptime_i()
|
546
|
+
=> 60724
|
523
547
|
|
524
548
|
# File: os.rb | Line: 84
|
525
549
|
# Definition: def version
|
@@ -571,64 +595,89 @@ LinuxStat::PCI.initialize_hwdata()
|
|
571
595
|
```
|
572
596
|
# File: prettify_bytes.rb | Line: 49
|
573
597
|
# Definition: def convert_binary(n, precision: 2)
|
574
|
-
LinuxStat::PrettifyBytes.convert_binary(n =
|
575
|
-
=> "
|
598
|
+
LinuxStat::PrettifyBytes.convert_binary(n = 630454817180687, precision:)
|
599
|
+
=> "573.40 tebibytes"
|
576
600
|
|
577
601
|
# File: prettify_bytes.rb | Line: 26
|
578
602
|
# Definition: def convert_decimal(n, precision: 2)
|
579
|
-
LinuxStat::PrettifyBytes.convert_decimal(n =
|
580
|
-
=> "
|
603
|
+
LinuxStat::PrettifyBytes.convert_decimal(n = 42077508120898, precision:)
|
604
|
+
=> "42.08 terabytes"
|
581
605
|
|
582
606
|
# File: prettify_bytes.rb | Line: 97
|
583
607
|
# Definition: def convert_short_binary(n, precision: 2)
|
584
|
-
LinuxStat::PrettifyBytes.convert_short_binary(n =
|
585
|
-
=> "
|
608
|
+
LinuxStat::PrettifyBytes.convert_short_binary(n = 363689812033137, precision:)
|
609
|
+
=> "330.77 TiB"
|
586
610
|
|
587
611
|
# File: prettify_bytes.rb | Line: 72
|
588
612
|
# Definition: def convert_short_decimal(n, precision: 2)
|
589
|
-
LinuxStat::PrettifyBytes.convert_short_decimal(n =
|
590
|
-
=> "
|
613
|
+
LinuxStat::PrettifyBytes.convert_short_decimal(n = 119056846159316, precision:)
|
614
|
+
=> "119.06 TB"
|
615
|
+
|
616
|
+
```
|
617
|
+
|
618
|
+
### LinuxStat::ProcFS
|
619
|
+
```
|
620
|
+
LinuxStat::ProcFS.last_pid()
|
621
|
+
=> 34902
|
622
|
+
|
623
|
+
LinuxStat::ProcFS.uptime_f()
|
624
|
+
=> 60723.68
|
591
625
|
|
592
626
|
```
|
593
627
|
|
594
628
|
### LinuxStat::Process
|
595
629
|
```
|
630
|
+
# File: process.rb | Line: 57
|
631
|
+
# Definition: def cmdlines
|
632
|
+
LinuxStat::Process.cmdlines()
|
633
|
+
=> {1=>"/sbin/init", 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=>""...
|
634
|
+
|
596
635
|
# File: process.rb | Line: 29
|
597
636
|
# Definition: def count
|
598
637
|
LinuxStat::Process.count()
|
599
|
-
=>
|
638
|
+
=> 216
|
600
639
|
|
601
|
-
# File: process.rb | Line:
|
640
|
+
# File: process.rb | Line: 120
|
602
641
|
# Definition: def idle
|
603
642
|
LinuxStat::Process.idle()
|
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,
|
643
|
+
=> [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, 177, 179, 182, 183, 186, 192, 193, 194, 195, 196, 197, 198, 199, 243, 245, 294, 461, 493, 517, 9197, 16346, 16347, 16348, 16349, 16350, 163...
|
644
|
+
|
645
|
+
# File: process.rb | Line: 160
|
646
|
+
# Definition: def last_pid
|
647
|
+
LinuxStat::Process.last_pid()
|
648
|
+
=> 34902
|
605
649
|
|
606
650
|
# File: process.rb | Line: 11
|
607
651
|
# Definition: def list
|
608
652
|
LinuxStat::Process.list()
|
609
653
|
=> [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
654
|
|
611
|
-
# File: process.rb | Line:
|
655
|
+
# File: process.rb | Line: 36
|
612
656
|
# Definition: def names
|
613
657
|
LinuxStat::Process.names()
|
614
|
-
=> {1=>"systemd", 2=>"kthreadd", 3=>"rcu_gp", 4=>"rcu_par_gp", 6=>"kworker/0:0H
|
658
|
+
=> {1=>"systemd", 2=>"kthreadd", 3=>"rcu_gp", 4=>"rcu_par_gp", 6=>"kworker/0:0H", 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_inject/...
|
615
659
|
|
616
|
-
# File: process.rb | Line:
|
660
|
+
# File: process.rb | Line: 138
|
617
661
|
# Definition: def running
|
618
662
|
LinuxStat::Process.running()
|
619
|
-
=> [
|
663
|
+
=> [16203, 27259, 34902]
|
620
664
|
|
621
|
-
# File: process.rb | Line:
|
665
|
+
# File: process.rb | Line: 111
|
622
666
|
# Definition: def sleeping
|
623
667
|
LinuxStat::Process.sleeping()
|
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,
|
668
|
+
=> [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, 176, 178, 200, 228, 244, 246, 322, 325, 326, 327, 328, 389, 390, 391, 392, 409, 411, 415, 479, 535, 537,...
|
669
|
+
|
670
|
+
# File: process.rb | Line: 147
|
671
|
+
# Definition: def stopped
|
672
|
+
LinuxStat::Process.stopped()
|
673
|
+
=> []
|
625
674
|
|
626
|
-
# File: process.rb | Line:
|
675
|
+
# File: process.rb | Line: 78
|
627
676
|
# Definition: def types
|
628
677
|
LinuxStat::Process.types()
|
629
678
|
=> {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
679
|
|
631
|
-
# File: process.rb | Line:
|
680
|
+
# File: process.rb | Line: 129
|
632
681
|
# Definition: def zombie
|
633
682
|
LinuxStat::Process.zombie()
|
634
683
|
=> []
|
@@ -642,92 +691,112 @@ LinuxStat::Process.zombie()
|
|
642
691
|
LinuxStat::ProcessInfo.cmdline(pid)
|
643
692
|
=> "/usr/bin/ruby /home/sourav/.gem/ruby/2.7.0/bin/linuxstat.rb -md"
|
644
693
|
|
645
|
-
# File: process_info.rb | Line:
|
694
|
+
# File: process_info.rb | Line: 87
|
646
695
|
# Definition: def command_name(pid = $$)
|
647
696
|
LinuxStat::ProcessInfo.command_name(pid)
|
648
697
|
=> "ruby"
|
649
698
|
|
650
|
-
# File: process_info.rb | Line:
|
699
|
+
# File: process_info.rb | Line: 654
|
651
700
|
# Definition: def nproc(pid = $$)
|
652
701
|
LinuxStat::ProcessInfo.count_cpu(pid)
|
653
702
|
=> 4
|
654
703
|
|
655
|
-
# File: process_info.rb | Line:
|
704
|
+
# File: process_info.rb | Line: 280
|
656
705
|
# Definition: def cpu_stat(pid: $$, sleep: ticks_to_ms_t5)
|
657
706
|
LinuxStat::ProcessInfo.cpu_stat(pid:, sleep:)
|
658
|
-
=> {:cpu_usage=>0.0, :threads=>
|
707
|
+
=> {:cpu_usage=>0.0, :threads=>0, :last_executed_cpu=>0}
|
659
708
|
|
660
|
-
# File: process_info.rb | Line:
|
709
|
+
# File: process_info.rb | Line: 664
|
710
|
+
# Definition: def cpu_time(pid = $$)
|
711
|
+
LinuxStat::ProcessInfo.cpu_time(pid)
|
712
|
+
=> 0
|
713
|
+
|
714
|
+
# File: process_info.rb | Line: 677
|
715
|
+
# Definition: def cpu_times(pid = $$)
|
716
|
+
LinuxStat::ProcessInfo.cpu_times(pid)
|
717
|
+
=> {:hour=>0, :minute=>0, :second=>0}
|
718
|
+
|
719
|
+
# File: process_info.rb | Line: 340
|
661
720
|
# Definition: def cpu_usage(pid: $$, sleep: ticks_to_ms_t5)
|
662
721
|
LinuxStat::ProcessInfo.cpu_usage(pid:, sleep:)
|
663
722
|
=> 0.0
|
664
723
|
|
665
|
-
# File: process_info.rb | Line:
|
724
|
+
# File: process_info.rb | Line: 496
|
666
725
|
# Definition: def gid(pid = $$)
|
667
726
|
LinuxStat::ProcessInfo.gid(pid)
|
668
727
|
=> {:real=>1000, :effective=>1000, :saved_set=>1000, :filesystem_uid=>1000}
|
669
728
|
|
670
|
-
# File: process_info.rb | Line:
|
729
|
+
# File: process_info.rb | Line: 462
|
671
730
|
# Definition: def last_executed_cpu(pid = $$)
|
672
731
|
LinuxStat::ProcessInfo.last_executed_cpu(pid)
|
673
|
-
=>
|
732
|
+
=> 1
|
674
733
|
|
675
|
-
# File: process_info.rb | Line:
|
734
|
+
# File: process_info.rb | Line: 151
|
676
735
|
# Definition: def mem_stat(pid = $$)
|
677
736
|
LinuxStat::ProcessInfo.mem_stat(pid)
|
678
|
-
=> {:memory=>
|
737
|
+
=> {:memory=>24821760, :virtual_memory=>96198656, :resident_memory=>30973952, :shared_memory=>6152192}
|
679
738
|
|
680
|
-
# File: process_info.rb | Line:
|
739
|
+
# File: process_info.rb | Line: 171
|
681
740
|
# Definition: def memory(pid = $$)
|
682
741
|
LinuxStat::ProcessInfo.memory(pid)
|
683
|
-
=>
|
742
|
+
=> 24821.76
|
684
743
|
|
685
|
-
# File: process_info.rb | Line:
|
744
|
+
# File: process_info.rb | Line: 624
|
686
745
|
# Definition: def nice(pid = $$)
|
687
746
|
LinuxStat::ProcessInfo.nice(pid)
|
688
747
|
=> 0
|
689
748
|
|
690
|
-
# File: process_info.rb | Line:
|
749
|
+
# File: process_info.rb | Line: 654
|
691
750
|
# Definition: def nproc(pid = $$)
|
692
751
|
LinuxStat::ProcessInfo.nproc(pid)
|
693
752
|
=> 4
|
694
753
|
|
695
|
-
# File: process_info.rb | Line:
|
754
|
+
# File: process_info.rb | Line: 517
|
696
755
|
# Definition: def owner(pid = $$)
|
697
756
|
LinuxStat::ProcessInfo.owner(pid)
|
698
757
|
=> "sourav"
|
699
758
|
|
700
|
-
# File: process_info.rb | Line:
|
759
|
+
# File: process_info.rb | Line: 112
|
760
|
+
# Definition: def process_name(pid = $$)
|
761
|
+
LinuxStat::ProcessInfo.process_name(pid)
|
762
|
+
=> "linuxstat.rb"
|
763
|
+
|
764
|
+
# File: process_info.rb | Line: 213
|
701
765
|
# Definition: def resident_memory(pid = $$)
|
702
766
|
LinuxStat::ProcessInfo.resident_memory(pid)
|
703
|
-
=>
|
767
|
+
=> 30973.952
|
704
768
|
|
705
|
-
# File: process_info.rb | Line:
|
769
|
+
# File: process_info.rb | Line: 586
|
706
770
|
# Definition: def running_time(pid = $$)
|
707
771
|
LinuxStat::ProcessInfo.running_time(pid)
|
708
|
-
=> 1.
|
772
|
+
=> 1.19
|
773
|
+
|
774
|
+
# File: process_info.rb | Line: 234
|
775
|
+
# Definition: def shared_memory(pid = $$)
|
776
|
+
LinuxStat::ProcessInfo.shared_memory(pid)
|
777
|
+
=> 6152.192
|
709
778
|
|
710
|
-
# File: process_info.rb | Line:
|
779
|
+
# File: process_info.rb | Line: 567
|
711
780
|
# Definition: def start_time(pid = $$)
|
712
781
|
LinuxStat::ProcessInfo.start_time(pid)
|
713
|
-
=> 2021-
|
782
|
+
=> 2021-02-06 04:32:07 +0530
|
714
783
|
|
715
|
-
# File: process_info.rb | Line:
|
784
|
+
# File: process_info.rb | Line: 539
|
716
785
|
# Definition: def start_time_epoch(pid = $$)
|
717
786
|
LinuxStat::ProcessInfo.start_time_epoch(pid)
|
718
|
-
=>
|
787
|
+
=> 1612566127
|
719
788
|
|
720
|
-
# File: process_info.rb | Line:
|
789
|
+
# File: process_info.rb | Line: 611
|
721
790
|
# Definition: def state(pid = $$)
|
722
791
|
LinuxStat::ProcessInfo.state(pid)
|
723
792
|
=> "R"
|
724
793
|
|
725
|
-
# File: process_info.rb | Line:
|
794
|
+
# File: process_info.rb | Line: 392
|
726
795
|
# Definition: def thread_usage(pid: $$, sleep: ticks_to_ms_t5)
|
727
796
|
LinuxStat::ProcessInfo.thread_usage(pid:, sleep:)
|
728
797
|
=> 0.0
|
729
798
|
|
730
|
-
# File: process_info.rb | Line:
|
799
|
+
# File: process_info.rb | Line: 441
|
731
800
|
# Definition: def threads(pid = $$)
|
732
801
|
LinuxStat::ProcessInfo.threads(pid)
|
733
802
|
=> 1
|
@@ -737,15 +806,15 @@ LinuxStat::ProcessInfo.threads(pid)
|
|
737
806
|
LinuxStat::ProcessInfo.total_io(pid)
|
738
807
|
=> {:read_bytes=>0, :write_bytes=>0}
|
739
808
|
|
740
|
-
# File: process_info.rb | Line:
|
809
|
+
# File: process_info.rb | Line: 472
|
741
810
|
# Definition: def uid(pid = $$)
|
742
811
|
LinuxStat::ProcessInfo.uid(pid)
|
743
812
|
=> {:real=>1000, :effective=>1000, :saved_set=>1000, :filesystem_uid=>1000}
|
744
813
|
|
745
|
-
# File: process_info.rb | Line:
|
814
|
+
# File: process_info.rb | Line: 192
|
746
815
|
# Definition: def virtual_memory(pid = $$)
|
747
816
|
LinuxStat::ProcessInfo.virtual_memory(pid)
|
748
|
-
=>
|
817
|
+
=> 96198.656
|
749
818
|
|
750
819
|
```
|
751
820
|
|
@@ -756,40 +825,45 @@ LinuxStat::ProcessInfo.virtual_memory(pid)
|
|
756
825
|
LinuxStat::Swap.any?()
|
757
826
|
=> true
|
758
827
|
|
759
|
-
# File: swap.rb | Line:
|
828
|
+
# File: swap.rb | Line: 84
|
760
829
|
# Definition: def available
|
761
830
|
LinuxStat::Swap.available()
|
762
|
-
=>
|
831
|
+
=> 2800844
|
832
|
+
|
833
|
+
# File: swap.rb | Line: 73
|
834
|
+
# Definition: def free
|
835
|
+
LinuxStat::Swap.free()
|
836
|
+
=> 2800844
|
763
837
|
|
764
838
|
# File: swap.rb | Line: 10
|
765
839
|
# Definition: def list
|
766
840
|
LinuxStat::Swap.list()
|
767
|
-
=> {"/dev/zram0"=>[:partition, 4194300,
|
841
|
+
=> {"/dev/zram0"=>[:partition, 4194300, 1393456, -2]}
|
768
842
|
|
769
|
-
# File: swap.rb | Line:
|
843
|
+
# File: swap.rb | Line: 127
|
770
844
|
# Definition: def percent_available
|
771
845
|
LinuxStat::Swap.percent_available()
|
772
|
-
=>
|
846
|
+
=> 66.78
|
773
847
|
|
774
|
-
# File: swap.rb | Line:
|
848
|
+
# File: swap.rb | Line: 107
|
775
849
|
# Definition: def percent_used
|
776
850
|
LinuxStat::Swap.percent_used()
|
777
|
-
=>
|
851
|
+
=> 33.22
|
778
852
|
|
779
853
|
# File: swap.rb | Line: 34
|
780
854
|
# Definition: def stat
|
781
855
|
LinuxStat::Swap.stat()
|
782
|
-
=> {:total=>4194300, :used=>
|
856
|
+
=> {:total=>4194300, :used=>1393456, :available=>2800844, :percent_used=>33.22, :percent_available=>66.78}
|
783
857
|
|
784
|
-
# File: swap.rb | Line:
|
858
|
+
# File: swap.rb | Line: 62
|
785
859
|
# Definition: def total
|
786
860
|
LinuxStat::Swap.total()
|
787
861
|
=> 4194300
|
788
862
|
|
789
|
-
# File: swap.rb | Line:
|
863
|
+
# File: swap.rb | Line: 98
|
790
864
|
# Definition: def used
|
791
865
|
LinuxStat::Swap.used()
|
792
|
-
=>
|
866
|
+
=> 1393456
|
793
867
|
|
794
868
|
```
|
795
869
|
|
@@ -854,6 +928,43 @@ LinuxStat::Sysconf.tty_name_max()
|
|
854
928
|
|
855
929
|
```
|
856
930
|
|
931
|
+
### LinuxStat::Sysinfo
|
932
|
+
```
|
933
|
+
LinuxStat::Sysinfo.bufferram()
|
934
|
+
=> 4096
|
935
|
+
|
936
|
+
LinuxStat::Sysinfo.freehigh()
|
937
|
+
=> 0
|
938
|
+
|
939
|
+
LinuxStat::Sysinfo.freeram()
|
940
|
+
=> 281231360
|
941
|
+
|
942
|
+
LinuxStat::Sysinfo.freeswap()
|
943
|
+
=> 2868064256
|
944
|
+
|
945
|
+
LinuxStat::Sysinfo.loads()
|
946
|
+
=> [4.5693359375, 3.85400390625, 3.53515625]
|
947
|
+
|
948
|
+
LinuxStat::Sysinfo.sharedram()
|
949
|
+
=> 694075392
|
950
|
+
|
951
|
+
LinuxStat::Sysinfo.stat()
|
952
|
+
=> {:totalram=>3928305664, :freeram=>281231360, :sharedram=>694075392, :bufferram=>4096, :totalswap=>4294963200, :freeswap=>2868064256, :totalhigh=>0, :freehigh=>0, :uptime=>60724, :loads=>[4.5693359375, 3.85400390625, 3.53515625]}
|
953
|
+
|
954
|
+
LinuxStat::Sysinfo.totalhigh()
|
955
|
+
=> 0
|
956
|
+
|
957
|
+
LinuxStat::Sysinfo.totalram()
|
958
|
+
=> 3928305664
|
959
|
+
|
960
|
+
LinuxStat::Sysinfo.totalswap()
|
961
|
+
=> 4294963200
|
962
|
+
|
963
|
+
LinuxStat::Sysinfo.uptime()
|
964
|
+
=> 60724
|
965
|
+
|
966
|
+
```
|
967
|
+
|
857
968
|
### LinuxStat::Thermal
|
858
969
|
```
|
859
970
|
# File: thermal.rb | Line: 59
|
@@ -869,12 +980,12 @@ LinuxStat::Thermal.count_sensors()
|
|
869
980
|
# File: thermal.rb | Line: 41
|
870
981
|
# Definition: def fans
|
871
982
|
LinuxStat::Thermal.fans()
|
872
|
-
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"Processor Fan", :rpm=>
|
983
|
+
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"Processor Fan", :rpm=>2686}]
|
873
984
|
|
874
985
|
# File: thermal.rb | Line: 23
|
875
986
|
# Definition: def temperatures
|
876
987
|
LinuxStat::Thermal.temperatures()
|
877
|
-
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"SODIMM", :temperature=>
|
988
|
+
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"SODIMM", :temperature=>36.0}, {:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"CPU", :temperature=>50.0}, {:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"Ambi...
|
878
989
|
|
879
990
|
```
|
880
991
|
|
@@ -883,17 +994,17 @@ LinuxStat::Thermal.temperatures()
|
|
883
994
|
# File: usb.rb | Line: 139
|
884
995
|
# Definition: def count
|
885
996
|
LinuxStat::USB.count()
|
886
|
-
=>
|
997
|
+
=> 11
|
887
998
|
|
888
999
|
# File: usb.rb | Line: 139
|
889
1000
|
# Definition: def count
|
890
1001
|
LinuxStat::USB.count_devices()
|
891
|
-
=>
|
1002
|
+
=> 11
|
892
1003
|
|
893
1004
|
# File: usb.rb | Line: 49
|
894
1005
|
# Definition: def devices_stat(hwdata: true)
|
895
1006
|
LinuxStat::USB.devices_stat(hwdata:)
|
896
|
-
=> [{:path=>"/sys/bus/usb/devices/1-1.2/", :id=>"04d9:1203", :vendor_id=>"04d9", :product_id=>"1203", :bus_num=>1, :dev_num=>
|
1007
|
+
=> [{:path=>"/sys/bus/usb/devices/1-1.2/", :id=>"04d9:1203", :vendor_id=>"04d9", :product_id=>"1203", :bus_num=>1, :dev_num=>20, :hwdata=>{:vendor=>"Holtek Semiconductor, Inc.", :product=>"Keyboard"}, :authorized=>true, :b_max_power=>"100mA", :b_max_pack...
|
897
1008
|
|
898
1009
|
# File: usb.rb | Line: 179
|
899
1010
|
# Definition: def hwdata_file
|
@@ -1025,7 +1136,6 @@ LinuxStat::User.usernames_by_uid(uid)
|
|
1025
1136
|
|
1026
1137
|
```
|
1027
1138
|
|
1028
|
-
|
1029
1139
|
---
|
1030
1140
|
|
1031
1141
|
## Note 1: CPU usage, and Net usage
|