ProfilingMode should be an enum rather than String.
concurrency bug 1: fixed using concurrent data structure.
concurrency bug 2: make sure to use getProfilingLogger.