A proof of concept on how to parse .trace documents generated by Instruments, using the undocumented frameworks shipped with Instruments.
We need to link against these frameworks
/Applications/Xcode.app/Contents/SharedFrameworks/DVTFoundation.framework
/Applications/Xcode.app/Contents/SharedFrameworks/DVTInstrumentsFoundation.framework
/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsPlugIn.framework
/Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/Frameworks/InstrumentsKit.framework
Instrument templates used by the app are plugins in /Applications/Xcode.app/Contents/Applications/Instruments.app/Contents/PlugIns
Such as SamplerPlugin.xrplugin
for Time Profiler.
The code is short and commented out and I don't need to explain much here.