ruby-changes:35408
From: ko1 <ko1@a...>
Date: Wed, 10 Sep 2014 11:13:50 +0900 (JST)
Subject: [ruby-changes:35408] ko1:r47490 (trunk): * gc.c (gc_stat_internal): support:
ko1 2014-09-10 11:13:41 +0900 (Wed, 10 Sep 2014) New Revision: 47490 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47490 Log: * gc.c (gc_stat_internal): support: * total_allocated_pages * total_freed_pages ref: [Feature #9924] Modified files: trunk/ChangeLog trunk/gc.c Index: ChangeLog =================================================================== --- ChangeLog (revision 47489) +++ ChangeLog (revision 47490) @@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Sep 10 11:12:25 2014 Koichi Sasada <ko1@a...> + + * gc.c (gc_stat_internal): support: + * total_allocated_pages + * total_freed_pages + ref: [Feature #9924] + Wed Sep 10 10:48:04 2014 Koichi Sasada <ko1@a...> * test/ruby/test_gc.rb: catch up last fix. Index: gc.c =================================================================== --- gc.c (revision 47489) +++ gc.c (revision 47490) @@ -557,6 +557,8 @@ typedef struct rb_objspace { https://github.com/ruby/ruby/blob/trunk/gc.c#L557 /* basic statistics */ size_t count; size_t total_freed_objects; + size_t total_allocated_pages; + size_t total_freed_pages; } profile; struct gc_list *global_list; @@ -1299,6 +1301,7 @@ static void https://github.com/ruby/ruby/blob/trunk/gc.c#L1301 heap_page_free(rb_objspace_t *objspace, struct heap_page *page) { heap_allocated_pages--; + objspace->profile.total_freed_pages++; aligned_free(page->body); free(page); } @@ -1383,6 +1386,8 @@ heap_page_allocate(rb_objspace_t *objspa https://github.com/ruby/ruby/blob/trunk/gc.c#L1386 heap_pages_sorted[hi] = page; heap_allocated_pages++; + objspace->profile.total_allocated_pages++; + if (RGENGC_CHECK_MODE) assert(heap_allocated_pages <= heap_pages_sorted_length); /* adjust obj_limit (object number available in this page) */ @@ -6253,6 +6258,7 @@ gc_stat_internal(VALUE hash_or_sym) https://github.com/ruby/ruby/blob/trunk/gc.c#L6258 static VALUE sym_heap_available_slots, sym_heap_live_slots, sym_heap_free_slots, sym_heap_final_slots; static VALUE sym_heap_marked_slots, sym_heap_swept_slots; static VALUE sym_heap_eden_pages, sym_heap_tomb_pages; + static VALUE sym_total_allocated_pages, sym_total_freed_pages; static VALUE sym_total_allocated_objects, sym_total_freed_objects; static VALUE sym_malloc_increase, sym_malloc_limit; #if USE_RGENGC @@ -6296,6 +6302,8 @@ gc_stat_internal(VALUE hash_or_sym) https://github.com/ruby/ruby/blob/trunk/gc.c#L6302 S(heap_swept_slots); S(heap_eden_pages); S(heap_tomb_pages); + S(total_allocated_pages); + S(total_freed_pages); S(total_allocated_objects); S(total_freed_objects); S(malloc_increase); @@ -6343,6 +6351,8 @@ gc_stat_internal(VALUE hash_or_sym) https://github.com/ruby/ruby/blob/trunk/gc.c#L6351 SET(heap_swept_slots, heap_pages_swept_slots); SET(heap_eden_pages, heap_eden->page_length); SET(heap_tomb_pages, heap_tomb->page_length); + SET(total_allocated_pages, objspace->profile.total_allocated_pages); + SET(total_freed_pages, objspace->profile.total_freed_pages); SET(total_allocated_objects, objspace->total_allocated_objects); SET(total_freed_objects, objspace->profile.total_freed_objects); SET(malloc_increase, malloc_increase); -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/