linux_stat 2.1.0 → 2.1.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b86b9e971bbc4cba82696a08bed77a75d05ba88151ab39fe107ea9ce6902bfa1
4
- data.tar.gz: efeb2d8994fc87b3fc6a059f106988df53b3b41ced83ca1099e96210f8dbc299
3
+ metadata.gz: b7af04643c6d2b3886048d2f8e454b6aaea3646a7aca28e46af44bb67e8ecb3f
4
+ data.tar.gz: fba61371d7ab4169e6c187a81bba56c8016d848afea9b2c6d5a8b2ffd30fb9bb
5
5
  SHA512:
6
- metadata.gz: 2af9a6be65de9ed75f1d7e19fa4b19c4557a35dcffa375daef08355b6e468ba8c25f09937cfb6dbda8bc5d87999144db06408263a1f9a37901cded9bc56c7d5d
7
- data.tar.gz: d67f4d12cc911c0d6abdc3bb08f8a913d028e39a454cca041af3b1cd6f59d5fa53d667620a698047db85dde1e9660d877576bb0e6f4aa8c1c2f40cfbb5b17acd
6
+ metadata.gz: 33272ae30466df860dd3330cdbac62031a9f1022f6854577c83330705cb2ec5c3b2864cac88d1e5823c2d756e1866496fef01e3ef77f26e8e82dd71d14a7ad1a
7
+ data.tar.gz: 1004e9136ce2b252a7c4ce2f408dcaa4558dd1d4219edc61a049ead3456ab571a7b17058663462136858372659855b894c578c15f0099d84ae2a99ed8d30824e
@@ -664,6 +664,7 @@ module LinuxStat
664
664
  def cpu_time(pid = $$)
665
665
  times = LinuxStat::ProcFS.ps_stat(pid)
666
666
  utime, stime, cutime, cstime = times[10], times[11], times[12], times[13]
667
+ return nil unless utime && stime && cutime && cstime
667
668
 
668
669
  utime.+(stime).+(cutime).+(cstime) / get_ticks
669
670
  end
@@ -676,6 +677,7 @@ module LinuxStat
676
677
  # The return value is a Hash.
677
678
  def cpu_times(pid = $$)
678
679
  v = cpu_time(pid)
680
+ return {} unless v
679
681
 
680
682
  hour = v / 3600
681
683
  min = v % 3600 / 60
@@ -1,3 +1,3 @@
1
1
  module LinuxStat
2
- VERSION ||= "2.1.0"
2
+ VERSION ||= "2.1.1"
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: 2.1.0
4
+ version: 2.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sourav Goswami