vcap_common 3.0.0 → 3.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/cf/version.rb +1 -1
- data/lib/vcap/common.rb +1 -2
- data/lib/vcap/component.rb +3 -4
- data/lib/vcap/stats.rb +6 -5
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MmZmY2Q4Njk2OGJhZWUyNGVkZDA0MWIwNjNkNzBiNTgwMThhY2ViNg==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NWQ2ZTkyZTNmMjE5NDgwYzRhNmExOWJjNjIwNzczYzUxN2E3NWI2OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NWI5MDQyN2QzNjE0ZmQzMTczYmNkMzE1YzFiOGJhZTljZDg4ODVmZTdhZmYx
|
10
|
+
M2ZhMTg1MTg4NzViNzFjNDEwZDM3YmE4MjIzYmU5ZDAyYTRiOWU3MzNmMmYz
|
11
|
+
YzA1MjQ5ZjQ2M2JmODYxMmE5MzgwNTQ4M2FjZDc0NDFkZjFlZWM=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
MmI2ZjQ4Nzg5MWJlNzZiOTAyNDk2MzAzN2Q3NGRjZGIyNzgxZGM4N2Y2OWNj
|
14
|
+
ODM3NGJlOTkzNWU4MTUwMmM3NGFkMDkyMjVlZTcxZDllZmQ4ZTliYjI2MzU2
|
15
|
+
ZmVhYmY1ZDc3NjhmZDk5YzhkYTRiODg4N2NjNTFmZDBhMmI5MGQ=
|
data/lib/cf/version.rb
CHANGED
data/lib/vcap/common.rb
CHANGED
@@ -55,7 +55,7 @@ module VCAP
|
|
55
55
|
if RUBY_PLATFORM =~ /linux/
|
56
56
|
return `cat /proc/cpuinfo | grep processor | wc -l`.to_i
|
57
57
|
elsif RUBY_PLATFORM =~ /darwin/
|
58
|
-
`
|
58
|
+
`sysctl -n hw.ncpu`.strip.to_i
|
59
59
|
elsif RUBY_PLATFORM =~ /freebsd|netbsd/
|
60
60
|
`sysctl hw.ncpu`.strip.to_i
|
61
61
|
elsif WINDOWS
|
@@ -64,7 +64,6 @@ module VCAP
|
|
64
64
|
return 1 # unknown..
|
65
65
|
end
|
66
66
|
rescue
|
67
|
-
# hwprefs doesn't always exist, and so the block above can fail.
|
68
67
|
# In any case, let's always assume that there is 1 core
|
69
68
|
1
|
70
69
|
end
|
data/lib/vcap/component.rb
CHANGED
@@ -97,21 +97,20 @@ module VCAP
|
|
97
97
|
@last_varz_update ||= 0
|
98
98
|
|
99
99
|
if Time.now.to_f - @last_varz_update >= 1
|
100
|
-
|
100
|
+
rss_bytes, pcpu = Stats.process_memory_bytes_and_cpu
|
101
101
|
|
102
102
|
# Update varz
|
103
103
|
varz.synchronize do
|
104
104
|
@last_varz_update = Time.now.to_f
|
105
105
|
|
106
106
|
varz[:uptime] = VCAP.uptime_string(Time.now - varz[:start])
|
107
|
-
varz[:mem] = rss.to_i
|
108
107
|
varz[:cpu] = pcpu.to_f
|
108
|
+
varz[:cpu_load_avg] = Stats.cpu_load_average
|
109
109
|
|
110
|
+
varz[:mem_bytes] = rss_bytes.to_i
|
110
111
|
varz[:mem_used_bytes] = Stats.memory_used_bytes
|
111
112
|
varz[:mem_free_bytes] = Stats.memory_free_bytes
|
112
113
|
|
113
|
-
varz[:cpu_load_avg] = Stats.cpu_load_average
|
114
|
-
|
115
114
|
# Return duplicate while holding lock
|
116
115
|
return varz.dup
|
117
116
|
end
|
data/lib/vcap/stats.rb
CHANGED
@@ -4,14 +4,15 @@ require 'vmstat'
|
|
4
4
|
module VCAP
|
5
5
|
class Stats
|
6
6
|
class << self
|
7
|
-
def
|
7
|
+
def process_memory_bytes_and_cpu
|
8
8
|
if WINDOWS
|
9
|
-
|
9
|
+
rss_bytes = windows_process_memory * 1024
|
10
10
|
pcpu = windows_process_cpu
|
11
11
|
else
|
12
|
-
rss, pcpu = `ps -o rss=,pcpu= -p #{Process.pid}`.split
|
12
|
+
rss, pcpu = `ps -o rss=,pcpu= -p #{Process.pid}`.split.map(&:to_i)
|
13
|
+
rss_bytes = rss * 1024
|
13
14
|
end
|
14
|
-
[
|
15
|
+
[rss_bytes, pcpu]
|
15
16
|
end
|
16
17
|
|
17
18
|
def memory_used_bytes
|
@@ -103,4 +104,4 @@ module VCAP
|
|
103
104
|
end
|
104
105
|
end
|
105
106
|
end
|
106
|
-
end
|
107
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vcap_common
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cloud Foundry Core Team
|
@@ -92,14 +92,14 @@ dependencies:
|
|
92
92
|
requirements:
|
93
93
|
- - ~>
|
94
94
|
- !ruby/object:Gem::Version
|
95
|
-
version:
|
95
|
+
version: '1.0'
|
96
96
|
type: :runtime
|
97
97
|
prerelease: false
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
99
99
|
requirements:
|
100
100
|
- - ~>
|
101
101
|
- !ruby/object:Gem::Version
|
102
|
-
version:
|
102
|
+
version: '1.0'
|
103
103
|
- !ruby/object:Gem::Dependency
|
104
104
|
name: httpclient
|
105
105
|
requirement: !ruby/object:Gem::Requirement
|