profiler
profiler copied to clipboard
Instruments importer
This was an attempt to port the speedscope importer to the profiler. I think it was sort of working when I stopped.
I initially attempted to fix up the intern's code, but ran into issues with not knowing what was a bug in the new code, or if there were bugs in the original code.
My process was to naively copy over the relevant speedscope code, and then re-work it to get the types passing. I think there were some existing issues with how an instruments profile was recorded and the final structure of recorded profile. There is an assumption in this code that the profile was either recorded from the command line, or recorded from the instruments app. I don't recall which at this point.
I filed https://github.com/jlfwong/speedscope/issues/384 for an Instruments file that wouldn't load with this and speedscope.
In order to land this PR, the first few commits are all importing speedscope code and making it pass some basic CI requirements. These shouldn't be too controversial.
The two WIP commits on the end are the ones getting it to work for the Firefox Profiler. Honestly, they could probably be squashed into a single commit, and rebased, and landed as is.
I'm not planning on finishing this PR at this time.
There is an issue that @jrmuizel filed, which I believe that certain Instruments profiles have different file organization structure. I was testing this code from instruments-simple.trace.zip which appears to be working in the deploy preview.
It seems like they changed the Instruments file format quite a bit after Xcode 10. Profiles from Xcode 10 load but with the wrong information. And profiles from Xcode 13 are not loading at all. It looks like there are a few problems that were identified in speedscope. Adding here so it could provide a basis for our investigation next time:
- Stack traces are messed up
- Thread IDs are incorrected (they don't match binary plist entries) This suggests that something changed either in bulkstore or in integeruniquer.data Attempted WIP fix: https://github.com/jlfwong/speedscope/pull/216
- Instead of being stored in the plist file the symbols are in the symbols directory. The symbols files are binary with a bunch of null terminated strings at the end for each of the symbols.
Interestingly the old Instruments profiles don't load in the new Instruments version as well. So it seems like they dropped the support for those profile types completely.