summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2017-11-09 15:52:06 -0800
committerYabin Cui <yabinc@google.com>2017-11-09 17:17:58 -0800
commit4568bffc2c89958d3d56b7e5762c14267098d4ee (patch)
tree4c7640bfe5103880b95eac5f7db6de97d4b7a9a8
parent310c03406a502a847b961eb56a7492229b7940cb (diff)
downloadextras-4568bffc2c89958d3d56b7e5762c14267098d4ee.tar.gz
simpleperf: update demo document to use report_html.py.
Bug: http://b/69128787 Test: none. Change-Id: Ie120103db3bcd095687c2ecc9e9273988d05bac9
-rw-r--r--simpleperf/demo/README.md104
1 files changed, 51 insertions, 53 deletions
diff --git a/simpleperf/demo/README.md b/simpleperf/demo/README.md
index 2c5f2b3f..2a293c58 100644
--- a/simpleperf/demo/README.md
+++ b/simpleperf/demo/README.md
@@ -10,7 +10,7 @@
## Introduction
Simpleperf is a native profiler used on Android platform. It can be used to profile Android
-applications. It's document is at [here](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/doc/README.md).
+applications. Its documentation is [here](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/doc/README.md).
Instructions of preparing your Android application for profiling are [here](https://android.googlesource.com/platform/system/extras/+/master/simpleperf/doc/README.md#Android-application-profiling).
This directory is to show examples of using simpleperf to profile Android applications. The
meaning of each directory is as below:
@@ -22,20 +22,30 @@ meaning of each directory is as below:
It can be downloaded as below:
- $ git clone https://android.googlesource.com/platform/system/extras
- $ cd extras/simpleperf/demo
+```sh
+$ git clone https://android.googlesource.com/platform/system/extras
+$ cd extras/simpleperf/demo
+```
+
+The testing environment:
+
+```
+Android Studio 3.0
+test device: Android O (Google Pixel 2)
+test device: Android N (Google Nexus 6P)
+Please make sure your device having Android version >= N.
+```
-## Profiling Java application
+## Profile a Java application
- Android Studio project: SimpleExamplePureJava
- test device: Android O (Google Pixel XL)
- test device: Android N (Google Nexus 5X)
+Android Studio project: SimpleExamplePureJava
steps:
-1. Build and install app:
-```
+1. Build and install the application:
+
+```sh
# Open SimpleperfExamplesPureJava project with Android Studio,
-# and build this project sucessfully, otherwise the `./gradlew` command below will fail.
+# and build this project successfully, otherwise the `./gradlew` command below will fail.
$ cd SimpleperfExamplePureJava
# On windows, use "gradlew" instead.
@@ -44,32 +54,28 @@ $ adb install -r app/build/outputs/apk/app-profiling.apk
```
2. Record profiling data:
-```
+
+```sh
$ cd ../../scripts/
+# app_profiler.py collects profiling data in perf.data, and binaries on device in binary_cache/.
$ python app_profiler.py -p com.example.simpleperf.simpleperfexamplepurejava
```
3. Show profiling data:
-```
-a. show call graph in txt mode
- $ python report.py -g | more
-b. show call graph in gui mode
- $ python report.py -g --gui
-c. show samples in source code
- $ python annotate.py -s ../demo/SimpleperfExamplePureJava
- $ find annotated_files -name "MainActivity.java"
- check the annoated source file MainActivity.java.
+
+```sh
+# report_html.py generates profiling result in report.html.
+$ python report_html.py --add_source_code --source_dirs ../demo --add_disassembly
```
-## Profiling Java/C++ application
+## Profile a Java/C++ application
- Android Studio project: SimpleExampleWithNative
- test device: Android O (Google Pixel XL)
- test device: Android N (Google Nexus 5X)
+Android Studio project: SimpleExampleWithNative
steps:
-1. Build and install app:
-```
+1. Build and install the application:
+
+```sh
# Open SimpleperfExamplesWithNative project with Android Studio,
# and build this project sucessfully, otherwise the `./gradlew` command below will fail.
$ cd SimpleperfExampleWithNative
@@ -80,33 +86,28 @@ $ adb install -r app/build/outputs/apk/profiling/app-profiling.apk
```
2. Record profiling data:
-```
+
+```sh
$ cd ../../scripts/
+# app_profiler.py collects profiling data in perf.data, and binaries on device in binary_cache/.
$ python app_profiler.py -p com.example.simpleperf.simpleperfexamplewithnative
- It runs the application and collects profiling data in perf.data, binaries on device in binary_cache/.
```
3. Show profiling data:
-```
-a. show call graph in txt mode
- $ python report.py -g | more
-b. show call graph in gui mode
- $ python report.py -g --gui
-c. show samples in source code
- $ python annotate.py -s ../demo/SimpleperfExampleWithNative
- $ find annotated_files -name "native-lib.cpp"
- check the annoated source file native-lib.cpp.
+
+```sh
+# report_html.py generates profiling result in report.html.
+$ python report_html.py --add_source_code --source_dirs ../demo --add_disassembly
```
-## Profiling Kotlin application
+## Profile a Kotlin application
- Android Studio project: SimpleExampleOfKotlin
- test device: Android O (Google Pixel XL)
- test device: Android N (Google Nexus 5X)
+Android Studio project: SimpleExampleOfKotlin
steps:
-1. Build and install app:
-```
+1. Build and install the application:
+
+```sh
# Open SimpleperfExamplesOfKotlin project with Android Studio,
# and build this project sucessfully, otherwise the `./gradlew` command below will fail.
$ cd SimpleperfExampleOfKotlin
@@ -117,19 +118,16 @@ $ adb install -r app/build/outputs/apk/profiling/app-profiling.apk
```
2. Record profiling data:
-```
+
+```sh
$ cd ../../scripts/
+# app_profiler.py collects profiling data in perf.data, and binaries on device in binary_cache/.
$ python app_profiler.py -p com.example.simpleperf.simpleperfexampleofkotlin
- It runs the application and collects profiling data in perf.data, binaries on device in binary_cache/.
```
3. Show profiling data:
-```
-a. show call graph in txt mode
- $ python report.py -g | more
-b. show call graph in gui mode
- $ python report.py -g --gui
-c. show samples in source code
- $ python annotate.py -s ../demo/SimpleperfExampleOfKotlin
- $ find . -name "MainActivity.kt"
+
+```sh
+# report_html.py generates profiling result in report.html.
+$ python report_html.py --add_source_code --source_dirs ../demo --add_disassembly
```