geopm  3.1.1.dev272+gdfb40a8d
GEOPM - Global Extensible Open Power Manager
ApplicationIO.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 - 2024 Intel Corporation
3  * SPDX-License-Identifier: BSD-3-Clause
4  */
5 
6 #ifndef APPLICATIONIO_HPP_INCLUDE
7 #define APPLICATIONIO_HPP_INCLUDE
8 
9 #include <cstdint>
10 #include <set>
11 #include <string>
12 #include <memory>
13 #include <vector>
14 #include <map>
15 #include <list>
16 #include <ctime>
17 
18 #include "geopm_hint.h"
19 #include "geopm_time.h"
20 
21 namespace geopm
22 {
23  class Comm;
24  class ServiceProxy;
25 
27  {
28  public:
29  ApplicationIO() = default;
30  virtual ~ApplicationIO() = default;
33  virtual std::vector<int> connect(void) = 0;
36  virtual bool do_shutdown(void) = 0;
39  virtual std::set<std::string> region_name_set(void) const = 0;
40  };
41 
43  {
44  public:
46  ApplicationIOImp(std::shared_ptr<ServiceProxy> service_proxy,
47  const std::string &profile_name,
48  int timeout,
49  int num_proc,
50  int ctl_mode);
51  virtual ~ApplicationIOImp();
52  std::vector<int> connect(void) override;
53  bool do_shutdown(void) override;
54  std::set<std::string> region_name_set(void) const override;
55  private:
56  std::set<int> get_profile_pids(void);
57  static constexpr size_t M_SHMEM_REGION_SIZE = 2*1024*1024;
58 
59  bool m_is_connected;
60  std::shared_ptr<ServiceProxy> m_service_proxy;
61  const std::string m_profile_name;
62  const int m_timeout;
63  std::set<int> m_profile_pids;
64  int m_num_proc;
65  int m_ctl_mode;
66  };
67 }
68 
69 #endif
Definition: ApplicationIO.hpp:27
virtual bool do_shutdown(void)=0
Returns true if the application has indicated it is shutting down.
virtual std::set< std::string > region_name_set(void) const =0
Returns the set of region names recorded by the application.
virtual std::vector< int > connect(void)=0
Connect to the application via shared memory.
virtual ~ApplicationIO()=default
Definition: ApplicationIO.hpp:43
std::vector< int > connect(void) override
Connect to the application via shared memory.
Definition: ApplicationIO.cpp:53
virtual ~ApplicationIOImp()
Definition: ApplicationIO.cpp:48
bool do_shutdown(void) override
Returns true if the application has indicated it is shutting down.
Definition: ApplicationIO.cpp:111
std::set< std::string > region_name_set(void) const override
Returns the set of region names recorded by the application.
Definition: ApplicationIO.cpp:139
ApplicationIOImp()
Definition: ApplicationIO.cpp:23
Definition: Accumulator.cpp:12