kyren / gc-arena

Incremental garbage collection from safe Rust
Creative Commons Zero v1.0 Universal
436 stars 36 forks source link

Implement basic, feature-gated, `tracing` support #78

Closed moulins closed 11 months ago

moulins commented 11 months ago

This emits a span per GC phase (mark, sweep, drop), and events when collection resumes and terminates.

moulins commented 11 months ago

A sample of the logs produced by this PR:

2023-07-14T17:24:24.853911Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: running... phase=Sweep allocated=11899208
2023-07-14T17:24:24.856002Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: yielding... phase=Sweep allocated=10905800
2023-07-14T17:24:24.943568Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: running... phase=Sweep allocated=11490800
2023-07-14T17:24:24.945990Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: yielding... phase=Sweep allocated=10515672
2023-07-14T17:24:25.038069Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: running... phase=Sweep allocated=11110688
2023-07-14T17:24:25.040997Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: yielding... phase=Sweep allocated=10119120
2023-07-14T17:24:25.131978Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: running... phase=Sweep allocated=10707352
2023-07-14T17:24:25.133860Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: yielding... phase=Sweep allocated=9726944
2023-07-14T17:24:25.225628Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: running... phase=Sweep allocated=10315720
2023-07-14T17:24:25.227260Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: yielding... phase=Sweep allocated=9334472
2023-07-14T17:24:25.313472Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: running... phase=Sweep allocated=9918448
2023-07-14T17:24:25.315422Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: yielding... phase=Sweep allocated=8945024
2023-07-14T17:24:25.405417Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sweep}: gc_arena: GC: running... phase=Sweep allocated=9540040
2023-07-14T17:24:25.407913Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sleep}: gc_arena: GC: yielding... phase=Sleep allocated=9286104
2023-07-14T17:24:25.656403Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Sleep}: gc_arena: GC: running... phase=Sleep allocated=11105304
2023-07-14T17:24:25.656959Z DEBUG run_frame:gc_arena{id=0x55bb1861ae30 phase=Mark}: gc_arena: GC: yielding... phase=Mark allocated=11105304