linux_stat 0.7.2 → 0.7.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d2e39de1fbc809e3c2ebb150e92cd77584ce6fee22107966bdaab7a7c329e164
4
- data.tar.gz: a66c52567c7ccb2e7ace5c7737a797d9de49a912c082d8432ec13fddfaac1e06
3
+ metadata.gz: 9aaa7608b7663765621d718c95aaeedad578364aa83f09fcd678399bb7ebd783
4
+ data.tar.gz: 98695af9e725d99fda2fc0209082b796247dd9fb1a72fa316b6edd1d121124c3
5
5
  SHA512:
6
- metadata.gz: a73282108e1b16b1841e87188fd54099c44fdeecf2f69095335eb2a8ced7a8a5994f00a163bfe3620c17f7a9f487e6761f1895327ebeac3ac41490e4de7f33f9
7
- data.tar.gz: 6101b6f1199bf969bcf4b7c28c1cfc1ae4c59177739650aa4962060721da9f36ed4c5d40ecebc45cdf668d715fb2e4d5e33f9b121dc37db4652128b210c36320
6
+ metadata.gz: f34856c25125b173e87df17a127b872ebf8abb3c4d0f432cf6dbcc564c3c9a5bb1ab873c9d0695156255cc1ffc994e891b84958702192fe8f2f8925b2e17dd2c
7
+ data.tar.gz: b639f0c37d74d8edac8315180a196001ad387f5fefdee48e9335aa95c0dce593c63ffd00f0e100dc1222dd0c8212b7a73a93e6627c1ad8b00ee47327a1df1989
data/README.md CHANGED
@@ -136,7 +136,7 @@ LinuxStat::CPU.count()
136
136
  # File: cpu.rb | Line: 101
137
137
  # Definition: def cur_freq
138
138
  LinuxStat::CPU.cur_freq()
139
- => [2000018, 2000008, 2000003, 1992870]
139
+ => [2000052, 2000013, 2000012, 1960509]
140
140
 
141
141
  # File: cpu.rb | Line: 116
142
142
  # Definition: def max_freq
@@ -151,27 +151,30 @@ LinuxStat::CPU.model()
151
151
  # File: cpu.rb | Line: 21
152
152
  # Definition: def stat(sleep = ticks_to_ms)
153
153
  LinuxStat::CPU.stat(sleep)
154
- => {0=>25.0, 1=>50.0, 2=>0.0, 3=>0.0, 4=>50.0}
154
+ => {0=>20.0, 1=>0.0, 2=>0.0, 3=>0.0, 4=>0.0}
155
155
 
156
- # File: linuxstat.rb | Line: 11
157
- # Definition: define_singleton_method(:total_usage) do
158
- LinuxStat::CPU.total_usage()
159
- => nil
156
+ # File: cpu.rb | Line: 63
157
+ # Definition: def total_usage(sleep = ticks_to_ms)
158
+ LinuxStat::CPU.usage(sleep)
159
+ => 50.0
160
160
 
161
161
  # File: cpu.rb | Line: 63
162
162
  # Definition: def total_usage(sleep = ticks_to_ms)
163
163
  LinuxStat::CPU.usage(sleep)
164
- => 60.0
164
+ => 20.0
165
165
 
166
166
  # File: cpu.rb | Line: 21
167
167
  # Definition: def stat(sleep = ticks_to_ms)
168
168
  LinuxStat::CPU.usages(sleep)
169
- => {0=>33.33, 1=>0.0, 2=>0.0, 3=>0.0, 4=>100.0}
169
+ => {0=>0.0, 1=>0.0, 2=>0.0, 3=>0.0, 4=>0.0}
170
170
 
171
171
  ```
172
172
 
173
173
  ### LinuxStat::FS
174
174
  ```
