2 * Copyright (C) 2015 The Android Open Source Project
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef SIMPLE_PERF_WORKLOAD_H_
18 #define SIMPLE_PERF_WORKLOAD_H_
20 #include <sys/types.h>
25 #include <android-base/macros.h>
30 NotYetCreateNewProcess,
31 NotYetStartNewProcess,
36 static std::unique_ptr<Workload> CreateWorkload(const std::vector<std::string>& args);
46 Workload(const std::vector<std::string>& args)
47 : work_state_(NotYetCreateNewProcess),
54 bool CreateNewProcess();
55 bool WaitChildProcess(bool wait_forever);
57 WorkState work_state_;
58 std::vector<std::string> args_;
60 int start_signal_fd_; // The parent process writes 1 to start workload in the child process.
61 int exec_child_fd_; // The child process writes 1 to notify that execvp() failed.
63 DISALLOW_COPY_AND_ASSIGN(Workload);
66 #endif // SIMPLE_PERF_WORKLOAD_H_