vidibus-sysinfo 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
data/README.md
CHANGED
@@ -65,25 +65,25 @@ To get the total traffic of this month in gigabytes, call
|
|
65
65
|
# => 7992.15 # gigabytes
|
66
66
|
```
|
67
67
|
|
68
|
-
### Currently used
|
68
|
+
### Currently used throughput
|
69
69
|
|
70
|
-
To get the currently used
|
70
|
+
To get the currently used throughput in MBit/s, call
|
71
71
|
|
72
72
|
```ruby
|
73
|
-
Vidibus::Sysinfo.
|
73
|
+
Vidibus::Sysinfo.throughput
|
74
74
|
# => 38.71 # MBit/s
|
75
75
|
```
|
76
76
|
|
77
|
-
|
77
|
+
Throughput detection is performed by analyzing the output of /proc/net/dev.
|
78
78
|
To get the amount of traffic in a certain timespan, the analyzer gets
|
79
79
|
called twice and the delta of the two results is the traffic.
|
80
80
|
|
81
|
-
By default,
|
81
|
+
By default, throughput detection only waits one second, thus the results
|
82
82
|
will be quite volatile. To get a more accurate result, you can provide
|
83
83
|
an optional argument:
|
84
84
|
|
85
85
|
```ruby
|
86
|
-
Vidibus::Sysinfo.
|
86
|
+
Vidibus::Sysinfo.throughput(10)
|
87
87
|
# => 33.28 # MBit/s
|
88
88
|
```
|
89
89
|
|
data/lib/vidibus/sysinfo.rb
CHANGED
@@ -4,7 +4,7 @@ require 'vidibus/sysinfo/core'
|
|
4
4
|
require 'vidibus/sysinfo/cpu'
|
5
5
|
require 'vidibus/sysinfo/load'
|
6
6
|
require 'vidibus/sysinfo/traffic'
|
7
|
-
require 'vidibus/sysinfo/
|
7
|
+
require 'vidibus/sysinfo/throughput'
|
8
8
|
require 'vidibus/sysinfo/storage'
|
9
9
|
require 'vidibus/sysinfo/memory'
|
10
10
|
require 'vidibus/sysinfo/swap'
|
@@ -33,11 +33,11 @@ module Vidibus
|
|
33
33
|
Traffic.call
|
34
34
|
end
|
35
35
|
|
36
|
-
# Returns currently used
|
36
|
+
# Returns currently used throughput in MBit/s.
|
37
37
|
# Provide seconds to improve measurement.
|
38
38
|
# The higher the seconds, the more accurate are the results.
|
39
|
-
def
|
40
|
-
|
39
|
+
def throughput(seconds = 1)
|
40
|
+
Throughput.call(seconds)
|
41
41
|
end
|
42
42
|
|
43
43
|
# Returns consumed storage in gigabytes.
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vidibus-sysinfo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -113,7 +113,6 @@ executables: []
|
|
113
113
|
extensions: []
|
114
114
|
extra_rdoc_files: []
|
115
115
|
files:
|
116
|
-
- lib/vidibus/sysinfo/bandwidth.rb
|
117
116
|
- lib/vidibus/sysinfo/base.rb
|
118
117
|
- lib/vidibus/sysinfo/core.rb
|
119
118
|
- lib/vidibus/sysinfo/cpu.rb
|
@@ -121,6 +120,7 @@ files:
|
|
121
120
|
- lib/vidibus/sysinfo/memory.rb
|
122
121
|
- lib/vidibus/sysinfo/storage.rb
|
123
122
|
- lib/vidibus/sysinfo/swap.rb
|
123
|
+
- lib/vidibus/sysinfo/throughput.rb
|
124
124
|
- lib/vidibus/sysinfo/traffic.rb
|
125
125
|
- lib/vidibus/sysinfo/version.rb
|
126
126
|
- lib/vidibus/sysinfo.rb
|
@@ -143,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
143
143
|
version: '0'
|
144
144
|
segments:
|
145
145
|
- 0
|
146
|
-
hash:
|
146
|
+
hash: -2480571786429848009
|
147
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
148
148
|
none: false
|
149
149
|
requirements:
|