virtop 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/bin/virtop +3 -7
  2. data/lib/virtop/libvirt/domain.rb +13 -1
  3. metadata +4 -4
data/bin/virtop CHANGED
@@ -27,13 +27,9 @@ EOF
27
27
  exit( 1 )
28
28
  end
29
29
 
30
- # Require virtop module. If not installed as gem, try it in the source's
31
- # directory.
32
- begin
33
- require( 'virtop' )
34
- rescue LoadError
35
- require( File.dirname( __FILE__ ) + '/../lib/virtop' )
36
- end
30
+ # Require virtop module.
31
+ $:.unshift( File.join( File.dirname( __FILE__ ), '../lib' ) )
32
+ require( 'virtop' )
37
33
 
38
34
  # Connection URL will be qemu:///system if nothing else is given as the first
39
35
  # parameter.
@@ -30,7 +30,19 @@ module Libvirt
30
30
  end
31
31
 
32
32
  def cpu_time
33
- self.info.cpu_time.to_s
33
+ t = self.info.cpu_time / 10**7 / 60
34
+
35
+ d = ( t / 100 / 60 / 24 ).to_s
36
+ h = ( t / 100 / 60 % 24 ).to_s
37
+ m = ( t / 100 % 60 ).to_s
38
+ s = ( t % 100 ).to_s # TODO this value is not correct
39
+
40
+ str = d != '0' ? d + '-' : ''
41
+ str += h != '0' ? "%02i:" % h : ''
42
+ str += "%02i:" % m
43
+ str += s
44
+
45
+ str
34
46
  end
35
47
  end
36
48
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: virtop
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 4
10
- version: 0.0.4
9
+ - 5
10
+ version: 0.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - henning mueller
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-05-30 00:00:00 +02:00
18
+ date: 2010-06-01 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency