diff options
author | Yabin Cui <yabinc@google.com> | 2019-02-25 15:22:43 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2019-02-28 13:50:41 -0800 |
commit | 1befe4fd62dffee1e9a9d19549d18e8604c726e2 (patch) | |
tree | 9369ff7c55379233a8982cab212c81af73662720 /simpleperf/environment.cpp | |
parent | c65e54940b4b7350cc4a2f72e2f2190269909ec5 (diff) | |
download | extras-1befe4fd62dffee1e9a9d19549d18e8604c726e2.tar.gz |
simpleperf: make app api available for profileable apps.
Add api-prepare cmd to prepare recording via app api.
Add api-collect cmd to collect recording data generated by app api. The
recording data is compressed into a zip file.
The two added cmds support both debuggable apps and profileable apps.
Move api_app_profiler.py to api_profiler.py. And use the two added cmds in it.
Also improve app_api code:
1. Fix finding simpleperf.
2. Use time based output filenames.
Bug: 123717243
Test: test manually, will add run python tests later.
Change-Id: I88c20578d01a84bc20ea72276f2cab0f3c4d9109
Diffstat (limited to 'simpleperf/environment.cpp')
-rw-r--r-- | simpleperf/environment.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/simpleperf/environment.cpp b/simpleperf/environment.cpp index e82162b5..3591626e 100644 --- a/simpleperf/environment.cpp +++ b/simpleperf/environment.cpp @@ -623,6 +623,10 @@ std::set<pid_t> WaitForAppProcesses(const std::string& package_name) { } } +bool IsAppDebuggable(const std::string& package_name) { + return Workload::RunCmd({"run-as", package_name, "echo", ">/dev/null", "2>/dev/null"}, false); +} + namespace { class InAppRunner { @@ -767,7 +771,7 @@ class RunAs : public InAppRunner { bool RunAs::Prepare() { // Test if run-as can access the package. - if (!Workload::RunCmd({"run-as", package_name_, "echo", ">/dev/null", "2>/dev/null"}, false)) { + if (!IsAppDebuggable(package_name_)) { return false; } // run-as can't run /data/local/tmp/simpleperf directly. So copy simpleperf binary if needed. |