175
+ LinuxStat::FS.stat(arg = "/")
176
+ => {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>12825937, :block_avail_unpriv=>12825937, :inodes=>58612160, :free_inodes=>56967681, :filesystem_id=>2050, :mount_flags=>1024, :max_filename_length=>255}
177
+
175
178
  ```
176
179
 
177
180
  ### LinuxStat::Filesystem
@@ -179,22 +182,22 @@ LinuxStat::CPU.usages(sleep)
179
182
  # File: filesystem.rb | Line: 92
180
183
  # Definition: def available(fs = ?/.freeze)
181
184
  LinuxStat::Filesystem.available(fs)
182
- => 52544614400
185
+ => 52544036864
183
186
 
184
187
  # File: filesystem.rb | Line: 58
185
188
  # Definition: def free(fs = ?/.freeze)
186
189
  LinuxStat::Filesystem.free(fs)
187
- => 52544614400
190
+ => 52544036864
188
191
 
189
192
  # File: filesystem.rb | Line: 19
190
193
  # Definition: def stat(fs = ?/.freeze)
191
194
  LinuxStat::Filesystem.stat(fs)
192
- => {:total=>119981191168, :free=>52544614400, :used=>67436576768}
195
+ => {:total=>119981191168, :free=>52544036864, :used=>67437154304}
193
196
 
194
197
  # File: filesystem.rb | Line: 108
195
198
  # Definition: def stat_raw(fs = ?/.freeze)
196
199
  LinuxStat::Filesystem.stat_raw(fs)
197
- => {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>12828275, :block_avail_unpriv=>12828275, :inodes=>58612160, :free_inodes=>56968579, :filesystem_id=>2050, :mount_flags=>1024, :max_filename_length=>255}
200
+ => {:block_size=>4096, :fragment_size=>4096, :blocks=>29292283, :block_free=>12828134, :block_avail_unpriv=>12828134, :inodes=>58612160, :free_inodes=>56968284, :filesystem_id=>2050, :mount_flags=>1024, :max_filename_length=>255}
198
201
 
199
202
  # File: filesystem.rb | Line: 39
200
203
  # Definition: def total(fs = ?/.freeze)
@@ -204,7 +207,7 @@ LinuxStat::Filesystem.total(fs)
204
207
  # File: filesystem.rb | Line: 73
205
208
  # Definition: def used(fs = ?/.freeze)
206
209
  LinuxStat::Filesystem.used(fs)
207
- => 67436576768
210
+ => 67437154304
208
211
 
209
212
  ```
210
213
 
@@ -267,22 +270,22 @@ LinuxStat::Kernel.version()
267
270
  # File: memory.rb | Line: 50
268
271
  # Definition: def available
269
272
  LinuxStat::Memory.available()
270
- => 773460
273
+ => 342000
271
274
 
272
275
  # File: memory.rb | Line: 81
273
276
  # Definition: def percent_available
274
277
  LinuxStat::Memory.percent_available()
275
- => 20.16
278
+ => 8.91
276
279
 
277
280
  # File: memory.rb | Line: 70
278
281
  # Definition: def percent_used
279
282
  LinuxStat::Memory.percent_used()
280
- => 79.84
283
+ => 91.09
281
284
 
282
285
  # File: memory.rb | Line: 11
283
286
  # Definition: def stat
284
287
  LinuxStat::Memory.stat()
285
- => {:total=>3836236, :used=>3062776, :available=>773460, :percent_used=>79.84, :percent_available=>20.16}
288
+ => {:total=>3836236, :used=>3494236, :available=>342000, :percent_used=>91.09, :percent_available=>8.91}
286
289
 
287
290
  # File: memory.rb | Line: 40
288
291
  # Definition: def total
@@ -292,7 +295,7 @@ LinuxStat::Memory.total()
292
295
  # File: memory.rb | Line: 60
293
296
  # Definition: def used
294
297
  LinuxStat::Memory.used()
295
- => 3062776
298
+ => 3494236
296
299
 
297
300
  ```
298
301
 
@@ -301,7 +304,7 @@ LinuxStat::Memory.used()
301
304
  # File: mounts.rb | Line: 179
302
305
  # Definition: def device_stat(dev = root)
303
306
  LinuxStat::Mounts.device_stat(dev)
304
- => {:mountpoint=>"/", :total=>119981191168, :free=>52544614400, :available=>52544614400, :used=>67436576768, :percent_used=>56.21, :percent_free=>43.79, :percent_available=>43.79}
307
+ => {:mountpoint=>"/", :total=>119981191168, :free=>52544036864, :available=>52544036864, :used=>67437154304, :percent_used=>56.21, :percent_free=>43.79, :percent_available=>43.79}
305
308
 
306
309
  # File: mounts.rb | Line: 137
307
310
  # Definition: def devices_stat
@@ -365,17 +368,17 @@ LinuxStat::Net.ipv4_private()
365
368
  # File: net.rb | Line: 23
366
369
  # Definition: def total_bytes
367
370
  LinuxStat::Net.total_bytes()
368
- => {:received=>463746011, :transmitted=>35058283}
371
+ => {:received=>509728604, :transmitted=>38480016}
369
372
 
370
373
  # File: net.rb | Line: 41
371
374
  # Definition: def total_bytes_received
372
375
  LinuxStat::Net.total_bytes_received()
373
- => 463746011
376
+ => 509728604
374
377
 
375
378
  # File: net.rb | Line: 54
376
379
  # Definition: def total_bytes_transmitted
377
380
  LinuxStat::Net.total_bytes_transmitted()
378
- => 35058283
381
+ => 38480016
379
382
 
380
383
  # File: net.rb | Line: 80
381
384
  # Definition: def usage(interval = 0.1)
@@ -424,7 +427,7 @@ LinuxStat::OS.os_release()
424
427
  # File: os.rb | Line: 110
425
428
  # Definition: def uptime
426
429
  LinuxStat::OS.uptime()
427
- => {:hour=>5, :minute=>8, :second=>45.6}
430
+ => {:hour=>5, :minute=>29, :second=>14.23}
428
431
 
429
432
  ```
