Android-cuttlefish cvd tool
run_cvd_proc_collector.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2023 The Android Open Source Project
3 *
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
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
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.
15 */
16
17#pragma once
18
19#include <sys/types.h>
20
21#include <optional>
22#include <set>
23#include <string>
24#include <unordered_map>
25#include <vector>
26
28
29namespace cuttlefish {
30
32 std::string home_;
33 std::string exec_path_;
34 std::string stop_cvd_path_;
36 std::optional<std::string> android_host_out_;
37 struct InstanceInfo {
38 std::set<pid_t> pids_;
39 std::set<pid_t> parent_run_cvd_pids_;
40 std::unordered_map<std::string, std::string> envs_;
41 std::vector<std::string> cmd_args_;
42 unsigned id_;
43 };
44 // instance id to instance info mapping
45 std::unordered_map<unsigned, InstanceInfo> instances_;
46};
47
49
51
52} // namespace cuttlefish
Definition: alloc_driver.h:20
Result< std::vector< pid_t > > CollectRunCvdProcesses()
Definition: run_cvd_proc_collector.cpp:254
Result< std::vector< GroupProcInfo > > CollectRunCvdGroups()
Definition: run_cvd_proc_collector.cpp:249
tl::expected< T, StackTraceError > Result
Definition: result_type.h:30
Definition: run_cvd_proc_collector.h:37
std::vector< std::string > cmd_args_
Definition: run_cvd_proc_collector.h:41
unsigned id_
Definition: run_cvd_proc_collector.h:42
std::set< pid_t > parent_run_cvd_pids_
Definition: run_cvd_proc_collector.h:39
std::set< pid_t > pids_
Definition: run_cvd_proc_collector.h:38
std::unordered_map< std::string, std::string > envs_
Definition: run_cvd_proc_collector.h:40
Definition: run_cvd_proc_collector.h:31
std::string stop_cvd_path_
Definition: run_cvd_proc_collector.h:34
std::string exec_path_
Definition: run_cvd_proc_collector.h:33
std::optional< std::string > android_host_out_
Definition: run_cvd_proc_collector.h:36
std::string home_
Definition: run_cvd_proc_collector.h:32
std::unordered_map< unsigned, InstanceInfo > instances_
Definition: run_cvd_proc_collector.h:45
bool is_cvd_server_started_
Definition: run_cvd_proc_collector.h:35