rusage 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/ext/rusage/rusage.c +8 -2
- metadata +2 -2
data/Rakefile
CHANGED
data/ext/rusage/rusage.c
CHANGED
@@ -2,8 +2,7 @@
|
|
2
2
|
#include <ruby.h>
|
3
3
|
#include <sys/resource.h>
|
4
4
|
VALUE v_usage_struct;
|
5
|
-
static VALUE
|
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.
|
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:
|
12
|
+
date: 2010-05-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|