430
433
 
@@ -432,23 +435,23 @@ LinuxStat::OS.uptime()
432
435
  ```
433
436
  # File: prettify_bytes.rb | Line: 42
434
437
  # Definition: def convert_binary(n)
435
- LinuxStat::PrettifyBytes.convert_binary( = 466897525899849)
436
- => "424.64 tebibytes"
438
+ LinuxStat::PrettifyBytes.convert_binary( = 139259240343413)
439
+ => "126.66 tebibytes"
437
440
 
438
441
  # File: prettify_bytes.rb | Line: 19
439
442
  # Definition: def convert_decimal(n)
440
- LinuxStat::PrettifyBytes.convert_decimal( = 126301977853880)
441
- => "126.30 terabytes"
443
+ LinuxStat::PrettifyBytes.convert_decimal( = 9064429892244)
444
+ => "9.06 terabytes"
442
445
 
443
446
  # File: prettify_bytes.rb | Line: 90
444
447
  # Definition: def convert_short_binary(n)
445
- LinuxStat::PrettifyBytes.convert_short_binary( = 751373892255236)
446
- => "683.37 TiB"
448
+ LinuxStat::PrettifyBytes.convert_short_binary( = 768519163615746)
449
+ => "698.96 TiB"
447
450
 
448
451
  # File: prettify_bytes.rb | Line: 65
449
452
  # Definition: def convert_short_decimal(n)
450
- LinuxStat::PrettifyBytes.convert_short_decimal( = 691728311539436)
451
- => "691.73 TB"
453
+ LinuxStat::PrettifyBytes.convert_short_decimal( = 125226567793596)
454
+ => "125.23 TB"
452
455
 
453
456
  ```
454
457
 
@@ -457,7 +460,7 @@ LinuxStat::PrettifyBytes.convert_short_decimal( = 691728311539436)
457
460
  # File: process.rb | Line: 19
458
461
  # Definition: def count
459
462
  LinuxStat::Process.count()
460
- => 201
463
+ => 202
461
464
 
462
465
  # File: process.rb | Line: 71
463
466
  # Definition: def idle
@@ -477,7 +480,7 @@ LinuxStat::Process.names()
477
480
  # File: process.rb | Line: 97
478
481
  # Definition: def running
479
482
  LinuxStat::Process.running()
480
- => [12385]
483
+ => [13667]
481
484
 
482
485
  # File: process.rb | Line: 58
483
486
  # Definition: def sleeping
@@ -511,7 +514,7 @@ LinuxStat::ProcessInfo.command_name(pid)
511
514
  # File: process_info.rb | Line: 247
512
515
  # Definition: def cpu_stat(pid: $$, sleep: ticks_to_ms)
513
516
  LinuxStat::ProcessInfo.cpu_stat(pid:, sleep:)
514
- => {:cpu_usage=>0.0, :threads=>1, :last_executed_cpu=>0}
517
+ => {:cpu_usage=>0.0, :threads=>1, :last_executed_cpu=>1}
515
518
 
516
519
  # File: process_info.rb | Line: 301
517
520
  # Definition: def cpu_usage(pid: $$, sleep: ticks_to_ms)
@@ -526,17 +529,17 @@ LinuxStat::ProcessInfo.gid(pid)
526
529
  # File: process_info.rb | Line: 369
527
530
  # Definition: def last_executed_cpu(pid = $$)
528
531
  LinuxStat::ProcessInfo.last_executed_cpu(pid)
529
- => 0
532
+ => 1
530
533
 
531
534
  # File: process_info.rb | Line: 114
532
535
  # Definition: def mem_stat(pid = $$)
