File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
Filter options
Expand file tree Collapse file tree 3 files changed +17
-1
lines changed
Original file line number Diff line number Diff line change
1
+ Tue Oct 29 11:10:08 2013 Aman Gupta <ruby@tmm1.net>
2
+
3
+ * gc.c (gc_profile_total_time): fix off-by-one error in
4
+ GC::Profiler.total_time.
5
+ * test/ruby/test_gc.rb (class TestGc): test for above.
6
+
1
7
Tue Oct 29 09:53:00 2013 Charlie Somerville <charliesome@ruby-lang.org>
2
8
3
9
* insns.def, vm.c, vm_insnhelper.c, vm_insnhelper.h, vm_method.c: split
Original file line number Diff line number Diff line change @@ -6140,7 +6140,7 @@ gc_profile_total_time(VALUE self)
6140
6140
6141
6141
if (objspace -> profile .run && objspace -> profile .next_index > 0 ) {
6142
6142
size_t i ;
6143
- size_t count = objspace -> profile .next_index - 1 ;
6143
+ size_t count = objspace -> profile .next_index ;
6144
6144
6145
6145
for (i = 0 ; i < count ; i ++ ) {
6146
6146
time += objspace -> profile .records [i ].gc_time ;
Original file line number Diff line number Diff line change @@ -166,6 +166,16 @@ def test_profiler_clear
166
166
eom
167
167
end
168
168
169
+ def test_profiler_total_time
170
+ GC ::Profiler . enable
171
+ GC ::Profiler . clear
172
+
173
+ GC . start
174
+ assert_operator ( GC ::Profiler . total_time , :> , 0 )
175
+ ensure
176
+ GC ::Profiler . disable
177
+ end
178
+
169
179
def test_finalizing_main_thread
170
180
assert_in_out_err ( %w[ --disable-gems ] , <<-EOS , [ "\" finalize\" " ] , [ ] , "[ruby-dev:46647]" )
171
181
ObjectSpace.define_finalizer(Thread.main) { p 'finalize' }
You can’t perform that action at this time.
0 commit comments