Some process starts as root but drops the privileges later. Profile runtime currently eagerly creates profile file directory on program start up. This can cause problems later when profiling APIs (such as set filename, cleanup dir etc) are used to do profile dumping when the process privilege is dropped -- the directory can not be cleaned up before/after profile dumping.
In this patch, the dir creation is delayed until profile writing time when merge mode is on. No other external behavior changes should be expected.