533
536
  LinuxStat::ProcessInfo.mem_stat(pid)
534
- => {:memory=>12251.136, :virtual_memory=>83943.424, :resident_memory=>18247.68}
537
+ => {:memory=>12247.04, :virtual_memory=>83943.424, :resident_memory=>18116.608}
535
538
 
536
539
  # File: process_info.rb | Line: 147
537
540
  # Definition: def memory(pid = $$)
538
541
  LinuxStat::ProcessInfo.memory(pid)
539
- => 12251.136
542
+ => 12247.04
540
543
 
541
544
  # File: process_info.rb | Line: 540
542
545
  # Definition: def nice(pid = $$)
@@ -551,22 +554,22 @@ LinuxStat::ProcessInfo.owner(pid)
551
554
  # File: process_info.rb | Line: 197
552
555
  # Definition: def resident_memory(pid = $$)
553
556
  LinuxStat::ProcessInfo.resident_memory(pid)
554
- => 18247.68
557
+ => 18116.608
555
558
 
556
559
  # File: process_info.rb | Line: 497
557
560
  # Definition: def running_time(pid = $$)
558
561
  LinuxStat::ProcessInfo.running_time(pid)
559
- => 0.680000000000291
562
+ => 1.2999999999992724
560
563
 
561
564
  # File: process_info.rb | Line: 480
562
565
  # Definition: def start_time(pid = $$)
563
566
  LinuxStat::ProcessInfo.start_time(pid)
564
- => 2020-12-17 16:16:17 +0530
567
+ => 2020-12-17 16:36:46 +0530
565
568
 
566
569
  # File: process_info.rb | Line: 449
567
570
  # Definition: def start_time_epoch(pid = $$)
568
571
  LinuxStat::ProcessInfo.start_time_epoch(pid)
569
- => 1608201977
572
+ => 1608203206
570
573
 
571
574
  # File: process_info.rb | Line: 525
572
575
  # Definition: def state(pid = $$)
@@ -605,27 +608,27 @@ LinuxStat::Swap.any?()
605
608
  # File: swap.rb | Line: 68
606
609
  # Definition: def available
607
610
  LinuxStat::Swap.available()
608
- => 2868220
611
+ => 3100412
609
612
 
610
613
  # File: swap.rb | Line: 8
611
614
  # Definition: def list
612
615
  LinuxStat::Swap.list()
613
- => {"/dev/zram0"=>[:partition, 4194300, 1326080, -2]}
616
+ => {"/dev/zram0"=>[:partition, 4194300, 1093888, -2]}
614
617
 
615
618
  # File: swap.rb | Line: 103
616
619
  # Definition: def percent_available
617
620
  LinuxStat::Swap.percent_available()
618
- => 68.38
621
+ => 73.92
619
622
 
620
623
  # File: swap.rb | Line: 89
621
624
  # Definition: def percent_used
622
625
  LinuxStat::Swap.percent_used()
623
- => 31.62
626
+ => 26.08
624
627
 
625
628
  # File: swap.rb | Line: 32
626
629
  # Definition: def stat
627
630
  LinuxStat::Swap.stat()
628
- => {:total=>4194300, :used=>1326080, :available=>2868220, :percent_used=>31.62, :percent_available=>68.38}
631
+ => {:total=>4194300, :used=>1093888, :available=>3100412, :percent_used=>26.08, :percent_available=>73.92}
629
632
 
630
633
  # File: swap.rb | Line: 57
631
634
  # Definition: def total
@@ -635,71 +638,71 @@ LinuxStat::Swap.total()
635
638
  # File: swap.rb | Line: 80
636
639
  # Definition: def used
637
640
  LinuxStat::Swap.used()
638
- => 1326080
641
+ => 1093888
639
642
 
640
643
  ```
641
644
 
642
645
  ### LinuxStat::Sysconf
643
646
  ```
644
- # # LinuxStat::Sysconf.child_max()
647
+ LinuxStat::Sysconf.child_max()
645
648
  => 2000000
646
649
 
647
- # # LinuxStat::Sysconf.get_euid()
650
+ LinuxStat::Sysconf.get_euid()
648
651
  => 1000
649
652
 
650
- # # LinuxStat::Sysconf.get_gid()
653
+ LinuxStat::Sysconf.get_gid()
651
654
  => 1000
652
655
 
653
- # # LinuxStat::Sysconf.get_login()
656
+ LinuxStat::Sysconf.get_login()
654
657
  => "sourav"
