Skip to content

Conversation

@ldm0
Copy link
Contributor

@ldm0 ldm0 commented Mar 26, 2023

Basically working. Required to be done:

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 ldm0 marked this pull request as draft March 26, 2023 17:59
@ldm0 ldm0 force-pushed the ldm_xctrace_support branch 4 times, most recently from 8988028 to 4fdfd61 Compare April 2, 2023 09:21
@codecov
Copy link

codecov bot commented Apr 8, 2023

Codecov Report

Attention: Patch coverage is 79.78723% with 57 lines in your changes missing coverage. Please review.

Project coverage is 90.68%. Comparing base (8e691e6) to head (29019cc).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/collapse/xctrace.rs 79.56% 57 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #286      +/-   ##
==========================================
- Coverage   91.38%   90.68%   -0.70%     
==========================================
  Files          20       21       +1     
  Lines        4444     4725     +281     
==========================================
+ Hits         4061     4285     +224     
- Misses        383      440      +57     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ldm0 ldm0 force-pushed the ldm_xctrace_support branch from 4fdfd61 to 959928b Compare April 11, 2023 04:56
@kraktus
Copy link

kraktus commented Apr 16, 2023

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?

@ldm0
Copy link
Contributor Author

ldm0 commented Apr 16, 2023

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 ldm0 force-pushed the ldm_xctrace_support branch from 959928b to 49ff175 Compare September 17, 2023 17:02
@ldm0 ldm0 force-pushed the ldm_xctrace_support branch 4 times, most recently from 41bad5a to fa5ffda Compare November 26, 2024 11:50
@ldm0 ldm0 marked this pull request as ready for review November 26, 2024 11:53
@ldm0 ldm0 force-pushed the ldm_xctrace_support branch from fa5ffda to fef528b Compare November 26, 2024 13:19
@ldm0
Copy link
Contributor Author

ldm0 commented Nov 27, 2024

@jonhoo

Hi, now that #332 has been merged, this PR is ready for review.
I've personally used it for quite a long time and it has worked well. Please take a look.

@kraktus
Copy link

kraktus commented Dec 4, 2024

Same, I've been using it locally without issue

Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's exciting, thanks! Took a first pass now. Nothing too deep to change, though some stuff that'll make this easier to maintain longer-term :)

@ldm0 ldm0 force-pushed the ldm_xctrace_support branch from 3af45ef to dde90c0 Compare January 5, 2025 11:23
Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, it's already looking a lot better, thank you!

@ldm0
Copy link
Contributor Author

ldm0 commented Mar 19, 2025

ping @jonhoo

Copy link
Owner

@jonhoo jonhoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry about that taking forever! Looks good to me now — let's get this landed and released! 🎉

@jonhoo jonhoo merged commit 8455ee8 into jonhoo:main Mar 22, 2025
15 of 17 checks passed
@jonhoo
Copy link
Owner

jonhoo commented Mar 22, 2025

Releasing as 0.12.2 in #340

@ldm0
Copy link
Contributor Author

ldm0 commented Mar 22, 2025

Thanks for reviewing this!

@ldm0 ldm0 deleted the ldm_xctrace_support branch March 22, 2025 14:11
@jonhoo
Copy link
Owner

jonhoo commented Mar 22, 2025

No, thank you for sticking with it for so long!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use xctrace on macOS

3 participants