-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'time-logging' into scene-refactor-base
- Loading branch information
Showing
11 changed files
with
204 additions
and
8 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
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
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
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
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
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
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,57 @@ | ||
|
||
// Set when building only part of the abis in the apk. | ||
def abiFiltersForWrapScript = [] | ||
|
||
android { | ||
buildTypes { | ||
profiling { | ||
initWith debug | ||
externalNativeBuild { | ||
cmake { | ||
// cmake Debug build type uses -O0, which makes the code slow. | ||
arguments "-DCMAKE_BUILD_TYPE=Release" | ||
} | ||
} | ||
packagingOptions { | ||
// Exclude wrap.sh for architectures not built. | ||
if (abiFiltersForWrapScript) { | ||
def exclude_abis = ["armeabi", "armeabi-v7a", "arm64-v8a", | ||
"x86", "x86_64", "mips", "mips64"] | ||
.findAll{ !(it in abiFiltersForWrapScript) } | ||
.collect{ "**/" + it + "/wrap.sh" } | ||
excludes += exclude_abis | ||
} | ||
} | ||
|
||
// Add lib/xxx/wrap.sh in the apk. This is to enable java profiling on Android O | ||
// devices. | ||
sourceSets { | ||
profiling { | ||
resources { | ||
srcDir { | ||
"profiling_apk_add_dir" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def writeWrapScriptToFullyCompileJavaApp(wrapFile) { | ||
wrapFile.withWriter { writer -> | ||
writer.write('#!/system/bin/sh\n') | ||
writer.write('\$@\n') | ||
} | ||
} | ||
|
||
task createProfilingApkAddDir { | ||
for (String abi : ["armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64", "mips", "mips64"]) { | ||
def dir = new File("app/profiling_apk_add_dir/lib/" + abi) | ||
dir.mkdirs() | ||
def wrapFile = new File(dir, "wrap.sh") | ||
writeWrapScriptToFullyCompileJavaApp(wrapFile) | ||
println "write file " + wrapFile.path | ||
} | ||
} | ||
|
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 @@ | ||
# Android | ||
|
||
- https://android.googlesource.com/platform/system/extras/+/master/simpleperf/doc/ | ||
- https://android.googlesource.com/platform/system/extras/+/master/simpleperf/demo/README.md#profiling-javac-application | ||
|
||
## Studio | ||
|
||
- Run 'Profile selected configuration' | ||
- Click CPU row | ||
- Select 'Sampled (Native)' | ||
- Click 'Record a method trace', right next to it | ||
- Select thread of interest to show Call-/Flame-chart |
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
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,58 @@ | ||
|
||
// Set when building only part of the abis in the apk. | ||
def abiFiltersForWrapScript = [] | ||
|
||
android { | ||
buildTypes { | ||
profiling { | ||
initWith debug | ||
externalNativeBuild { | ||
cmake { | ||
// cmake Debug build type uses -O0, which makes the code slow. | ||
arguments "-DCMAKE_BUILD_TYPE=Release" | ||
cppFlags '-fno-omit-frame-pointer' | ||
} | ||
} | ||
packagingOptions { | ||
// Exclude wrap.sh for architectures not built. | ||
if (abiFiltersForWrapScript) { | ||
def exclude_abis = ["armeabi", "armeabi-v7a", "arm64-v8a", | ||
"x86", "x86_64", "mips", "mips64"] | ||
.findAll{ !(it in abiFiltersForWrapScript) } | ||
.collect{ "**/" + it + "/wrap.sh" } | ||
excludes += exclude_abis | ||
} | ||
} | ||
|
||
// Add lib/xxx/wrap.sh in the apk. This is to enable java profiling on Android O | ||
// devices. | ||
sourceSets { | ||
profiling { | ||
resources { | ||
srcDir { | ||
"profiling_apk_add_dir" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
def writeWrapScriptToFullyCompileJavaApp(wrapFile) { | ||
wrapFile.withWriter { writer -> | ||
writer.write('#!/system/bin/sh\n') | ||
writer.write('\$@\n') | ||
} | ||
} | ||
|
||
task createProfilingApkAddDir { | ||
for (String abi : ["armeabi", "armeabi-v7a", "arm64-v8a", "x86", "x86_64", "mips", "mips64"]) { | ||
def dir = new File("app/profiling_apk_add_dir/lib/" + abi) | ||
dir.mkdirs() | ||
def wrapFile = new File(dir, "wrap.sh") | ||
writeWrapScriptToFullyCompileJavaApp(wrapFile) | ||
println "write file " + wrapFile.path | ||
} | ||
} | ||
|
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