diff options
author | Yabin Cui <yabinc@google.com> | 2016-11-29 15:21:13 -0800 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2016-11-29 15:21:13 -0800 |
commit | 5be914df7e842a052219a6ef4891ff3208373fc3 (patch) | |
tree | 4aa0c8e5b94d2cdd1e4dfa2caa7420cead3239ee /simpleperf/workload.h | |
parent | c11a58e7013e0f8cc59eb6eb02fe3366e625665a (diff) | |
download | extras-5be914df7e842a052219a6ef4891ff3208373fc3.tar.gz |
simpleperf: fix tests for dwarf callgraph unwinding.
32-bit simpleperf can't unwind a 64-bit `sleep` process in aarch64
environment. It makes following error in tests:
simpleperf is built in arch arm, and can't do stack unwinding for arch arm64
So make the workload be able to start a process
running callback function. By profiling that process, we can
guarantee that 32-bit simpleperf is profiling a 32-bit process.
Also fix a flaky test IOEventLoop.signal.
Build 32-bit simpleperf_unit_test on 64-bit devices.
Bug: http://b/33167911
Test: run simpleperf_unit_test.
Change-Id: I82741dc5d90c73c1890f834d8e2a9188421a3828
Diffstat (limited to 'simpleperf/workload.h')
-rw-r--r-- | simpleperf/workload.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/simpleperf/workload.h b/simpleperf/workload.h index fa754b5a..2141830f 100644 --- a/simpleperf/workload.h +++ b/simpleperf/workload.h @@ -19,6 +19,7 @@ #include <sys/types.h> #include <chrono> +#include <functional> #include <string> #include <vector> @@ -34,6 +35,7 @@ class Workload { public: static std::unique_ptr<Workload> CreateWorkload(const std::vector<std::string>& args); + static std::unique_ptr<Workload> CreateWorkload(const std::function<void ()>& function); ~Workload(); @@ -43,19 +45,24 @@ class Workload { } private: - explicit Workload(const std::vector<std::string>& args) + explicit Workload(const std::vector<std::string>& args, + const std::function<void ()>& function) : work_state_(NotYetCreateNewProcess), - args_(args), + child_proc_args_(args), + child_proc_function_(function), work_pid_(-1), start_signal_fd_(-1), exec_child_fd_(-1) { } bool CreateNewProcess(); + void ChildProcessFn(int start_signal_fd, int exec_child_fd); bool WaitChildProcess(bool wait_forever, bool is_child_killed); WorkState work_state_; - std::vector<std::string> args_; + // The child process either executes child_proc_args or run child_proc_function. + std::vector<std::string> child_proc_args_; + std::function<void ()> child_proc_function_; pid_t work_pid_; int start_signal_fd_; // The parent process writes 1 to start workload in the child process. int exec_child_fd_; // The child process writes 1 to notify that execvp() failed. |