generalized profiler and improved output