ruby-dtrace 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +9 -0
- data/Manifest.txt +11 -1
- data/README.txt +10 -11
- data/examples/scsi.rb +442 -0
- data/ext/dtrace_aggdata.c +4 -1
- data/ext/dtrace_api.c +18 -7
- data/ext/dtrace_api.h +48 -9
- data/ext/dtrace_bufdata.c +52 -4
- data/ext/dtrace_hdl.c +137 -86
- data/ext/dtrace_probedata.c +188 -50
- data/ext/dtrace_process.c +37 -0
- data/ext/dtrace_recdesc.c +31 -0
- data/lib/dtrace.rb +53 -1
- data/lib/dtraceaggregate.rb +25 -1
- data/lib/dtraceaggregateset.rb +17 -0
- data/lib/dtraceconsumer.rb +91 -67
- data/lib/dtracedata.rb +73 -0
- data/lib/dtraceprintfrecord.rb +8 -0
- data/lib/dtraceprobedata.rb +5 -0
- data/lib/dtracerecord.rb +2 -1
- data/lib/dtracestackrecord.rb +29 -0
- data/plugin/dtrace/lib/dtracer.rb +42 -2
- data/plugin/dtrace/views/dtrace/_report.rhtml +48 -3
- data/test/test_dtrace.rb +2 -0
- data/test/test_dtrace_aggregates.rb +56 -0
- data/test/test_dtrace_processes.rb +83 -0
- data/test/test_dtrace_profile.rb +232 -0
- data/test/test_dtrace_repeat.rb +51 -0
- data/test/test_dtrace_rubyprobe.rb +52 -0
- metadata +19 -5
- data/test/test_dtrace_workapi.rb +0 -142
metadata
CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.4
|
|
3
3
|
specification_version: 1
|
4
4
|
name: ruby-dtrace
|
5
5
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.0.
|
7
|
-
date:
|
6
|
+
version: 0.0.3
|
7
|
+
date: 2008-01-08 00:00:00 +00:00
|
8
8
|
summary: Ruby bindings for libdtrace
|
9
9
|
require_paths:
|
10
10
|
- lib
|
@@ -34,6 +34,7 @@ files:
|
|
34
34
|
- Manifest.txt
|
35
35
|
- README.txt
|
36
36
|
- Rakefile
|
37
|
+
- examples/scsi.rb
|
37
38
|
- ext/dtrace_aggdata.c
|
38
39
|
- ext/dtrace_api.c
|
39
40
|
- ext/dtrace_api.h
|
@@ -41,6 +42,7 @@ files:
|
|
41
42
|
- ext/dtrace_hdl.c
|
42
43
|
- ext/dtrace_probe.c
|
43
44
|
- ext/dtrace_probedata.c
|
45
|
+
- ext/dtrace_process.c
|
44
46
|
- ext/dtrace_program.c
|
45
47
|
- ext/dtrace_programinfo.c
|
46
48
|
- ext/dtrace_recdesc.c
|
@@ -48,10 +50,14 @@ files:
|
|
48
50
|
- ext/extconf.rb
|
49
51
|
- lib/dtrace.rb
|
50
52
|
- lib/dtraceaggregate.rb
|
53
|
+
- lib/dtraceaggregateset.rb
|
51
54
|
- lib/dtraceconsumer.rb
|
55
|
+
- lib/dtracedata.rb
|
56
|
+
- lib/dtraceprintfrecord.rb
|
52
57
|
- lib/dtraceprobe.rb
|
53
58
|
- lib/dtraceprobedata.rb
|
54
59
|
- lib/dtracerecord.rb
|
60
|
+
- lib/dtracestackrecord.rb
|
55
61
|
- plugin/dtrace/README
|
56
62
|
- plugin/dtrace/Rakefile
|
57
63
|
- plugin/dtrace/bin/dtracer.rb
|
@@ -66,10 +72,18 @@ files:
|
|
66
72
|
- plugin/dtrace/test/dtrace_test.rb
|
67
73
|
- plugin/dtrace/views/dtrace/_report.rhtml
|
68
74
|
- test/test_dtrace.rb
|
69
|
-
- test/
|
75
|
+
- test/test_dtrace_aggregates.rb
|
76
|
+
- test/test_dtrace_processes.rb
|
77
|
+
- test/test_dtrace_profile.rb
|
78
|
+
- test/test_dtrace_repeat.rb
|
79
|
+
- test/test_dtrace_rubyprobe.rb
|
70
80
|
test_files:
|
71
81
|
- test/test_dtrace.rb
|
72
|
-
- test/
|
82
|
+
- test/test_dtrace_aggregates.rb
|
83
|
+
- test/test_dtrace_processes.rb
|
84
|
+
- test/test_dtrace_profile.rb
|
85
|
+
- test/test_dtrace_repeat.rb
|
86
|
+
- test/test_dtrace_rubyprobe.rb
|
73
87
|
rdoc_options:
|
74
88
|
- --main
|
75
89
|
- README.txt
|
@@ -91,5 +105,5 @@ dependencies:
|
|
91
105
|
requirements:
|
92
106
|
- - ">="
|
93
107
|
- !ruby/object:Gem::Version
|
94
|
-
version: 1.
|
108
|
+
version: 1.4.0
|
95
109
|
version:
|
data/test/test_dtrace_workapi.rb
DELETED
@@ -1,142 +0,0 @@
|
|
1
|
-
require 'dtrace'
|
2
|
-
require 'test/unit'
|
3
|
-
|
4
|
-
class TestDtrace < Test::Unit::TestCase
|
5
|
-
def test_dtrace
|
6
|
-
t = Dtrace.new
|
7
|
-
assert t
|
8
|
-
assert_equal Object, Dtrace.superclass
|
9
|
-
assert_equal Dtrace, t.class
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_work_dprogram_compile
|
13
|
-
t = Dtrace.new
|
14
|
-
assert t
|
15
|
-
|
16
|
-
progtext = "syscall::select:entry { trace(probefunc); trace(execname); }"
|
17
|
-
|
18
|
-
prog = t.compile progtext
|
19
|
-
assert prog
|
20
|
-
prog.execute
|
21
|
-
|
22
|
-
info = prog.info
|
23
|
-
assert info
|
24
|
-
assert_equal 1, info.matches_count
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_work_dprogram_run
|
28
|
-
t = Dtrace.new
|
29
|
-
t.setopt("bufsize", "4m")
|
30
|
-
t.setopt("aggsize", "4m")
|
31
|
-
|
32
|
-
progtext = "syscall:::entry { trace(probefunc); trace(execname); }"
|
33
|
-
|
34
|
-
prog = t.compile progtext
|
35
|
-
prog.execute
|
36
|
-
|
37
|
-
c = DtraceConsumer.new(t)
|
38
|
-
assert c
|
39
|
-
|
40
|
-
begin
|
41
|
-
i = 0
|
42
|
-
c.consume do |e|
|
43
|
-
assert e
|
44
|
-
assert e.probedesc
|
45
|
-
assert_equal 'syscall', e.probedesc.provider
|
46
|
-
assert_equal 'entry', e.probedesc.name
|
47
|
-
records = e.records
|
48
|
-
assert records
|
49
|
-
assert_equal 2, records.length
|
50
|
-
assert_equal DtraceRecord, records[0].class
|
51
|
-
assert_equal DtraceRecord, records[1].class
|
52
|
-
|
53
|
-
i = i + 1
|
54
|
-
if i > 10
|
55
|
-
break
|
56
|
-
end
|
57
|
-
end
|
58
|
-
rescue Interrupt
|
59
|
-
puts "interrupted"
|
60
|
-
end
|
61
|
-
end
|
62
|
-
|
63
|
-
def test_work_dprogram_aggregates
|
64
|
-
t = Dtrace.new
|
65
|
-
t.setopt("bufsize", "4m")
|
66
|
-
t.setopt("aggsize", "4m")
|
67
|
-
|
68
|
-
progtext = <<EOD
|
69
|
-
ruby*:::function-entry
|
70
|
-
{
|
71
|
-
@a[execname, copyinstr(arg1), copyinstr(arg2)] = count();
|
72
|
-
printf("foo");
|
73
|
-
}
|
74
|
-
|
75
|
-
profile-10
|
76
|
-
{
|
77
|
-
printa(@a)
|
78
|
-
}
|
79
|
-
EOD
|
80
|
-
|
81
|
-
prog = t.compile progtext
|
82
|
-
prog.execute
|
83
|
-
|
84
|
-
c = DtraceConsumer.new(t)
|
85
|
-
|
86
|
-
begin
|
87
|
-
i = 0
|
88
|
-
c.consume do |e|
|
89
|
-
assert e
|
90
|
-
case e.class.to_s
|
91
|
-
when "DtraceProbeData"
|
92
|
-
assert e.probedesc
|
93
|
-
e.each_record do |r|
|
94
|
-
assert r.value
|
95
|
-
end
|
96
|
-
when "DtraceRecord"
|
97
|
-
assert e.value
|
98
|
-
when "DtraceAggregate"
|
99
|
-
assert e.value
|
100
|
-
assert e.tuple
|
101
|
-
assert_equal 3, e.tuple.length
|
102
|
-
end
|
103
|
-
|
104
|
-
i = i + 1
|
105
|
-
if i > 100
|
106
|
-
break
|
107
|
-
end
|
108
|
-
end
|
109
|
-
rescue Interrupt
|
110
|
-
puts "interrupted"
|
111
|
-
end
|
112
|
-
|
113
|
-
end
|
114
|
-
|
115
|
-
def test_work_dprogram_once
|
116
|
-
t = Dtrace.new
|
117
|
-
t.setopt("bufsize", "4m")
|
118
|
-
t.setopt("aggsize", "4m")
|
119
|
-
|
120
|
-
progtext = "ruby*:::function-entry{ @a[execname, copyinstr(arg1), copyinstr(arg2)] = count(); } END { printa(@a); }"
|
121
|
-
|
122
|
-
prog = t.compile progtext
|
123
|
-
prog.execute
|
124
|
-
|
125
|
-
t.go
|
126
|
-
|
127
|
-
foo = 0
|
128
|
-
(1..1000).each do |i|
|
129
|
-
foo = foo + i
|
130
|
-
end
|
131
|
-
|
132
|
-
c = DtraceConsumer.new(t)
|
133
|
-
c.consume_once do |e|
|
134
|
-
if e && e.class == DtraceAggregate
|
135
|
-
assert e.value
|
136
|
-
assert e.tuple
|
137
|
-
assert_equal 3, e.tuple.length
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
|
142
|
-
end
|