https://github.com/bytedance/btrace
🔥🔥 btrace (AKA RheaTrace) is a high-performance Android & iOS tracing tool built on Perfetto. It not only times your methods but also reveals why they’re slow.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
â—‹CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
â—‹DOI references
-
â—‹Academic publication links
-
â—‹Committers with academic emails
-
â—‹Institutional organization owner
-
â—‹JOSS paper metadata
-
â—‹Scientific vocabulary similarity
Low similarity (13.9%) to scientific vocabulary
Repository
🔥🔥 btrace (AKA RheaTrace) is a high-performance Android & iOS tracing tool built on Perfetto. It not only times your methods but also reveals why they’re slow.
Basic Info
Statistics
- Stars: 2,320
- Watchers: 40
- Forks: 315
- Open Issues: 59
- Releases: 7
Metadata Files
README.MD
btrace
Major Update
We are proud to announce the launch of btrace 3.0, introducing an industry-first high-performance synchronized sampling-based tracing solution. Additionally, the new version now provides comprehensive iOS tracing capabilities.
btrace for Android
Integration
Add dependencies in app/build.gradle file:
groovy
dependencies {
if (enable_btrace == 'true') {
implementation 'com.bytedance.btrace:rhea-inhouse:3.0.0'
} else {
implementation 'com.bytedance.btrace:rhea-inhouse-noop:3.0.0'
}
}
Add enable_btrace switch in the gradle.properties file:
```
Turn on this switch when you want to build app that support tracing.
enable_btrace=false ```
Add initialization code in attachBaseContext() method of your Application:
``` java
public class MyApp extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
// When rhea-inhouse-noop is used, RheaTrace3.init() has empty implementation.
RheaTrace3.init(base);
}
}
```
Usage
To use btrace 3.0, follow these instructions:
- Make sure that your computer has integrated adb and Java and Python3 environment.
- Connect your phone to your computer and make sure it can recognized by adb devices.
- Install the APK that integrates btrace 3.0 on your phone.
- Download the latest script from "Script Management" below to your computer.
- In the directory where the computer script is located, execute the following command:
shell
java -jar rhea-trace-shell.jar -a ${your_package_name} -t 10 -o output.pb -r sched
- Open the generated trace file in https://ui.perfetto.dev/ for detailed analysis.
Script Management
| Version | Release Date | jar | Release Notes | | ---|------------|--------------------------------| ---| | 3.0.0 | 2025-06-10 | rhea-trace-shell-3.0.0.jar | 3.0 first release |
Parameters Description
Required Parameters
| Parameter | Default Value | Description | |---|---|---| | -a $applicationName|N/A|Specifies the package name of your app|
Optional Parameters
| Parameter | Default Value | Description |
|---|---|---|
| -o $outputPath | ${applicationName}yyyyMMddHHmmss.pb | Specifies the path where the trace artifact is saved. By default, the value is autogenerated based on the tracing app package name and current timestamp. |
| -t $timeInSecond | 5 | Specifies the duration of the tracing, in seconds.
Note that: On MacOS, interactive tracing mode will be activated if you don't specifying the tracing duration. On windows, tracing dration must be specified, because we don't support interactive tracing mode on Windows currently. |
| -m $mappingPath | | Specifies the mapping file path for the abofuscated app.
Note that: it's not the methodMapping file that was used in btrace 2.0, but the mapping file generated by proguard. There is no methodMapping file in btrace 3.0. |
| -mode $mode | Decided at runtime. | btrace currently support two kinds of modes:
- perfetto: The default mode for systems 8.1 and above, allowing collecting system atrace and ftrace using perfetto service besides the app trace.
- simple: The default mode for systems below 8.1, allowin collecting app trace only.
Known Issues
| | Problems | Advices | | -- | --- | --- | | 1 | We currently only support devices running Android 8.0 or higher. | Please use devices with Android 8.0 or higher. | | 2 | Java object allocation monitoring is not yet adapted for devices with Android 15 and above. | If you need to inspect object memory allocation information or require more detailed tracing, please use devices with Android versions below 15. | | 3 | Devices that do not support Perfetto (mostly systems before 8.1) cannot collect system information such as CPU scheduling. | Try with -mode simple. | | 4 | 32-bit devices or applications cannot collect tracing data. | Please install and use 64-bit applications on 64-bit devices. |
btrace for iOS
Record trace data offline without Instruments to help find performance issue of your app.
Installation
Clone source code, and add the following lines to your Podfile:
ruby
pod 'BTrace', :subspecs => ['Core', 'Debug'], :path => 'xxx/btrace-iOS'
pod 'fishhook', :git => 'https://github.com/facebook/fishhook.git', :branch => 'main'
Install command line tool:
```bash
using homebrew
brew install libusbmuxd brew install poetry
install from the BTraceTool directory
poetry install ```
Usage
Activate the virtual environment before executing commands. ```bash
activate from the BTraceTool directory
poetry shell
or
poetry env activate ```
Record
Note that if '-l' is not specified, app must have been launched before recording.
bash
python3 -m btrace record [-h] [-i DEVICE_ID] [-b BUNDLE_ID] [-o OUTPUT] [-t TIME_LIMIT] [-d DSYM_PATH] [-m] [-l] [-s]
Options
| Option | Description |
|---------------------------------------| ----------- |
| -h, --help | Show help |
| -i DEVICEID, --deviceid DEVICEID | Device id. If not specified:
· If only one device is connected to Mac, it will be chosen
· If multiple devices are connected to Mac, prompt the user to make a selection |
| -b BUNDLEID --bundleid BUNDLEID | Bundle id |
| -o OUTPUT --output OUTPUT | Output path. If not specified, data will be saved to '~/Desktop/btrace'|
| -t TIMELIMIT --timelimit TIMELIMIT | Limit recording time, default 3600s |
| -d DSYMPATH --dsympath DSYMPATH | Dsym file path, or app path built by Xcode in debug mode. If specified,flamegraph will be displayed automatically after the recording ends |
| -m --mainthreadonly | If given, only record main thread trace data |
| -l --launch | If given, app will be launched/relaunched, and start recording on app launch|
| -s --sys_symbol | If given, symbols in the system libraries will be parsed |
Examples
bash
python3 -m btrace record -i xxx -b xxx -d /xxxDebug-iphoneos/xxx.app
python3 -m btrace record -i xxx -b xxx -d /xxxDebug-iphoneos/xxx.dSYM
Stop
bash
ctrl + c
Parse
When should the 'parse' command used? - '-d' option is not specified in the 'record' command. - reopen the parsed data
bash
python3 -m btrace parse [-h] [-d DSYM_PATH] [-f] [-s] file_path
Options
| Option | Description | |---------------------------------------| ----------- | | -h, --help | Show help | | -d DSYMPATH, --dsympath DSYMPATH | Dsym file path, or app path built by Xcode in debug mode | | -s, --syssymbol | If given, symbols in the system libraries will be parsed | | -f, --force | If given, force re-parsing trace data |
Examples
bash
btrace parse -d /xxx.dSYM xxx.sqlite
btrace parse -d /xxx.app xxx.sqlite
Technology Principle
If you are interested in the internal details of btrace 3.0, you can refer to the document: btrace 3.0 Internal Principle in Detail! .
Feedback
We've made a lot of improvements in btrace 3.0, including better error prompts. There might still be some cases where the prompts aren't accurate enough or the messages aren't clear. If you run into any issues, just give us a shout in the Lark group below, and we'll do our best to help you out. We always appreciate any other feedback or suggestions you might have too, thanks you!

