aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Wailes <chriswailes@google.com>2018-10-11 12:49:19 -0700
committerChris Wailes <chriswailes@google.com>2018-10-11 14:54:11 -0700
commit1c177ba1bef609d77ef07aa0bbc5f0249ea47a1b (patch)
tree5b430d73635fb9db39e49556053b12be4c5e4d96
parent9f4f62bc83461131fd0697da56db22ae13b221e4 (diff)
downloadplatform_tools_trebuchet-1c177ba1bef609d77ef07aa0bbc5f0249ea47a1b.tar.gz
platform_tools_trebuchet-1c177ba1bef609d77ef07aa0bbc5f0249ea47a1b.tar.bz2
platform_tools_trebuchet-1c177ba1bef609d77ef07aa0bbc5f0249ea47a1b.zip
Updated the build system and delt with warnings.
* Added an Android build system rule for StartupSummarizerKt * Updated the README.md file * Re-factored some code to eliminate a few warnings Test: Built and ran StartupSummarizerKt Change-Id: I7c64128f99f5bc5f3450b5a26a4c14ac4aeceee4
-rw-r--r--Android.bp13
-rw-r--r--README.md24
-rw-r--r--core/common/src/main/kotlin/trebuchet/task/ImportTask.kt4
-rw-r--r--trebuchet/startup-summarizer/MANIFEST.mf2
4 files changed, 37 insertions, 6 deletions
diff --git a/Android.bp b/Android.bp
index 6391fa0..fd46b5b 100644
--- a/Android.bp
+++ b/Android.bp
@@ -86,6 +86,19 @@ java_binary_host {
}
java_binary_host {
+ name: "StartupSummarizerKt",
+ defaults: ["trebuchet-defaults"],
+ manifest: "trebuchet/startup-summarizer/MANIFEST.mf",
+ srcs: [
+ "trebuchet/startup-summarizer/src/**/*.kt",
+ ],
+ static_libs: [
+ "trebuchet-core",
+ "trebuchet-startup-common"
+ ],
+}
+
+java_binary_host {
name: "traceutils",
defaults: ["trebuchet-defaults"],
manifest: "trebuchet/traceutils/MANIFEST.mf",
diff --git a/README.md b/README.md
index e1b4968..b0f97aa 100644
--- a/README.md
+++ b/README.md
@@ -1,5 +1,23 @@
-Trebuchet
+# Trebuchet
-A library for parsing & analyzing atrace files.
+Trebuchet is a Kotlin library for parsing and analyzing Android trace files generated by the `atrace` or `systrace` commands. This is not an officially supported Google product.
-This is not an officially supported Google product.
+## Library
+
+The code for the Trebuchet library can be found in the `core/` directory.
+
+## Bundled Programs
+
+Trebuchet comes bundled with several programs for analyzing one or more trace files.
+
+### Startup Analyzer
+
+The Startup Analyzer program takes a trace file, detects any startup events that occurred during the traced time period, and prints information about the events. If Trebuchet is built using the Android build system, there will be a StartupAnalyzerKt program placed into a directory that is a member of the PATH system variable. If you wish to use Gradle, you can use the `startup-analyzer.sh` script located in the `scripts/` directory.
+
+### Startup Summarizer
+
+The Startup Summarizer program takes a set of trace files, detects startup events in each file, and computes average and standard deviation for startup stats, broken down by program name, compiler filter, and cache status. If Trebuchet is built using the Android build system, there will be a StartupSummarizerKt program placed into a directory that is a member of the PATH system variable. If you wish to use Gradle, you can use the `startup-summarizer.sh` script located in the `scripts/` directory.
+
+## Helper Scripts
+
+The `scripts/` directory contains a shell script called `run-startup.sh`, which will start a trace, launch an activity given a package name and an activity name, transfer the trace file to the host machine, and run the StartupAnalyzer.
diff --git a/core/common/src/main/kotlin/trebuchet/task/ImportTask.kt b/core/common/src/main/kotlin/trebuchet/task/ImportTask.kt
index 3b7df9e..dc62cc7 100644
--- a/core/common/src/main/kotlin/trebuchet/task/ImportTask.kt
+++ b/core/common/src/main/kotlin/trebuchet/task/ImportTask.kt
@@ -29,10 +29,8 @@ class ImportTask(private val importFeedback: ImportFeedback) {
private val fragments = mutableListOf<ModelFragment>()
fun import(source: BufferProducer): Model {
- var model: Model? = null
extractOrImport(source)
- model = finish()
- return model!!
+ return finish()
}
private fun extractOrImport(stream: BufferProducer) {
diff --git a/trebuchet/startup-summarizer/MANIFEST.mf b/trebuchet/startup-summarizer/MANIFEST.mf
new file mode 100644
index 0000000..c1dc614
--- /dev/null
+++ b/trebuchet/startup-summarizer/MANIFEST.mf
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+Main-Class: StartupSummarizerKt