@@ -101,9 +101,13 @@ impl Collection<JuliaVM> for VMCollection {
101
101
102
102
#[ cfg( feature = "heap_dump" ) ]
103
103
dump_heap ( GC_COUNT . load ( Ordering :: SeqCst ) , 1 ) ;
104
- // dump_immix_block_stats();
105
104
GC_COUNT . fetch_add ( 1 , Ordering :: SeqCst ) ;
106
105
106
+ #[ cfg( feature = "dump_block_stats" ) ]
107
+ dump_immix_block_stats ( ) ;
108
+ #[ cfg( feature = "print_fragmentation" ) ]
109
+ print_fragmentation ( ) ;
110
+
107
111
AtomicBool :: store ( & BLOCK_FOR_GC , false , Ordering :: SeqCst ) ;
108
112
AtomicBool :: store ( & WORLD_HAS_STOPPED , false , Ordering :: SeqCst ) ;
109
113
@@ -204,57 +208,52 @@ pub extern "C" fn mmtk_block_thread_for_gc() {
204
208
AtomicIsize :: store ( & USER_TRIGGERED_GC , 0 , Ordering :: SeqCst ) ;
205
209
}
206
210
207
- // This will dump the block stats for the last GC (it overwrites the file each time)
208
- // Setting it to true will make the runs much slower!!!
209
- const DUMP_BLOCK_STATS_FOR_HISTOGRAM : bool = false ;
210
211
212
+ #[ cfg( feature = "dump_block_stats" ) ]
211
213
pub fn dump_immix_block_stats ( ) {
212
214
use mmtk:: util:: Address ;
213
215
use mmtk:: util:: ObjectReference ;
214
216
use std:: fs:: OpenOptions ;
215
217
use std:: io:: Write ;
216
218
217
- if DUMP_BLOCK_STATS_FOR_HISTOGRAM {
218
- let mut file = OpenOptions :: new ( )
219
- . create ( true )
220
- . write ( true )
221
- . truncate ( true )
222
- . open ( "/home/eduardo/output-block-stats.log" ) // ← Replace with your desired file path
223
- . expect ( "Unable to open log file" ) ;
224
-
225
- SINGLETON . enumerate_objects (
226
- |space_name : & str , block_start : Address , block_size : usize , object : ObjectReference | {
227
- if space_name == "immix" {
228
- writeln ! (
229
- file,
230
- "Block: {}, object: {} ({}), size: {}, pinned: {}" ,
231
- block_start,
232
- object,
233
- unsafe {
234
- crate :: julia_scanning:: get_julia_object_type( object. to_raw_address( ) )
235
- } ,
236
- unsafe { crate :: object_model:: get_so_object_size( object, crate :: object_model:: get_hash_size( object) ) } ,
237
- mmtk:: memory_manager:: is_pinned( object) ,
238
- )
239
- . expect ( "Unable to write to log file" ) ;
240
- } else if space_name == "nonmoving" {
241
- writeln ! (
242
- file,
243
- "Nonmoving: {}, object: {} ({}), size: {}, reachable: {}" ,
244
- block_start,
245
- object,
246
- unsafe {
247
- crate :: julia_scanning:: get_julia_object_type( object. to_raw_address( ) )
248
- } ,
249
- unsafe { crate :: object_model:: get_so_object_size( object, 0 ) } ,
250
- object. is_reachable( ) ,
251
- )
252
- . expect ( "Unable to write to log file" ) ;
253
- }
254
- } ,
255
- ) ;
256
- print_fragmentation ( ) ;
257
- }
219
+ let mut file = OpenOptions :: new ( )
220
+ . create ( true )
221
+ . write ( true )
222
+ . truncate ( true )
223
+ . open ( "output-block-stats.log" ) // ← Replace with your desired file path
224
+ . expect ( "Unable to open log file" ) ;
225
+
226
+ SINGLETON . enumerate_objects (
227
+ |space_name : & str , block_start : Address , block_size : usize , object : ObjectReference | {
228
+ if space_name == "immix" {
229
+ writeln ! (
230
+ file,
231
+ "Block: {}, object: {} ({}), size: {}, pinned: {}" ,
232
+ block_start,
233
+ object,
234
+ unsafe {
235
+ crate :: julia_scanning:: get_julia_object_type( object. to_raw_address( ) )
236
+ } ,
237
+ unsafe { crate :: object_model:: get_so_object_size( object, crate :: object_model:: get_hash_size( object) ) } ,
238
+ mmtk:: memory_manager:: is_pinned( object) ,
239
+ )
240
+ . expect ( "Unable to write to log file" ) ;
241
+ } else if space_name == "nonmoving" {
242
+ writeln ! (
243
+ file,
244
+ "Nonmoving: {}, object: {} ({}), size: {}, reachable: {}" ,
245
+ block_start,
246
+ object,
247
+ unsafe {
248
+ crate :: julia_scanning:: get_julia_object_type( object. to_raw_address( ) )
249
+ } ,
250
+ unsafe { crate :: object_model:: get_so_object_size( object, 0 ) } ,
251
+ object. is_reachable( ) ,
252
+ )
253
+ . expect ( "Unable to write to log file" ) ;
254
+ }
255
+ } ,
256
+ ) ;
258
257
}
259
258
260
259
#[ cfg( feature = "heap_dump" ) ]
0 commit comments