655
658
 
656
- # # LinuxStat::Sysconf.get_uid()
659
+ LinuxStat::Sysconf.get_uid()
657
660
  => 1000
658
661
 
659
- # # LinuxStat::Sysconf.get_user()
662
+ LinuxStat::Sysconf.get_user()
660
663
  => "sourav"
661
664
 
662
- # # LinuxStat::Sysconf.hostname_max()
665
+ LinuxStat::Sysconf.hostname_max()
663
666
  => 64
664
667
 
665
- # # LinuxStat::Sysconf.login_name_max()
668
+ LinuxStat::Sysconf.login_name_max()
666
669
  => 256
667
670
 
668
- # # LinuxStat::Sysconf.open_max()
671
+ LinuxStat::Sysconf.open_max()
669
672
  => 8192
670
673
 
671
- # # LinuxStat::Sysconf.pagesize()
674
+ LinuxStat::Sysconf.pagesize()
672
675
  => 4096
673
676
 
674
- # # LinuxStat::Sysconf.posix_version()
677
+ LinuxStat::Sysconf.posix_version()
675
678
  => 200809
676
679
 
677
- # # LinuxStat::Sysconf.sc_clk_tck()
680
+ LinuxStat::Sysconf.sc_clk_tck()
678
681
  => 100
679
682
 
680
- # # LinuxStat::Sysconf.stream_max()
683
+ LinuxStat::Sysconf.stream_max()
681
684
  => 16
682
685
 
683
- # # LinuxStat::Sysconf.tty_name_max()
686
+ LinuxStat::Sysconf.tty_name_max()
684
687
  => 32
685
688
 
686
689
  ```
687
690
 
688
691
  ### LinuxStat::Uname
689
692
  ```
690
- # # LinuxStat::Uname.machine()
693
+ LinuxStat::Uname.machine()
691
694
  => "x86_64"
692
695
 
693
- # # LinuxStat::Uname.nodename()
696
+ LinuxStat::Uname.nodename()
694
697
  => "archlinux"
695
698
 
696
- # # LinuxStat::Uname.release()
699
+ LinuxStat::Uname.release()
697
700
  => "5.9.9-xanmod1-1"
698
701
 
699
- # # LinuxStat::Uname.sysname()
702
+ LinuxStat::Uname.sysname()
700
703
  => "Linux"
701
704
 
702
- # # LinuxStat::Uname.version()
705
+ LinuxStat::Uname.version()
703
706
  => "#1 SMP PREEMPT Fri, 20 Nov 2020 07:44:55 +0000"
704
707
 
705
708
  ```
@@ -7,11 +7,6 @@ rescue LoadError
7
7
  abort "The Gem needs to be installed before this test can be run!"
8
8
  end
9
9
 
10
- module LinuxStat::CPU
11
- define_singleton_method(:total_usage) do
12
- end
13
- end
14
-
15
10
  # Gradient colour to strings
16
11
  class String
17
12
  def colourize(colour = 1, flip: false)
@@ -110,7 +105,6 @@ execute.sort.each do |c|
110
105
  end
111
106
  end
112
107
 
113
-
114
108
  meths.each do |meth|
115
109
  arg = nil
116
110
  params = e.method(meth).parameters
@@ -123,6 +117,8 @@ execute.sort.each do |c|
123
117
  param << "#{p[1]}, "
124
118
  when :key
125
119
  param << "#{p[1]}:, "
120
+ when :req
121
+ param << "#{p[1] || 'arg'}, "
126
122
  end
127
123
  end
128
124
 
@@ -131,13 +127,15 @@ execute.sort.each do |c|
131
127
  if e.method(meth).arity > 0
132
128
  if c == :PrettifyBytes
133
129
  arg = rand(10 ** 15)
130
+ elsif c == :FS
131
+ arg = '/'
134
132
  else
135
133
  next
136
134
  end
137
135
  end
138
136
 
139
137
  disp_meth = "#{meth}"
140
- disp_meth.concat(arg ? "(#{param} = #{arg})" : "(#{param})")
138
+ disp_meth.concat(arg ? "(#{param} = #{arg.inspect})" : "(#{param})")
141
139
 
142
140
  time = Time.now
143
141
  v = arg ? e.send(meth, arg) : e.send(meth)
@@ -1,3 +1,3 @@
1
1
  module LinuxStat
2
- VERSION ||= "0.7.2"
2
+ VERSION ||= "0.7.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: linux_stat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.2
4
+ version: 0.7.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sourav Goswami