handle errors on posting profile result
cleanup profiler.js
[profiler] tweaks

* chnage the extention from .txt to .json
* .profile/results.json are built on demand