rusage 0.1.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.
- data/.autotest +23 -0
- data/History.txt +6 -0
- data/Manifest.txt +7 -0
- data/README.txt +21 -0
- data/Rakefile +12 -0
- data/ext/rusage/extconf.rb +5 -0
- data/ext/rusage/rusage.c +41 -0
- metadata +79 -0
data/.autotest
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# -*- ruby -*-
|
2
|
+
|
3
|
+
require 'autotest/restart'
|
4
|
+
|
5
|
+
# Autotest.add_hook :initialize do |at|
|
6
|
+
# at.extra_files << "../some/external/dependency.rb"
|
7
|
+
#
|
8
|
+
# at.libs << ":../some/external"
|
9
|
+
#
|
10
|
+
# at.add_exception 'vendor'
|
11
|
+
#
|
12
|
+
# at.add_mapping(/dependency.rb/) do |f, _|
|
13
|
+
# at.files_matching(/test_.*rb$/)
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# %w(TestA TestB).each do |klass|
|
17
|
+
# at.extra_class_map[klass] = "test/test_misc.rb"
|
18
|
+
# end
|
19
|
+
# end
|
20
|
+
|
21
|
+
# Autotest.add_hook :run_command do |at|
|
22
|
+
# system "rake build"
|
23
|
+
# end
|
data/History.txt
ADDED
data/Manifest.txt
ADDED
data/README.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
= rusage
|
2
|
+
|
3
|
+
* http://github.com/sandofsky/rusage
|
4
|
+
|
5
|
+
== DESCRIPTION:
|
6
|
+
|
7
|
+
A gem that calls getrusage to get details on the current process.
|
8
|
+
|
9
|
+
Ripped out of the proc/wait3 library, originally written by Daniel J. Berger.
|
10
|
+
|
11
|
+
http://raa.ruby-lang.org/project/proc-wait3/
|
12
|
+
|
13
|
+
== LICENSE:
|
14
|
+
|
15
|
+
Inherits the Artistic License 2.0 from proc/wait3.
|
16
|
+
|
17
|
+
== COPYRIGHT:
|
18
|
+
|
19
|
+
The original code is still copyright Daniel J. Berger.
|
20
|
+
|
21
|
+
Anything new is copyright Ben Sandofsky.
|
data/Rakefile
ADDED
data/ext/rusage/rusage.c
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
// VERSION = "x.y.z"
|
2
|
+
#include <ruby.h>
|
3
|
+
#include <sys/resource.h>
|
4
|
+
VALUE v_usage_struct;
|
5
|
+
static VALUE rusage_get(int argc, VALUE* argv, VALUE mod){
|
6
|
+
int who = RUSAGE_SELF;
|
7
|
+
struct rusage r;
|
8
|
+
int ret;
|
9
|
+
|
10
|
+
ret = getrusage(who, &r);
|
11
|
+
if(ret == -1)
|
12
|
+
rb_sys_fail("getrusage");
|
13
|
+
|
14
|
+
return rb_struct_new(v_usage_struct,
|
15
|
+
rb_float_new((double)r.ru_utime.tv_sec+(double)r.ru_utime.tv_usec/1e6),
|
16
|
+
rb_float_new((double)r.ru_stime.tv_sec+(double)r.ru_stime.tv_usec/1e6),
|
17
|
+
LONG2NUM(r.ru_maxrss),
|
18
|
+
LONG2NUM(r.ru_ixrss),
|
19
|
+
LONG2NUM(r.ru_idrss),
|
20
|
+
LONG2NUM(r.ru_isrss),
|
21
|
+
LONG2NUM(r.ru_minflt),
|
22
|
+
LONG2NUM(r.ru_majflt),
|
23
|
+
LONG2NUM(r.ru_nswap),
|
24
|
+
LONG2NUM(r.ru_inblock),
|
25
|
+
LONG2NUM(r.ru_oublock),
|
26
|
+
LONG2NUM(r.ru_msgsnd),
|
27
|
+
LONG2NUM(r.ru_msgrcv),
|
28
|
+
LONG2NUM(r.ru_nsignals),
|
29
|
+
LONG2NUM(r.ru_nvcsw),
|
30
|
+
LONG2NUM(r.ru_nivcsw)
|
31
|
+
);
|
32
|
+
}
|
33
|
+
void Init_rusage(){
|
34
|
+
v_usage_struct =
|
35
|
+
rb_struct_define("RUsage","utime","stime","maxrss","ixrss","idrss",
|
36
|
+
"isrss","minflt","majflt","nswap","inblock","oublock","msgsnd",
|
37
|
+
"msgrcv","nsignals","nvcsw","nivcsw",NULL
|
38
|
+
);
|
39
|
+
|
40
|
+
rb_define_module_function(rb_mProcess, "rusage", rusage_get, -1);
|
41
|
+
}
|
metadata
ADDED
@@ -0,0 +1,79 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rusage
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ben Sandofsky
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-12-09 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: hoe
|
17
|
+
type: :development
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 2.3.3
|
24
|
+
version:
|
25
|
+
description: |-
|
26
|
+
A gem that calls getrusage to get details on the current process.
|
27
|
+
|
28
|
+
Ripped out of the proc/wait3 library, originally written by Daniel J. Berger.
|
29
|
+
|
30
|
+
http://raa.ruby-lang.org/project/proc-wait3/
|
31
|
+
email:
|
32
|
+
- ben@sandofsky.com
|
33
|
+
executables: []
|
34
|
+
|
35
|
+
extensions:
|
36
|
+
- ext/rusage/extconf.rb
|
37
|
+
extra_rdoc_files:
|
38
|
+
- History.txt
|
39
|
+
- Manifest.txt
|
40
|
+
- README.txt
|
41
|
+
files:
|
42
|
+
- .autotest
|
43
|
+
- History.txt
|
44
|
+
- Manifest.txt
|
45
|
+
- README.txt
|
46
|
+
- Rakefile
|
47
|
+
- ext/rusage/extconf.rb
|
48
|
+
- ext/rusage/rusage.c
|
49
|
+
has_rdoc: true
|
50
|
+
homepage: http://github.com/sandofsky/rusage
|
51
|
+
licenses: []
|
52
|
+
|
53
|
+
post_install_message:
|
54
|
+
rdoc_options:
|
55
|
+
- --main
|
56
|
+
- README.txt
|
57
|
+
require_paths:
|
58
|
+
- ext
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - ">="
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: "0"
|
64
|
+
version:
|
65
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - ">="
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: "0"
|
70
|
+
version:
|
71
|
+
requirements: []
|
72
|
+
|
73
|
+
rubyforge_project: rusage
|
74
|
+
rubygems_version: 1.3.5
|
75
|
+
signing_key:
|
76
|
+
specification_version: 3
|
77
|
+
summary: A gem that calls getrusage to get details on the current process
|
78
|
+
test_files: []
|
79
|
+
|