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 +4 -4
- data/lib/linux_stat/process_info.rb +2 -0
- data/lib/linux_stat/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7af04643c6d2b3886048d2f8e454b6aaea3646a7aca28e46af44bb67e8ecb3f
|
4
|
+
data.tar.gz: fba61371d7ab4169e6c187a81bba56c8016d848afea9b2c6d5a8b2ffd30fb9bb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
data/lib/linux_stat/version.rb
CHANGED