linux_stat 1.3.1 → 2.0.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 +206 -106
- 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 +92 -0
- data/ext/procfs/statm.h +99 -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/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 +106 -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: b1292d974695e1622fd5ca04cd91393b325a8acd4116727498b077b74b530aa6
|
4
|
+
data.tar.gz: ba39825500d32ebaafa6d0a6176901c34e9abc98ea747f6035f4731db9ed1818
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4ae4eed738ade10f5aa8202a6552c9a4e05d2e8ba22c6f2e6f2b8f5f59a38f057befe3f2b5cef4302917ba04477c21a5fedf34538cca32256dea55df408dcee5
|
7
|
+
data.tar.gz: 1569d7d670cb488b10fac97f0bfcf9c8e6c9ce3ff997524dc478e5a762e7806bbf84fb06e31f4c7376ef0c2f48e6b08f5f27671abdc5c7d54e041971ca17da64
|
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.
|
@@ -85,7 +89,7 @@ It's generated by linuxstat.rb command, which is available after the installatio
|
|
85
89
|
|
86
90
|
For ease of use, LinuxStat is also assigned to the LS constant.
|
87
91
|
|
88
|
-
|
92
|
+
#### LinuxStat::BIOS
|
89
93
|
```
|
90
94
|
# File: bios.rb | Line: 58
|
91
95
|
# Definition: def date
|
@@ -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.538
|
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"=>1980781, "cpu1"=>2000008, "cpu2"=>1760131, "cpu3"=>2000064}
|
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=>9.52, 1=>16.67, 2=>16.67, 3=>0.0, 4=>0.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
|
+
=> 0.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
|
-
=> 5.
|
255
|
+
=> 5.0
|
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=>5.26, 1=>20.0, 2=>0.0, 3=>0.0, 4=>0.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=>8714668, :block_avail_unpriv=>8714668, :inodes=>58612160, :free_inodes=>56817750, :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
|
+
=> 35695280128
|
273
277
|
|
274
278
|
# File: filesystem.rb | Line: 60
|
275
279
|
# Definition: def free(fs = ?..freeze)
|
276
280
|
LinuxStat::Filesystem.free(fs)
|
277
|
-
=>
|
281
|
+
=> 35695280128
|
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=>35695280128, :used=>84285911040}
|
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=>8714668, :block_avail_unpriv=>8714668, :inodes=>58612160, :free_inodes=>56817750, :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
|
+
=> 84285911040
|
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
|
+
=> 1155372
|
365
|
+
|
366
|
+
# File: memory.rb | Line: 52
|
367
|
+
# Definition: def free
|
368
|
+
LinuxStat::Memory.free()
|
369
|
+
=> 261316
|
361
370
|
|
362
|
-
# File: memory.rb | Line:
|
371
|
+
# File: memory.rb | Line: 93
|
363
372
|
# Definition: def percent_available
|
364
373
|
LinuxStat::Memory.percent_available()
|
365
|
-
=>
|
374
|
+
=> 30.12
|
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
|
+
=> 69.88
|
371
380
|
|
372
381
|
# File: memory.rb | Line: 13
|
373
382
|
# Definition: def stat
|
374
383
|
LinuxStat::Memory.stat()
|
375
|
-
=> {:total=>
|
384
|
+
=> {:total=>3836228, :used=>2680856, :available=>1155372, :percent_used=>69.88, :percent_available=>30.12}
|
376
385
|
|
377
386
|
# File: memory.rb | Line: 42
|
378
387
|
# Definition: def total
|
379
388
|
LinuxStat::Memory.total()
|
380
|
-
=>
|
389
|
+
=> 3836228
|
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
|
+
=> 2680856
|
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=>35695280128, :available=>35695280128, :used=>84285911040, :percent_used=>70.25, :percent_free=>29.75, :percent_available=>29.75}
|
395
404
|
|
396
405
|
# File: mounts.rb | Line: 139
|
397
406
|
# Definition: def devices_stat
|
@@ -401,17 +410,17 @@ LinuxStat::Mounts.devices_stat()
|
|
401
410
|
# File: mounts.rb | Line: 13
|
402
411
|
# Definition: def list
|
403
412
|
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=
|
413
|
+
=> ["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=1892888k,nr_inodes=473222,mode=755 0 0", "run /run tmpfs rw,nosuid,nodev,relatime,mode=755 0 0", "...
|
405
414
|
|
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/perf_event", "pstore...
|
415
424
|
|
416
425
|
# File: mounts.rb | Line: 82
|
417
426
|
# Definition: def mount_point(dev = root)
|
@@ -445,7 +454,7 @@ LinuxStat::Mounts.tmpfs()
|
|
445
454
|
# File: net.rb | Line: 86
|
446
455
|
# Definition: def usage(interval = 0.1)
|
447
456
|
LinuxStat::Net.current_usage(interval)
|
448
|
-
=> {:received=>
|
457
|
+
=> {:received=>2805500.0, :transmitted=>127290.0}
|
449
458
|
|
450
459
|
# File: net.rb | Line: 12
|
451
460
|
# Definition: def ipv4_private
|
@@ -455,22 +464,22 @@ LinuxStat::Net.ipv4_private()
|
|
455
464
|
# File: net.rb | Line: 27
|
456
465
|
# Definition: def total_bytes
|
457
466
|
LinuxStat::Net.total_bytes()
|
458
|
-
=> {:received=>
|
467
|
+
=> {:received=>1312151997, :transmitted=>81641336}
|
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
|
+
=> 1312151997
|
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
|
+
=> 81641336
|
469
478
|
|
470
479
|
# File: net.rb | Line: 86
|
471
480
|
# Definition: def usage(interval = 0.1)
|
472
481
|
LinuxStat::Net.usage(interval)
|
473
|
-
=> {:received=>
|
482
|
+
=> {:received=>2971440.0, :transmitted=>80020.0}
|
474
483
|
|
475
484
|
```
|
476
485
|
|
@@ -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=>2.78173828125, 5=>2.96923828125, 15=>2.40185546875}
|
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=>5, :minute=>33, :second=>59.77}
|
537
|
+
|
538
|
+
# File: os.rb | Line: 174
|
539
|
+
# Definition: def uptime_f
|
540
|
+
LinuxStat::OS.uptime_f()
|
541
|
+
=> 20039.77
|
542
|
+
|
543
|
+
# File: os.rb | Line: 185
|
544
|
+
# Definition: def uptime_i
|
545
|
+
LinuxStat::OS.uptime_i()
|
546
|
+
=> 20040
|
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 = 388183402613652, precision:)
|
599
|
+
=> "353.05 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 = 937555692903085, precision:)
|
604
|
+
=> "937.56 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 = 542625870963586, precision:)
|
609
|
+
=> "493.52 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 = 861937756585891, precision:)
|
614
|
+
=> "861.94 TB"
|
615
|
+
|
616
|
+
```
|
617
|
+
|
618
|
+
### LinuxStat::ProcFS
|
619
|
+
```
|
620
|
+
LinuxStat::ProcFS.last_pid()
|
621
|
+
=> 12587
|
622
|
+
|
623
|
+
LinuxStat::ProcFS.uptime_f()
|
624
|
+
=> 20039.98
|
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
|
+
=> 190
|
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, 135, 140, 165, 167, 170, 171, 175, 180, 181, 182, 183, 184, 185, 186, 188, 225, 232, 234, 270, 415, 419, 422, 10749, 11032, 11078, 11124, 11128,...
|
644
|
+
|
645
|
+
# File: process.rb | Line: 160
|
646
|
+
# Definition: def last_pid
|
647
|
+
LinuxStat::Process.last_pid()
|
648
|
+
=> 12587
|
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
658
|
=> {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
659
|
|
616
|
-
# File: process.rb | Line:
|
660
|
+
# File: process.rb | Line: 138
|
617
661
|
# Definition: def running
|
618
662
|
LinuxStat::Process.running()
|
619
|
-
=> [
|
663
|
+
=> [12583]
|
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, 164, 166, 189, 217, 233, 235, 307, 310, 311, 312, 313, 418, 420, 421, 424, 426, 429, 444, 447, 450, 481,...
|
625
669
|
|
626
|
-
# File: process.rb | Line:
|
670
|
+
# File: process.rb | Line: 147
|
671
|
+
# Definition: def stopped
|
672
|
+
LinuxStat::Process.stopped()
|
673
|
+
=> []
|
674
|
+
|
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,102 @@ 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: 340
|
661
710
|
# Definition: def cpu_usage(pid: $$, sleep: ticks_to_ms_t5)
|
662
711
|
LinuxStat::ProcessInfo.cpu_usage(pid:, sleep:)
|
663
712
|
=> 0.0
|
664
713
|
|
665
|
-
# File: process_info.rb | Line:
|
714
|
+
# File: process_info.rb | Line: 496
|
666
715
|
# Definition: def gid(pid = $$)
|
667
716
|
LinuxStat::ProcessInfo.gid(pid)
|
668
717
|
=> {:real=>1000, :effective=>1000, :saved_set=>1000, :filesystem_uid=>1000}
|
669
718
|
|
670
|
-
# File: process_info.rb | Line:
|
719
|
+
# File: process_info.rb | Line: 462
|
671
720
|
# Definition: def last_executed_cpu(pid = $$)
|
672
721
|
LinuxStat::ProcessInfo.last_executed_cpu(pid)
|
673
|
-
=>
|
722
|
+
=> 1
|
674
723
|
|
675
|
-
# File: process_info.rb | Line:
|
724
|
+
# File: process_info.rb | Line: 151
|
676
725
|
# Definition: def mem_stat(pid = $$)
|
677
726
|
LinuxStat::ProcessInfo.mem_stat(pid)
|
678
|
-
=> {:memory=>
|
727
|
+
=> {:memory=>24576000, :virtual_memory=>96206848, :resident_memory=>30736384, :shared_memory=>6160384}
|
679
728
|
|
680
|
-
# File: process_info.rb | Line:
|
729
|
+
# File: process_info.rb | Line: 171
|
681
730
|
# Definition: def memory(pid = $$)
|
682
731
|
LinuxStat::ProcessInfo.memory(pid)
|
683
|
-
=>
|
732
|
+
=> 24576.0
|
684
733
|
|
685
|
-
# File: process_info.rb | Line:
|
734
|
+
# File: process_info.rb | Line: 624
|
686
735
|
# Definition: def nice(pid = $$)
|
687
736
|
LinuxStat::ProcessInfo.nice(pid)
|
688
737
|
=> 0
|
689
738
|
|
690
|
-
# File: process_info.rb | Line:
|
739
|
+
# File: process_info.rb | Line: 654
|
691
740
|
# Definition: def nproc(pid = $$)
|
692
741
|
LinuxStat::ProcessInfo.nproc(pid)
|
693
742
|
=> 4
|
694
743
|
|
695
|
-
# File: process_info.rb | Line:
|
744
|
+
# File: process_info.rb | Line: 517
|
696
745
|
# Definition: def owner(pid = $$)
|
697
746
|
LinuxStat::ProcessInfo.owner(pid)
|
698
747
|
=> "sourav"
|
699
748
|
|
700
|
-
# File: process_info.rb | Line:
|
749
|
+
# File: process_info.rb | Line: 112
|
750
|
+
# Definition: def process_name(pid = $$)
|
751
|
+
LinuxStat::ProcessInfo.process_name(pid)
|
752
|
+
=> "linuxstat.rb"
|
753
|
+
|
754
|
+
# File: process_info.rb | Line: 213
|
701
755
|
# Definition: def resident_memory(pid = $$)
|
702
756
|
LinuxStat::ProcessInfo.resident_memory(pid)
|
703
|
-
=>
|
757
|
+
=> 30736.384
|
704
758
|
|
705
|
-
# File: process_info.rb | Line:
|
759
|
+
# File: process_info.rb | Line: 586
|
706
760
|
# Definition: def running_time(pid = $$)
|
707
761
|
LinuxStat::ProcessInfo.running_time(pid)
|
708
762
|
=> 1.02
|
709
763
|
|
710
|
-
# File: process_info.rb | Line:
|
764
|
+
# File: process_info.rb | Line: 234
|
765
|
+
# Definition: def shared_memory(pid = $$)
|
766
|
+
LinuxStat::ProcessInfo.shared_memory(pid)
|
767
|
+
=> 6160.384
|
768
|
+
|
769
|
+
# File: process_info.rb | Line: 567
|
711
770
|
# Definition: def start_time(pid = $$)
|
712
771
|
LinuxStat::ProcessInfo.start_time(pid)
|
713
|
-
=> 2021-01
|
772
|
+
=> 2021-02-01 16:58:34 +0530
|
714
773
|
|
715
|
-
# File: process_info.rb | Line:
|
774
|
+
# File: process_info.rb | Line: 539
|
716
775
|
# Definition: def start_time_epoch(pid = $$)
|
717
776
|
LinuxStat::ProcessInfo.start_time_epoch(pid)
|
718
|
-
=>
|
777
|
+
=> 1612178914
|
719
778
|
|
720
|
-
# File: process_info.rb | Line:
|
779
|
+
# File: process_info.rb | Line: 611
|
721
780
|
# Definition: def state(pid = $$)
|
722
781
|
LinuxStat::ProcessInfo.state(pid)
|
723
782
|
=> "R"
|
724
783
|
|
725
|
-
# File: process_info.rb | Line:
|
784
|
+
# File: process_info.rb | Line: 392
|
726
785
|
# Definition: def thread_usage(pid: $$, sleep: ticks_to_ms_t5)
|
727
786
|
LinuxStat::ProcessInfo.thread_usage(pid:, sleep:)
|
728
787
|
=> 0.0
|
729
788
|
|
730
|
-
# File: process_info.rb | Line:
|
789
|
+
# File: process_info.rb | Line: 441
|
731
790
|
# Definition: def threads(pid = $$)
|
732
791
|
LinuxStat::ProcessInfo.threads(pid)
|
733
792
|
=> 1
|
@@ -735,17 +794,17 @@ LinuxStat::ProcessInfo.threads(pid)
|
|
735
794
|
# File: process_info.rb | Line: 30
|
736
795
|
# Definition: def total_io(pid = $$)
|
737
796
|
LinuxStat::ProcessInfo.total_io(pid)
|
738
|
-
=> {:read_bytes=>
|
797
|
+
=> {:read_bytes=>1245184, :write_bytes=>0}
|
739
798
|
|
740
|
-
# File: process_info.rb | Line:
|
799
|
+
# File: process_info.rb | Line: 472
|
741
800
|
# Definition: def uid(pid = $$)
|
742
801
|
LinuxStat::ProcessInfo.uid(pid)
|
743
802
|
=> {:real=>1000, :effective=>1000, :saved_set=>1000, :filesystem_uid=>1000}
|
744
803
|
|
745
|
-
# File: process_info.rb | Line:
|
804
|
+
# File: process_info.rb | Line: 192
|
746
805
|
# Definition: def virtual_memory(pid = $$)
|
747
806
|
LinuxStat::ProcessInfo.virtual_memory(pid)
|
748
|
-
=>
|
807
|
+
=> 96206.848
|
749
808
|
|
750
809
|
```
|
751
810
|
|
@@ -756,40 +815,45 @@ LinuxStat::ProcessInfo.virtual_memory(pid)
|
|
756
815
|
LinuxStat::Swap.any?()
|
757
816
|
=> true
|
758
817
|
|
759
|
-
# File: swap.rb | Line:
|
818
|
+
# File: swap.rb | Line: 81
|
760
819
|
# Definition: def available
|
761
820
|
LinuxStat::Swap.available()
|
762
|
-
=>
|
821
|
+
=> 3856636
|
822
|
+
|
823
|
+
# File: swap.rb | Line: 70
|
824
|
+
# Definition: def free
|
825
|
+
LinuxStat::Swap.free()
|
826
|
+
=> 3856636
|
763
827
|
|
764
828
|
# File: swap.rb | Line: 10
|
765
829
|
# Definition: def list
|
766
830
|
LinuxStat::Swap.list()
|
767
|
-
=> {"/dev/zram0"=>[:partition, 4194300,
|
831
|
+
=> {"/dev/zram0"=>[:partition, 4194300, 337664, -2]}
|
768
832
|
|
769
|
-
# File: swap.rb | Line:
|
833
|
+
# File: swap.rb | Line: 116
|
770
834
|
# Definition: def percent_available
|
771
835
|
LinuxStat::Swap.percent_available()
|
772
|
-
=>
|
836
|
+
=> 91.95
|
773
837
|
|
774
|
-
# File: swap.rb | Line:
|
838
|
+
# File: swap.rb | Line: 102
|
775
839
|
# Definition: def percent_used
|
776
840
|
LinuxStat::Swap.percent_used()
|
777
|
-
=>
|
841
|
+
=> 8.05
|
778
842
|
|
779
843
|
# File: swap.rb | Line: 34
|
780
844
|
# Definition: def stat
|
781
845
|
LinuxStat::Swap.stat()
|
782
|
-
=> {:total=>4194300, :used=>
|
846
|
+
=> {:total=>4194300, :used=>337664, :available=>3856636, :percent_used=>8.05, :percent_available=>91.95}
|
783
847
|
|
784
848
|
# File: swap.rb | Line: 59
|
785
849
|
# Definition: def total
|
786
850
|
LinuxStat::Swap.total()
|
787
851
|
=> 4194300
|
788
852
|
|
789
|
-
# File: swap.rb | Line:
|
853
|
+
# File: swap.rb | Line: 93
|
790
854
|
# Definition: def used
|
791
855
|
LinuxStat::Swap.used()
|
792
|
-
=>
|
856
|
+
=> 337664
|
793
857
|
|
794
858
|
```
|
795
859
|
|
@@ -854,6 +918,43 @@ LinuxStat::Sysconf.tty_name_max()
|
|
854
918
|
|
855
919
|
```
|
856
920
|
|
921
|
+
### LinuxStat::Sysinfo
|
922
|
+
```
|
923
|
+
LinuxStat::Sysinfo.bufferram()
|
924
|
+
=> 4096
|
925
|
+
|
926
|
+
LinuxStat::Sysinfo.freehigh()
|
927
|
+
=> 0
|
928
|
+
|
929
|
+
LinuxStat::Sysinfo.freeram()
|
930
|
+
=> 251408384
|
931
|
+
|
932
|
+
LinuxStat::Sysinfo.freeswap()
|
933
|
+
=> 3949195264
|
934
|
+
|
935
|
+
LinuxStat::Sysinfo.loads()
|
936
|
+
=> [2.78173828125, 2.96923828125, 2.40185546875]
|
937
|
+
|
938
|
+
LinuxStat::Sysinfo.sharedram()
|
939
|
+
=> 606461952
|
940
|
+
|
941
|
+
LinuxStat::Sysinfo.stat()
|
942
|
+
=> {:totalram=>3928297472, :freeram=>251408384, :sharedram=>606461952, :bufferram=>4096, :totalswap=>4294963200, :freeswap=>3949195264, :totalhigh=>0, :freehigh=>0, :uptime=>20041, :loads=>[2.78173828125, 2.96923828125, 2.40185546875]}
|
943
|
+
|
944
|
+
LinuxStat::Sysinfo.totalhigh()
|
945
|
+
=> 0
|
946
|
+
|
947
|
+
LinuxStat::Sysinfo.totalram()
|
948
|
+
=> 3928297472
|
949
|
+
|
950
|
+
LinuxStat::Sysinfo.totalswap()
|
951
|
+
=> 4294963200
|
952
|
+
|
953
|
+
LinuxStat::Sysinfo.uptime()
|
954
|
+
=> 20041
|
955
|
+
|
956
|
+
```
|
957
|
+
|
857
958
|
### LinuxStat::Thermal
|
858
959
|
```
|
859
960
|
# File: thermal.rb | Line: 59
|
@@ -869,12 +970,12 @@ LinuxStat::Thermal.count_sensors()
|
|
869
970
|
# File: thermal.rb | Line: 41
|
870
971
|
# Definition: def fans
|
871
972
|
LinuxStat::Thermal.fans()
|
872
|
-
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"Processor Fan", :rpm=>
|
973
|
+
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"Processor Fan", :rpm=>2785}]
|
873
974
|
|
874
975
|
# File: thermal.rb | Line: 23
|
875
976
|
# Definition: def temperatures
|
876
977
|
LinuxStat::Thermal.temperatures()
|
877
|
-
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"SODIMM", :temperature=>
|
978
|
+
=> [{:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"SODIMM", :temperature=>34.0}, {:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"CPU", :temperature=>43.0}, {:path=>"/sys/class/hwmon/hwmon4", :name=>"dell_smm", :label=>"Ambi...
|
878
979
|
|
879
980
|
```
|
880
981
|
|
@@ -1025,7 +1126,6 @@ LinuxStat::User.usernames_by_uid(uid)
|
|
1025
1126
|
|
1026
1127
|
```
|
1027
1128
|
|
1028
|
-
|
1029
1129
|
---
|
1030
1130
|
|
1031
1131
|
## Note 1: CPU usage, and Net usage
|