Small headless client optimize
move profiler from main.cpp to profiler.cpp
Fix dtime