inferno icon indicating copy to clipboard operation
inferno copied to clipboard

`xctrace` support

Open ldm0 opened this issue 2 years ago • 5 comments

~~Basically working. Required to be done:~~

  • [x] quick-xml update #332
  • [x] Add more logs and tests
  • [x] Documentation and changelog update

Fixes #246

xctrace is a tracer used internally by Apple Instruments. It generates a .trace folder containing a bunch of files in an unknown binary format. People have reverse engineerd it but it's internal format changed after XCode 12.

There's a xctrace export command, which can convert .trace into a readable XML file. However, it's output can't be used to generate flamegraphs until XCode 14.3, which introduces VM address and symbol name to the XML output.

In this PR, I added a stack collapser for XML files generated by xctrace export, making it possible to convert Instruments or xctrace‘s output into flamegraph.

ldm0 avatar Mar 26 '23 17:03 ldm0

Codecov Report

Patch coverage is 84.70% of modified lines.

Files Changed Coverage
src/collapse/mod.rs ø
src/collapse/xctrace.rs 84.58%
src/collapse/guess.rs 100.00%

:loudspeaker: Thoughts on this report? Let us know!.

codecov[bot] avatar Apr 08 '23 17:04 codecov[bot]

Hey, I was going to start working on integrating this only to see the work was already done! Thanks @ldm0!

I can help add the documentation if needed. Also not sure if this feature need to be tied to the quick-xml update?

kraktus avatar Apr 16 '23 08:04 kraktus

I can help add the documentation if needed. Also not sure if this feature need to be tied to the quick-xml update?

Thanks! I've written some documentation already, will submit it tomorrow. I think introducing multiple versions of the same dependency is bad(in terms of artifact size and complexity), so I'm waiting for the quick-xml update.

BTW, I've forked flamegraph with this inferno branch and you can try it: cargo install --git https://github.com/ldm0/flamegraph --branch xctrace, I replaced the default tracer(dtrace) with xctrace on macOS. (Make sure you get an XCode>=14.3 though)

ldm0 avatar Apr 16 '23 16:04 ldm0