make profiler thread-safe