lxc 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/lxc/container.rb +12 -0
  2. data/lib/lxc/version.rb +1 -1
  3. metadata +4 -4
data/lib/lxc/container.rb CHANGED
@@ -313,6 +313,18 @@ class LXC
313
313
  true
314
314
  end
315
315
 
316
+ # Current Memory Usage
317
+ def memory_usage
318
+ result = self.exec(%(lxc-cgroup), %(memory.usage_in_bytes))
319
+ result.empty? ? 0 : result.to_i
320
+ end
321
+
322
+ # CPU Time in Seconds
323
+ def cpu_usage
324
+ result = self.exec(%(lxc-cgroup), %(cpuacct.usage))
325
+ result.empty? ? 0 : (result.to_i / 1E9).to_i
326
+ end
327
+
316
328
  # Linux container command execution wrapper
317
329
  #
318
330
  # Executes the supplied command by injecting the container name into the
data/lib/lxc/version.rb CHANGED
@@ -2,7 +2,7 @@ class LXC
2
2
 
3
3
  unless const_defined?(:VERSION)
4
4
  # LXC Gem Version
5
- VERSION = "0.3.6"
5
+ VERSION = "0.3.7"
6
6
  end
7
7
 
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lxc
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.6
4
+ version: 0.3.7
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-07-15 00:00:00.000000000 Z
12
+ date: 2013-09-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: ztk
@@ -219,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
219
219
  version: '0'
220
220
  segments:
221
221
  - 0
222
- hash: 4518660914565732919
222
+ hash: 219836670546765976
223
223
  required_rubygems_version: !ruby/object:Gem::Requirement
224
224
  none: false
225
225
  requirements:
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  segments:
230
230
  - 0
231
- hash: 4518660914565732919
231
+ hash: 219836670546765976
232
232
  requirements: []
233
233
  rubyforge_project:
234
234
  rubygems_version: 1.8.25