Accessing sanitizer statistics from user code

Hi all,

I am trying to understand the specific impact of various mechanisms in ASan in some user code. I’ve looked at the code that collects statistics in compiler-rt/lib/asan/asan_stats.{h,cpp}.

Ideally, at various points in a user program, I’d like to trigger the merging of stats from different threads and dump the info to stderr, which looks to be exactly what __asan_print_accumulated_stats() does.

Does anyone have any pointers to how to go about this?