cmyr / cargo-instruments

A cargo plugin to generate Xcode Instruments trace files
MIT License
672 stars 34 forks source link

Add support for custom profiles #62

Closed maoe closed 2 years ago

maoe commented 2 years ago

This patch adds the new --profile NAME option to support cargo's custom profiles. The behavior hasn't changed when --release is passed or when nothing related to profiles are given.

My motivation for this change is that I need to set split-debuginfo to packed for Instrument to be able to load source locations, but I'd like to use the default release profile for everything else.

[profile.instruments]
inherits = "release"
split-debuginfo = "packed"

Then you can run cargo-instruments like this

cargo instruments --profile instruments -t time -- ...
maoe commented 2 years ago

61 seems to use -p so I just removed the short flag here.

cmyr commented 2 years ago

This should also get rebased now that #61 is landed :)

cmyr commented 2 years ago

Another thought:

We could also do something fancy, where if there's a profile named 'instruments' then we use it by default? 🤔

maoe commented 2 years ago

Thanks for reviewing this. Rebased and force-pushed.