Profiler class refactoring

* Merged the "collate at end" and "running collate" logic
  into the base class to make it more unified and consistent.
* Pulled out DB code into ProfilerSimpleDB class.
* Removed the ProfilerSimple class and updated child classes.
* Made ProfilerSimpleTrace set the debug information too.
* Work around "ended by close()" bug from 99aef03f. Since the
  getRawData() method gets called while some wfProfileOut() calls
  have not yet happened, make it use the matched call data and let
  the final logData() method work on the full data as normal.
* Let ProfilerSimple classes use getFunctionReport() for the profiler
  debug log if it is setup instead of making it just return "".
* Made getRawData() work as best as possible with ProfilerMwprof.
* Removed $wgProfileToDatabase since it is now useless.
* Improved DB profile performance with sqlite.
* Updated visibility of various methods.

Hand picked from Change-Id: I1260bab2b5ba12dccbba701bcae4a637cb85c6e8

Change-Id: I832997187c20c95df406e6bfbe08d34b54531ef2