rusage 0.1.0 → 0.2.0

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.
Files changed (3) hide show
  1. data/Rakefile +1 -1
  2. data/ext/rusage/rusage.c +8 -2
  3. metadata +2 -2
data/Rakefile CHANGED
@@ -5,7 +5,7 @@ require 'hoe'
5
5
 
6
6
  Hoe.spec 'rusage' do
7
7
  developer('Ben Sandofsky', 'ben@sandofsky.com')
8
- self.version = "0.1.0"
8
+ self.version = "0.2.0"
9
9
  self.spec_extras = { :extensions => ["ext/rusage/extconf.rb"] }
10
10
  end
11
11
 
@@ -2,8 +2,7 @@
2
2
  #include <ruby.h>
3
3
  #include <sys/resource.h>
4
4
  VALUE v_usage_struct;
5
- static VALUE rusage_get(int argc, VALUE* argv, VALUE mod){
6
- int who = RUSAGE_SELF;
5
+ static VALUE do_rusage_get(int who){
7
6
  struct rusage r;
8
7
  int ret;
9
8
 
@@ -30,6 +29,12 @@ static VALUE rusage_get(int argc, VALUE* argv, VALUE mod){
30
29
  LONG2NUM(r.ru_nivcsw)
31
30
  );
32
31
  }
32
+ static VALUE rusage_get(int argc, VALUE* argv, VALUE mod){
33
+ return do_rusage_get(RUSAGE_SELF);
34
+ }
35
+ static VALUE crusage_get(int argc, VALUE* argv, VALUE mod){
36
+ return do_rusage_get(RUSAGE_CHILDREN);
37
+ }
33
38
  void Init_rusage(){
34
39
  v_usage_struct =
35
40
  rb_struct_define("RUsage","utime","stime","maxrss","ixrss","idrss",
@@ -38,4 +43,5 @@ void Init_rusage(){
38
43
  );
39
44
 
40
45
  rb_define_module_function(rb_mProcess, "rusage", rusage_get, -1);
46
+ rb_define_module_function(rb_mProcess, "crusage", crusage_get, -1);
41
47
  }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rusage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Sandofsky
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-12-09 00:00:00 -08:00
12
+ date: 2010-05-04 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency