Initial draft of a tracing API.

This is used in conjunction with a collection & analysis server
to analyze memory usage and other aspects of a program running
under emscripten.
shouldn't these be ifdef'd?