forked from MystenLabs/sui
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document xctrace usage (MystenLabs#3062)
Co-authored-by: Mark Logan <[email protected]>
- Loading branch information
1 parent
4982dc4
commit 7446253
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
title: Profiling Sui on Mac OS using XCode instruments. | ||
--- | ||
|
||
To profile on Mac OS: | ||
|
||
* Install XCode: https://apps.apple.com/us/app/xcode/id497799835?mt=12 | ||
* Make sure you have the command line tools but running `xcode-select install`. If it says they are already installed you may want to go directly to https://developer.apple.com/download/more/ and download the .pkg for the commandline tools to make sure they are up to date. | ||
* Add `/Applications/Xcode.app/Contents/Developer/usr/bin` to your `$PATH`. | ||
* Build whatever Sui component you want to run normally with `cargo build` - these docs assume `target/debug/sui`. | ||
* Sign the binary you wish to profile: | ||
* Create a file called `debug.plist` with the following contents: | ||
|
||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "https://www.apple.com/DTDs/PropertyList-1.0.dtd"><plist version="1.0"><dict><key>com.apple.security.get-task-allow</key><true/></dict></plist> | ||
|
||
* Run: | ||
$ codesign -s - -v -f --entitlements ../debug.plist target/debug/sui | ||
* Now run the app and record a trace (select the most appropriate template, see xcode documentation for available templates). | ||
|
||
$ xcrun xctrace record --template 'Allocations' --launch -- ./target/debug/sui start | ||
|
||
* Ctrl-C the app when you've recorded enough. | ||
* It will write a directory starting with `Launch_` - run: | ||
|
||
$ open Launch_xxxxxxxx | ||
|
||
* The trace should open in XCode. |