Contributes
License
Owner
- Name: Bytedance Inc.
- Login: bytedance
- Kind: organization
- Location: Singapore
- Website: https://opensource.bytedance.com
- Twitter: ByteDanceOSS
- Repositories: 255
- Profile: https://github.com/bytedance
GitHub Events
Total
- Create event: 8
- Release event: 1
- Issues event: 31
- Watch event: 310
- Delete event: 6
- Member event: 1
- Issue comment event: 65
- Push event: 10
- Pull request review event: 1
- Pull request event: 17
- Fork event: 39
Last Year
- Create event: 8
- Release event: 1
- Issues event: 31
- Watch event: 310
- Delete event: 6
- Member event: 1
- Issue comment event: 65
- Push event: 10
- Pull request review event: 1
- Pull request event: 17
- Fork event: 39
Committers
Last synced: about 1 year ago
Top Committers
| Name | Commits | |
|---|---|---|
| chenjiawei.kisson@bytedance.com | c****n@b****m | 10 |
| caodongping | c****g@b****m | 10 |
| majun.oreo@bytedance.com | m****o@b****m | 2 |
| maoqiankang | m****g@b****m | 1 |
| cjztool | c****l@1****m | 1 |
| TestPlanB | 1****9@q****m | 1 |
| Qinglin | p****e@g****m | 1 |
| PTrainbow | 3****0@q****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 11 months ago
All Time
- Total issues: 137
- Total pull requests: 36
- Average time to close issues: 4 months
- Average time to close pull requests: about 2 months
- Total issue authors: 116
- Total pull request authors: 18
- Average comments per issue: 2.2
- Average comments per pull request: 0.28
- Merged pull requests: 21
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 26
- Pull requests: 12
- Average time to close issues: 12 days
- Average time to close pull requests: 2 days
- Issue authors: 23
- Pull request authors: 4
- Average comments per issue: 1.19
- Average comments per pull request: 0.17
- Merged pull requests: 6
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- renzhenming (6)
- livelitoday (5)
- wesley666 (2)
- jll0628 (2)
- xinledanding (2)
- wwzlp (2)
- easternHong (2)
- Free-Solo-truth (2)
- erduoniba (2)
- aheadlcx (2)
- huihuishoumei (2)
- sfengs (1)
- sixangle (1)
- starlingever (1)
- rickenwang (1)
Pull Request Authors
- WangFeng-AHU (6)
- mzule (6)
- xiaomahuang (4)
- lsc2895 (3)
- 5peak2me (2)
- kissonchan (2)
- learrn (1)
- lcmoxiao (1)
- qkmaosjtu (1)
- sansecy (1)
- TestPlanB (1)
- utzcoz (1)
- cjztool (1)
- zhiwei-wu (1)
- erduoniba (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 9
- Total downloads: unknown
-
Total dependent packages: 8
(may contain duplicates) -
Total dependent repositories: 2
(may contain duplicates) - Total versions: 88
repo1.maven.org: com.bytedance.btrace:rhea-common
btrace is a high performance Android trace tool which is based on Perfetto.
- Homepage: https://github.com/bytedance/btrace
- Documentation: https://appdoc.app/artifact/com.bytedance.btrace/rhea-common/
- License: Apache 2 license
-
Latest release: 2.0.2
published almost 3 years ago
Rankings
repo1.maven.org: com.bytedance.btrace:rhea-atrace
btrace is a high performance Android trace tool which is based on Perfetto.
- Homepage: https://github.com/bytedance/btrace
- Documentation: https://appdoc.app/artifact/com.bytedance.btrace/rhea-atrace/
- License: Apache 2 license
-
Latest release: 2.0.2
published almost 3 years ago
Rankings
repo1.maven.org: com.bytedance.btrace:rhea-core
btrace is a high performance Android trace tool which is based on Perfetto.
- Homepage: https://github.com/bytedance/btrace
- Documentation: https://appdoc.app/artifact/com.bytedance.btrace/rhea-core/
- License: Apache 2 license
-
Latest release: 2.0.2
published almost 3 years ago
Rankings
repo1.maven.org: com.bytedance.btrace:rhea-gradle-plugin
btrace is a high performance Android trace tool which is based on Perfetto.
- Homepage: https://github.com/bytedance/btrace
- Documentation: https://appdoc.app/artifact/com.bytedance.btrace/rhea-gradle-plugin/
- License: Apache 2 license
-
Latest release: 2.0.2
published almost 3 years ago
Rankings
repo1.maven.org: com.bytedance.btrace:rhea-trace-processor
btrace is a high performance Android trace tool which is based on Perfetto.
- Homepage: https://github.com/bytedance/btrace
- Documentation: https://appdoc.app/artifact/com.bytedance.btrace/rhea-trace-processor/
- License: Apache 2 license
-
Latest release: 3.0.0
published about 1 year ago
Rankings
repo1.maven.org: com.bytedance.btrace:rhea-precise-instrumentation
btrace is a high performance Android trace tool which is based on Perfetto.
- Homepage: https://github.com/bytedance/btrace
- Documentation: https://appdoc.app/artifact/com.bytedance.btrace/rhea-precise-instrumentation/
- License: Apache 2 license
-
Latest release: 2.0.2
published almost 3 years ago
Rankings
repo1.maven.org: com.bytedance.btrace:rhea-build-common
btrace is a high performance Android trace tool which is based on Perfetto.
- Homepage: https://github.com/bytedance/btrace
- Documentation: https://appdoc.app/artifact/com.bytedance.btrace/rhea-build-common/
- License: Apache 2 license
-
Latest release: 2.0.2
published almost 3 years ago
Rankings
repo1.maven.org: com.bytedance.btrace:rhea-inhouse
btrace is a high performance Android trace tool which is based on Perfetto.
- Homepage: https://github.com/bytedance/btrace
- Documentation: https://appdoc.app/artifact/com.bytedance.btrace/rhea-inhouse/
- License: Apache 2 license
-
Latest release: 3.0.0
published about 1 year ago
Rankings
repo1.maven.org: com.bytedance.btrace:rhea-inhouse-noop
btrace is a high performance Android trace tool which is based on Perfetto.
- Homepage: https://github.com/bytedance/btrace
- Documentation: https://appdoc.app/artifact/com.bytedance.btrace/rhea-inhouse-noop/
- License: Apache 2 license
-
Latest release: 3.0.0
published about 1 year ago
Rankings
Dependencies
- androidx.appcompat:appcompat 1.2.0 implementation
- androidx.constraintlayout:constraintlayout 2.0.4 implementation
- androidx.core:core-ktx 1.3.2 implementation
- androidx.navigation:navigation-fragment-ktx 2.3.2 implementation
- androidx.navigation:navigation-ui-ktx 2.3.2 implementation
- com.google.android.material:material 1.2.1 implementation
- org.jetbrains.kotlin:kotlin-stdlib $kotlin_version implementation
- junit:junit 4.13.2 testImplementation
- androidx.annotation:annotation 1.2.0 implementation
- com.bytedance:bytehook 1.0.3 implementation
- androidx.core:core 1.3.2 implementation
- com.android.tools.build:gradle $agp_version compileOnly
- org.jetbrains.kotlin:kotlin-stdlib $kotlin_version implementation
- org.jetbrains.kotlin:kotlin-stdlib $kotlin_version implementation