This repository has been archived by the owner on Feb 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 85251ec
Showing
209 changed files
with
125,195 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,40 @@ | ||
catapult/* linguist-vendored | ||
sampledata/* linguist-vendored | ||
sample/* linguist-vendored | ||
|
||
#sources | ||
*.c text | ||
*.cc text | ||
*.cxx text | ||
*.cpp text | ||
*.c++ text | ||
*.hpp text | ||
*.h text | ||
*.h++ text | ||
*.hh text | ||
|
||
# Compiled Object files | ||
*.slo binary | ||
*.lo binary | ||
*.o binary | ||
*.obj binary | ||
|
||
# Precompiled Headers | ||
*.gch binary | ||
*.pch binary | ||
|
||
# Compiled Dynamic libraries | ||
*.so binary | ||
*.dylib binary | ||
*.dll binary | ||
|
||
# Compiled Static libraries | ||
*.lai binary | ||
*.la binary | ||
*.a binary | ||
*.lib binary | ||
|
||
# Executables | ||
*.exe binary | ||
*.out binary | ||
*.app binary |
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,12 @@ | ||
*.xcuserstate | ||
*.xcuserdatad | ||
.DS_Store | ||
.vscode | ||
loader/AppleTraceLoader.mm | ||
loader/Packages/ | ||
loader/AppleTraceLoader/Package/Library/MobileSubstrate/DynamicLibraries/AppleTraceLoader.dylib | ||
appletrace/appletrace.xcodeproj/project.xcworkspace/xcuserdata/ | ||
appletrace/appletrace.xcodeproj/xcuserdata/ | ||
*.deb | ||
*.zip | ||
*.dylib |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2017 everettjf | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,118 @@ | ||
# AppleTrace | ||
Trace tool for iOS/macOS | ||
|
||
`AppleTrace` is developed for analyzing app's performance on `iOS/macOS`. | ||
|
||
![logo](/image/appletrace-small.png) | ||
|
||
- [中文说明,开发思路及方法](http://everettjf.com/2017/09/21/appletrace/) | ||
- [搭载MonkeyDev可trace第三方App](http://everettjf.com/2017/10/12/appletrace-dancewith-monkeydev/) | ||
|
||
![appletrace](https://everettjf.github.io/stuff/appletrace/appletrace.gif) | ||
|
||
|
||
## Feature | ||
|
||
1. User-defined trace section. | ||
2. Trace Objective C methods. | ||
|
||
## FAQ | ||
|
||
[Go to Wiki](https://github.com/everettjf/AppleTrace/wiki) | ||
|
||
## Clone | ||
|
||
``` | ||
git clone https://github.com/everettjf/AppleTrace.git | ||
``` | ||
|
||
For stable release , please refer to [Releases](https://github.com/everettjf/AppleTrace/releases) | ||
|
||
## Usage | ||
|
||
1. Produce trace data. | ||
2. Copy from app's sandbox directory. | ||
3. Merge (all) trace data files into one file `trace.json`. (There may be more than 1 trace file.) | ||
4. Generate `trace.html` based on `trace.json`. | ||
|
||
See below for more detail. | ||
|
||
### 1. Produce | ||
|
||
|
||
Until now , there are 2 ways for generating trace data. | ||
|
||
(1) Manual set section. | ||
|
||
Call `APTBeginSection` at the beginning of method ,and `APTEndSection` at the end of method. For Objective C method (whether instance method or class method), there are `APTBegin` and `APTEnd` macro for easy coding. | ||
|
||
``` | ||
void anyKindsOfMethod{ | ||
APTBeginSection("process"); | ||
// some code | ||
APTEndSection("process"); | ||
} | ||
- (void)anyObjectiveCMethod{ | ||
APTBegin; | ||
// some code | ||
APTEnd; | ||
} | ||
``` | ||
|
||
Sample app is `sample/ManualSectionDemo`. | ||
|
||
(2) Dynamic library hooking all objc_msgSend. | ||
|
||
Hooking all objc_msgSend methods (based on HookZz). This only support arm64 under debugger ( lldb). | ||
|
||
Sample app is `sample/TraceAllMsgDemo`. | ||
|
||
### 2. Copy | ||
|
||
Using any kinds of method, copy `<app's sandbox>/Library/appletracedata` out of Simulator/RealDevice. | ||
|
||
![appletracedata](image/appletracedata.png) | ||
|
||
|
||
### 3. Merge | ||
|
||
Merge/Preprocess the `appletracedata`. | ||
|
||
``` | ||
python merge.py -d <appletracedata directory> | ||
``` | ||
|
||
This will produce `trace.json` in appletracedata directory. | ||
|
||
NOW !!!, you could drop `trace.json` into Chrome's `chrome://tracing`. Or if you want to generate a html result, continue to the 4th step. | ||
|
||
### 4. Generate | ||
|
||
Run `sh get_catapult.sh` to get catapult source. | ||
|
||
Then generate `trace.html` using `catapult`. | ||
|
||
``` | ||
python catapult/tracing/bin/trace2html appletracedata/trace.json --output=appletracedata/trace.html | ||
open trace.html | ||
``` | ||
|
||
*trace.html only support Chrome* | ||
|
||
## SampleData | ||
|
||
Open `sampledata/trace.html` using Chrome. | ||
|
||
## Thanks | ||
|
||
1. HookZz : https://github.com/jmpews/HookZz | ||
2. catapult : https://github.com/catapult-project/catapult | ||
|
||
## Group | ||
|
||
欢迎关注微信订阅号,更多有趣的性能优化点点滴滴。 | ||
|
||
![fun](https://everettjf.github.io/images/fun.jpg) | ||
|
||
|
Oops, something went wrong.