ruby-prof 0.14.2 → 0.15.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/CHANGES +4 -0
- data/doc/created.rid +2 -2
- data/ext/ruby_prof/rp_measure_cpu_time.c +62 -36
- data/ext/ruby_prof/rp_method.c +4 -4
- data/lib/ruby-prof/version.rb +1 -1
- data/test/fiber_test.rb +4 -4
- data/test/measure_cpu_time_test.rb +40 -107
- data/test/test_helper.rb +24 -0
- data/test/thread_test.rb +12 -7
- metadata +20 -20
data/CHANGES
CHANGED
data/doc/created.rid
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
Fri, 02 May 2014 08:21:06 +0200
|
2
2
|
bin/ruby-prof Wed, 25 Dec 2013 08:28:55 +0100
|
3
3
|
bin/ruby-prof-check-trace Sun, 10 Mar 2013 10:57:14 +0100
|
4
4
|
examples/flat.txt Tue, 29 Jan 2013 16:43:39 +0100
|
@@ -24,7 +24,7 @@ lib/ruby-prof/profile.rb Wed, 25 Dec 2013 08:59:06 +0100
|
|
24
24
|
lib/ruby-prof/rack.rb Wed, 25 Dec 2013 09:34:14 +0100
|
25
25
|
lib/ruby-prof/task.rb Tue, 29 Jan 2013 16:43:39 +0100
|
26
26
|
lib/ruby-prof/thread.rb Wed, 25 Dec 2013 09:34:14 +0100
|
27
|
-
lib/ruby-prof/version.rb
|
27
|
+
lib/ruby-prof/version.rb Fri, 02 May 2014 08:18:49 +0200
|
28
28
|
lib/unprof.rb Tue, 29 Jan 2013 16:43:39 +0100
|
29
29
|
ext/ruby_prof/ruby_prof.c Mon, 30 Dec 2013 14:56:05 +0100
|
30
30
|
README.rdoc Wed, 25 Dec 2013 10:55:27 +0100
|
@@ -5,11 +5,10 @@
|
|
5
5
|
|
6
6
|
static VALUE cMeasureCpuTime;
|
7
7
|
|
8
|
-
static unsigned long long cpu_frequency = 0;
|
9
|
-
|
10
8
|
/* The _WIN32 check is needed for msys (and maybe cygwin?) */
|
11
9
|
#if defined(__GNUC__) && !defined(_WIN32)
|
12
10
|
|
11
|
+
#include <sys/resource.h>
|
13
12
|
#include <stdint.h>
|
14
13
|
#include <time.h>
|
15
14
|
|
@@ -18,63 +17,93 @@ static unsigned long long get_cpu_time()
|
|
18
17
|
#if defined(__i386__) || defined(__x86_64__)
|
19
18
|
uint32_t a, d;
|
20
19
|
__asm__ volatile("rdtsc" : "=a" (a), "=d" (d));
|
21
|
-
|
20
|
+
return ((uint64_t)d << 32) + a;
|
22
21
|
#elif defined(__powerpc__) || defined(__ppc__)
|
23
22
|
unsigned long long x, y;
|
24
23
|
|
25
24
|
__asm__ __volatile__ ("\n\
|
26
|
-
1:
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
25
|
+
1: mftbu %1\n\
|
26
|
+
mftb %L0\n\
|
27
|
+
mftbu %0\n\
|
28
|
+
cmpw %0,%1\n\
|
29
|
+
bne- 1b"
|
30
|
+
: "=r" (x), "=r" (y));
|
31
|
+
|
32
|
+
return x;
|
33
33
|
#endif
|
34
34
|
}
|
35
35
|
|
36
36
|
static unsigned long long get_cpu_frequency()
|
37
37
|
{
|
38
|
-
unsigned long long
|
38
|
+
static unsigned long long cpu_frequency;
|
39
|
+
|
40
|
+
if(!cpu_frequency) {
|
41
|
+
unsigned long long x, y;
|
42
|
+
|
43
|
+
struct timespec ts;
|
44
|
+
ts.tv_sec = 0;
|
45
|
+
ts.tv_nsec = 500000000;
|
46
|
+
x = get_cpu_time();
|
47
|
+
nanosleep(&ts, NULL);
|
48
|
+
y = get_cpu_time();
|
49
|
+
cpu_frequency = (y - x) * 2;
|
50
|
+
}
|
51
|
+
|
52
|
+
return cpu_frequency;
|
53
|
+
}
|
54
|
+
|
55
|
+
static double
|
56
|
+
measure_cpu_time()
|
57
|
+
{
|
58
|
+
struct rusage rusage;
|
59
|
+
getrusage(RUSAGE_SELF, &rusage);
|
39
60
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
61
|
+
double seconds = 0;
|
62
|
+
|
63
|
+
seconds += rusage.ru_utime.tv_sec;
|
64
|
+
seconds += rusage.ru_stime.tv_sec;
|
65
|
+
|
66
|
+
seconds += rusage.ru_utime.tv_usec / 1000000.0;
|
67
|
+
seconds += rusage.ru_stime.tv_usec / 1000000.0;
|
68
|
+
|
69
|
+
return seconds;
|
47
70
|
}
|
48
71
|
|
49
72
|
#elif defined(_WIN32)
|
50
73
|
|
51
74
|
static unsigned long long get_cpu_time()
|
52
75
|
{
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
}
|
76
|
+
LARGE_INTEGER time;
|
77
|
+
QueryPerformanceCounter(&time);
|
78
|
+
return time.QuadPart;
|
79
|
+
}
|
57
80
|
|
58
81
|
static unsigned long long get_cpu_frequency()
|
59
82
|
{
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
83
|
+
static unsigned long long cpu_frequency;
|
84
|
+
|
85
|
+
if(!cpu_frequency) {
|
86
|
+
LARGE_INTEGER cpu_frequency_struct;
|
87
|
+
QueryPerformanceFrequency(&cpu_frequency_struct);
|
88
|
+
cpu_frequency = cpu_frequency_struct.QuadPart;
|
89
|
+
}
|
90
|
+
|
91
|
+
return cpu_frequency;
|
92
|
+
}
|
65
93
|
|
66
94
|
static double
|
67
95
|
measure_cpu_time()
|
68
96
|
{
|
69
|
-
return ((double)get_cpu_time()) /
|
97
|
+
return ((double)get_cpu_time()) / get_cpu_frequency();
|
70
98
|
}
|
99
|
+
#endif
|
71
100
|
|
72
101
|
|
73
102
|
prof_measurer_t* prof_measurer_cpu_time()
|
74
103
|
{
|
75
|
-
|
76
|
-
|
77
|
-
|
104
|
+
prof_measurer_t* measure = ALLOC(prof_measurer_t);
|
105
|
+
measure->measure = measure_cpu_time;
|
106
|
+
return measure;
|
78
107
|
}
|
79
108
|
|
80
109
|
/* call-seq:
|
@@ -95,18 +124,15 @@ RubyProf::measure_mode is set to CPU_TIME. */
|
|
95
124
|
static VALUE
|
96
125
|
prof_get_cpu_frequency(VALUE self)
|
97
126
|
{
|
98
|
-
|
127
|
+
return ULL2NUM(get_cpu_frequency());
|
99
128
|
}
|
100
129
|
|
101
130
|
void rp_init_measure_cpu_time()
|
102
131
|
{
|
103
132
|
rb_define_const(mProf, "CPU_TIME", INT2NUM(MEASURE_CPU_TIME));
|
104
|
-
|
133
|
+
rb_define_const(mProf, "CPU_TIME_ENABLED", Qtrue);
|
105
134
|
|
106
135
|
cMeasureCpuTime = rb_define_class_under(mMeasure, "CpuTime", rb_cObject);
|
107
136
|
rb_define_singleton_method(cMeasureCpuTime, "measure", prof_measure_cpu_time, 0);
|
108
137
|
rb_define_singleton_method(cMeasureCpuTime, "frequency", prof_get_cpu_frequency, 0);
|
109
|
-
|
110
|
-
/* Get cpu_frequency */
|
111
|
-
cpu_frequency = get_cpu_frequency();
|
112
138
|
}
|
data/ext/ruby_prof/rp_method.c
CHANGED
@@ -104,11 +104,11 @@ method_name(ID mid)
|
|
104
104
|
static VALUE
|
105
105
|
full_name(VALUE klass, ID mid)
|
106
106
|
{
|
107
|
-
|
108
|
-
|
109
|
-
|
107
|
+
VALUE result = rb_str_dup(klass_name(klass));
|
108
|
+
rb_str_cat2(result, "#");
|
109
|
+
rb_str_append(result, method_name(mid));
|
110
110
|
|
111
|
-
|
111
|
+
return result;
|
112
112
|
}
|
113
113
|
|
114
114
|
void
|
data/lib/ruby-prof/version.rb
CHANGED
data/test/fiber_test.rb
CHANGED
@@ -50,14 +50,14 @@ class FiberTest < Test::Unit::TestCase
|
|
50
50
|
assert(root_fiber_profile = @result.threads.detect{|t| t.fiber_id == @root_fiber})
|
51
51
|
assert(enum_fiber_profile = @result.threads.detect{|t| t.fiber_id != @root_fiber})
|
52
52
|
|
53
|
-
assert_in_delta(0.3, root_fiber_profile.total_time, 0.
|
54
|
-
assert_in_delta(0.2, enum_fiber_profile.total_time, 0.
|
53
|
+
assert_in_delta(0.3, root_fiber_profile.total_time, 0.05)
|
54
|
+
assert_in_delta(0.2, enum_fiber_profile.total_time, 0.05)
|
55
55
|
|
56
56
|
assert(method_next = root_fiber_profile.methods.detect{|m| m.full_name == "Enumerator#next"})
|
57
57
|
assert(method_each = enum_fiber_profile.methods.detect{|m| m.full_name == "Enumerator#each"})
|
58
58
|
|
59
|
-
assert_in_delta(0.2, method_next.total_time, 0.
|
60
|
-
assert_in_delta(0.2, method_each.total_time, 0.
|
59
|
+
assert_in_delta(0.2, method_next.total_time, 0.05)
|
60
|
+
assert_in_delta(0.2, method_each.total_time, 0.05)
|
61
61
|
|
62
62
|
# RubyProf::CallInfoPrinter.new(@result).print
|
63
63
|
end
|
@@ -5,7 +5,6 @@ require File.expand_path('../test_helper', __FILE__)
|
|
5
5
|
|
6
6
|
class MeasureCpuTimeTest < Test::Unit::TestCase
|
7
7
|
def setup
|
8
|
-
# Need to use wall time for this test due to the sleep calls
|
9
8
|
RubyProf::measure_mode = RubyProf::CPU_TIME
|
10
9
|
end
|
11
10
|
|
@@ -20,107 +19,74 @@ class MeasureCpuTimeTest < Test::Unit::TestCase
|
|
20
19
|
|
21
20
|
def test_class_methods
|
22
21
|
result = RubyProf.profile do
|
23
|
-
RubyProf::
|
22
|
+
RubyProf::C7.hello
|
24
23
|
end
|
25
24
|
|
26
|
-
# Length should be
|
25
|
+
# Length should be greater 2:
|
27
26
|
# MeasureCpuTimeTest#test_class_methods
|
28
27
|
# <Class::RubyProf::C1>#hello
|
29
|
-
#
|
28
|
+
# ....
|
30
29
|
|
31
|
-
methods = result.threads.first.methods.sort.reverse
|
32
|
-
assert_equal(
|
30
|
+
methods = result.threads.first.methods.sort.reverse[0..1]
|
31
|
+
assert_equal(2, methods.length)
|
33
32
|
|
34
33
|
# Check the names
|
35
34
|
assert_equal('MeasureCpuTimeTest#test_class_methods', methods[0].full_name)
|
36
|
-
assert_equal('<Class::RubyProf::
|
37
|
-
assert_equal('Kernel#sleep', methods[2].full_name)
|
35
|
+
assert_equal('<Class::RubyProf::C7>#hello', methods[1].full_name)
|
38
36
|
|
39
37
|
# Check times
|
40
|
-
assert_in_delta(0.1, methods[0].total_time, 0.
|
41
|
-
assert_in_delta(0, methods[0].wait_time, 0.
|
42
|
-
assert_in_delta(0, methods[0].self_time, 0.
|
43
|
-
|
44
|
-
assert_in_delta(0.1, methods[1].total_time, 0.01)
|
45
|
-
assert_in_delta(0, methods[1].wait_time, 0.01)
|
46
|
-
assert_in_delta(0, methods[1].self_time, 0.01)
|
38
|
+
assert_in_delta(0.1, methods[0].total_time, 0.02)
|
39
|
+
assert_in_delta(0, methods[0].wait_time, 0.02)
|
40
|
+
assert_in_delta(0, methods[0].self_time, 0.02)
|
47
41
|
|
48
|
-
assert_in_delta(0.1, methods[
|
49
|
-
assert_in_delta(0, methods[
|
50
|
-
assert_in_delta(0
|
42
|
+
assert_in_delta(0.1, methods[1].total_time, 0.02)
|
43
|
+
assert_in_delta(0, methods[1].wait_time, 0.02)
|
44
|
+
assert_in_delta(0, methods[1].self_time, 0.02)
|
51
45
|
end
|
52
46
|
|
53
47
|
def test_instance_methods
|
54
48
|
result = RubyProf.profile do
|
55
|
-
RubyProf::
|
49
|
+
RubyProf::C7.new.hello
|
56
50
|
end
|
57
51
|
|
58
|
-
|
52
|
+
methods = result.threads.first.methods.sort.reverse[0..1]
|
53
|
+
assert_equal(2, methods.length)
|
54
|
+
|
55
|
+
# Methods at this point:
|
59
56
|
# MeasureCpuTimeTest#test_instance_methods
|
60
|
-
#
|
61
|
-
#
|
62
|
-
# for Object#initialize
|
63
|
-
# C1#hello
|
64
|
-
# Kernel#sleep
|
57
|
+
# C7#hello
|
58
|
+
# ...
|
65
59
|
|
66
|
-
methods = result.threads.first.methods.sort.reverse
|
67
|
-
assert_equal(RubyProf.ruby_2? ? 5 : 6, methods.length)
|
68
60
|
names = methods.map(&:full_name)
|
69
61
|
assert_equal('MeasureCpuTimeTest#test_instance_methods', names[0])
|
70
|
-
assert_equal('RubyProf::
|
71
|
-
assert_equal('Kernel#sleep', names[2])
|
72
|
-
assert_equal('Class#new', names[3])
|
73
|
-
|
74
|
-
# order can differ
|
75
|
-
assert(names.include?("#{RubyProf.parent_object}#initialize"))
|
76
|
-
unless RubyProf.ruby_2?
|
77
|
-
assert(names.include?("<Class::#{RubyProf.parent_object}>#allocate"))
|
78
|
-
end
|
62
|
+
assert_equal('RubyProf::C7#hello', names[1])
|
79
63
|
|
80
|
-
# Check times
|
81
|
-
assert_in_delta(0.2, methods[0].total_time, 0.02)
|
82
|
-
assert_in_delta(0, methods[0].wait_time, 0.02)
|
83
|
-
assert_in_delta(0, methods[0].self_time, 0.02)
|
84
64
|
|
85
|
-
|
86
|
-
assert_in_delta(0, methods[
|
87
|
-
assert_in_delta(0, methods[
|
88
|
-
|
89
|
-
assert_in_delta(0.2, methods[2].total_time, 0.02)
|
90
|
-
assert_in_delta(0, methods[2].wait_time, 0.02)
|
91
|
-
assert_in_delta(0.2, methods[2].self_time, 0.02)
|
92
|
-
|
93
|
-
assert_in_delta(0, methods[3].total_time, 0.01)
|
94
|
-
assert_in_delta(0, methods[3].wait_time, 0.01)
|
95
|
-
assert_in_delta(0, methods[3].self_time, 0.01)
|
96
|
-
|
97
|
-
assert_in_delta(0, methods[4].total_time, 0.01)
|
98
|
-
assert_in_delta(0, methods[4].wait_time, 0.01)
|
99
|
-
assert_in_delta(0, methods[4].self_time, 0.01)
|
65
|
+
# Check times
|
66
|
+
assert_in_delta(0.2, methods[0].total_time, 0.03)
|
67
|
+
assert_in_delta(0, methods[0].wait_time, 0.03)
|
68
|
+
assert_in_delta(0, methods[0].self_time, 0.03)
|
100
69
|
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
assert_in_delta(0, methods[5].self_time, 0.01)
|
105
|
-
end
|
70
|
+
assert_in_delta(0.2, methods[1].total_time, 0.03)
|
71
|
+
assert_in_delta(0, methods[1].wait_time, 0.03)
|
72
|
+
assert_in_delta(0, methods[1].self_time, 0.1)
|
106
73
|
end
|
107
74
|
|
108
75
|
def test_module_methods
|
109
76
|
result = RubyProf.profile do
|
110
|
-
RubyProf::
|
77
|
+
RubyProf::C8.hello
|
111
78
|
end
|
112
79
|
|
113
80
|
# Methods:
|
114
81
|
# MeasureCpuTimeTest#test_module_methods
|
115
82
|
# M1#hello
|
116
|
-
#
|
83
|
+
# ...
|
117
84
|
|
118
|
-
methods = result.threads.first.methods.sort.reverse
|
119
|
-
assert_equal(
|
85
|
+
methods = result.threads.first.methods.sort.reverse[0..1]
|
86
|
+
assert_equal(2, methods.length)
|
120
87
|
|
121
88
|
assert_equal('MeasureCpuTimeTest#test_module_methods', methods[0].full_name)
|
122
|
-
assert_equal('RubyProf::
|
123
|
-
assert_equal('Kernel#sleep', methods[2].full_name)
|
89
|
+
assert_equal('RubyProf::M7#hello', methods[1].full_name)
|
124
90
|
|
125
91
|
# Check times
|
126
92
|
assert_in_delta(0.3, methods[0].total_time, 0.1)
|
@@ -129,39 +95,24 @@ class MeasureCpuTimeTest < Test::Unit::TestCase
|
|
129
95
|
|
130
96
|
assert_in_delta(0.3, methods[1].total_time, 0.1)
|
131
97
|
assert_in_delta(0, methods[1].wait_time, 0.02)
|
132
|
-
assert_in_delta(0, methods[1].self_time, 0.
|
133
|
-
|
134
|
-
assert_in_delta(0.3, methods[2].total_time, 0.1)
|
135
|
-
assert_in_delta(0, methods[2].wait_time, 0.02)
|
136
|
-
assert_in_delta(0.3, methods[2].self_time, 0.1)
|
98
|
+
assert_in_delta(0, methods[1].self_time, 0.1)
|
137
99
|
end
|
138
100
|
|
139
101
|
def test_module_instance_methods
|
140
102
|
result = RubyProf.profile do
|
141
|
-
RubyProf::
|
103
|
+
RubyProf::C8.new.hello
|
142
104
|
end
|
143
105
|
|
144
106
|
# Methods:
|
145
107
|
# MeasureCpuTimeTest#test_module_instance_methods
|
146
|
-
#
|
147
|
-
#
|
148
|
-
# Object#initialize
|
149
|
-
# M1#hello
|
150
|
-
# Kernel#sleep
|
108
|
+
# M7#hello
|
109
|
+
# ...
|
151
110
|
|
152
|
-
methods = result.threads.first.methods.sort.reverse
|
153
|
-
assert_equal(
|
111
|
+
methods = result.threads.first.methods.sort.reverse[0..1]
|
112
|
+
assert_equal(2, methods.length)
|
154
113
|
names = methods.map(&:full_name)
|
155
114
|
assert_equal('MeasureCpuTimeTest#test_module_instance_methods', names[0])
|
156
|
-
assert_equal('RubyProf::
|
157
|
-
assert_equal('Kernel#sleep', names[2])
|
158
|
-
assert_equal('Class#new', names[3])
|
159
|
-
|
160
|
-
# order can differ
|
161
|
-
assert(names.include?("#{RubyProf.parent_object}#initialize"))
|
162
|
-
unless RubyProf.ruby_2?
|
163
|
-
assert(names.include?("<Class::#{RubyProf.parent_object}>#allocate"))
|
164
|
-
end
|
115
|
+
assert_equal('RubyProf::M7#hello', names[1])
|
165
116
|
|
166
117
|
# Check times
|
167
118
|
assert_in_delta(0.3, methods[0].total_time, 0.1)
|
@@ -170,25 +121,7 @@ class MeasureCpuTimeTest < Test::Unit::TestCase
|
|
170
121
|
|
171
122
|
assert_in_delta(0.3, methods[1].total_time, 0.02)
|
172
123
|
assert_in_delta(0, methods[1].wait_time, 0.01)
|
173
|
-
assert_in_delta(0, methods[1].self_time, 0.
|
174
|
-
|
175
|
-
assert_in_delta(0.3, methods[2].total_time, 0.02)
|
176
|
-
assert_in_delta(0, methods[2].wait_time, 0.01)
|
177
|
-
assert_in_delta(0.3, methods[2].self_time, 0.02)
|
178
|
-
|
179
|
-
assert_in_delta(0, methods[3].total_time, 0.01)
|
180
|
-
assert_in_delta(0, methods[3].wait_time, 0.01)
|
181
|
-
assert_in_delta(0, methods[3].self_time, 0.01)
|
182
|
-
|
183
|
-
assert_in_delta(0, methods[4].total_time, 0.01)
|
184
|
-
assert_in_delta(0, methods[4].wait_time, 0.01)
|
185
|
-
assert_in_delta(0, methods[4].self_time, 0.01)
|
186
|
-
|
187
|
-
unless RubyProf.ruby_2?
|
188
|
-
assert_in_delta(0, methods[5].total_time, 0.01)
|
189
|
-
assert_in_delta(0, methods[5].wait_time, 0.01)
|
190
|
-
assert_in_delta(0, methods[5].self_time, 0.01)
|
191
|
-
end
|
124
|
+
assert_in_delta(0, methods[1].self_time, 0.05)
|
192
125
|
end
|
193
126
|
|
194
127
|
def test_singleton
|
data/test/test_helper.rb
CHANGED
@@ -77,6 +77,30 @@ module RubyProf
|
|
77
77
|
end
|
78
78
|
end
|
79
79
|
|
80
|
+
class C7
|
81
|
+
def self.hello
|
82
|
+
t = Time.now.to_f
|
83
|
+
while Time.now.to_f - t < 0.1; end
|
84
|
+
end
|
85
|
+
|
86
|
+
def hello
|
87
|
+
t = Time.now.to_f
|
88
|
+
while Time.now.to_f - t < 0.2; end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
|
92
|
+
module M7
|
93
|
+
def hello
|
94
|
+
t = Time.now.to_f
|
95
|
+
while Time.now.to_f - t < 0.3; end
|
96
|
+
end
|
97
|
+
end
|
98
|
+
|
99
|
+
class C8
|
100
|
+
include M7
|
101
|
+
extend M7
|
102
|
+
end
|
103
|
+
|
80
104
|
def self.ruby_major_version
|
81
105
|
match = RUBY_VERSION.match(/(\d)\.(\d)/)
|
82
106
|
return Integer(match[1])
|
data/test/thread_test.rb
CHANGED
@@ -3,6 +3,7 @@
|
|
3
3
|
|
4
4
|
require File.expand_path('../test_helper', __FILE__)
|
5
5
|
require 'timeout'
|
6
|
+
require 'benchmark'
|
6
7
|
|
7
8
|
# -- Tests ----
|
8
9
|
class ThreadTest < Test::Unit::TestCase
|
@@ -151,16 +152,20 @@ class ThreadTest < Test::Unit::TestCase
|
|
151
152
|
assert_equal(0, call_info.children.length)
|
152
153
|
end
|
153
154
|
|
154
|
-
# useless test
|
155
|
+
# useless test: what does it test?
|
155
156
|
def test_thread_back_and_forth
|
157
|
+
result = nil
|
158
|
+
seconds = Benchmark.realtime do
|
156
159
|
result = RubyProf.profile do
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
160
|
+
a = Thread.new { 100_000.times { sleep 0 }}
|
161
|
+
b = Thread.new { 100_000.times { sleep 0 }}
|
162
|
+
a.join
|
163
|
+
b.join
|
161
164
|
end
|
162
|
-
|
163
|
-
|
165
|
+
end
|
166
|
+
methods = result.threads.map {|thread| thread.methods}
|
167
|
+
timings = methods.flatten.sort
|
168
|
+
assert(timings[-1].total_time < seconds)
|
164
169
|
end
|
165
170
|
|
166
171
|
def test_thread
|
metadata
CHANGED
@@ -2,63 +2,63 @@
|
|
2
2
|
name: ruby-prof
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.15.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Shugo Maeda, Charlie Savage, Roger Pack, Stefan Kaes
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: minitest
|
16
|
-
|
16
|
+
version_requirements: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
17
18
|
requirements:
|
18
19
|
- - ~>
|
19
20
|
- !ruby/object:Gem::Version
|
20
21
|
version: '4.0'
|
22
|
+
requirement: !ruby/object:Gem::Requirement
|
21
23
|
none: false
|
22
|
-
prerelease: false
|
23
|
-
type: :development
|
24
|
-
version_requirements: !ruby/object:Gem::Requirement
|
25
24
|
requirements:
|
26
25
|
- - ~>
|
27
26
|
- !ruby/object:Gem::Version
|
28
27
|
version: '4.0'
|
29
|
-
|
28
|
+
prerelease: false
|
29
|
+
type: :development
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: rake-compiler
|
32
|
-
|
32
|
+
version_requirements: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
33
34
|
requirements:
|
34
35
|
- - '>='
|
35
36
|
- !ruby/object:Gem::Version
|
36
37
|
version: '0'
|
38
|
+
requirement: !ruby/object:Gem::Requirement
|
37
39
|
none: false
|
38
|
-
prerelease: false
|
39
|
-
type: :development
|
40
|
-
version_requirements: !ruby/object:Gem::Requirement
|
41
40
|
requirements:
|
42
41
|
- - '>='
|
43
42
|
- !ruby/object:Gem::Version
|
44
43
|
version: '0'
|
45
|
-
|
44
|
+
prerelease: false
|
45
|
+
type: :development
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: rdoc
|
48
|
-
|
48
|
+
version_requirements: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
49
50
|
requirements:
|
50
51
|
- - '>='
|
51
52
|
- !ruby/object:Gem::Version
|
52
53
|
version: '0'
|
54
|
+
requirement: !ruby/object:Gem::Requirement
|
53
55
|
none: false
|
54
|
-
prerelease: false
|
55
|
-
type: :development
|
56
|
-
version_requirements: !ruby/object:Gem::Requirement
|
57
56
|
requirements:
|
58
57
|
- - '>='
|
59
58
|
- !ruby/object:Gem::Version
|
60
59
|
version: '0'
|
61
|
-
|
60
|
+
prerelease: false
|
61
|
+
type: :development
|
62
62
|
description: |
|
63
63
|
ruby-prof is a fast code profiler for Ruby. It is a C extension and
|
64
64
|
therefore is many times faster than the standard Ruby profiler. It
|
@@ -252,20 +252,20 @@ rdoc_options: []
|
|
252
252
|
require_paths:
|
253
253
|
- lib
|
254
254
|
required_ruby_version: !ruby/object:Gem::Requirement
|
255
|
+
none: false
|
255
256
|
requirements:
|
256
257
|
- - '>='
|
257
258
|
- !ruby/object:Gem::Version
|
258
259
|
version: 1.9.3
|
259
|
-
none: false
|
260
260
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
261
|
+
none: false
|
261
262
|
requirements:
|
262
263
|
- - '>='
|
263
264
|
- !ruby/object:Gem::Version
|
264
|
-
hash: -374709300685905982
|
265
265
|
segments:
|
266
266
|
- 0
|
267
|
+
hash: -3641831805490330647
|
267
268
|
version: '0'
|
268
|
-
none: false
|
269
269
|
requirements: []
|
270
270
|
rubyforge_project:
|
271
271
|
rubygems_version: 1.8.25
|