PFPObserver.h
Go to the documentation of this file.
1 /*
2  * PFPSim: Library for the Programmable Forwarding Plane Simulation Framework
3  *
4  * Copyright (C) 2016 Concordia Univ., Montreal
5  * Samar Abdi
6  * Umair Aftab
7  * Gordon Bailey
8  * Faras Dewal
9  * Shafigh Parsazad
10  * Eric Tremblay
11  *
12  * Copyright (C) 2016 Ericsson
13  * Bochra Boughzala
14  *
15  * This program is free software; you can redistribute it and/or
16  * modify it under the terms of the GNU General Public License
17  * as published by the Free Software Foundation; either version 2
18  * of the License, or (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23  * GNU General Public License for more details.
24  *
25  * You should have received a copy of the GNU General Public License
26  * along with this program; if not, write to the Free Software
27  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
28  * 02110-1301, USA.
29  */
30 
42 #ifndef CORE_PFPOBSERVER_H_
43 #define CORE_PFPOBSERVER_H_
44 
45 #include <string>
46 #include <memory>
47 
48 namespace pfp {
49 namespace core {
50 
51 class PFPObserver {
52  public:
59  virtual void counter_added(const std::string& module_name,
60  const std::string& counter_name,
61  double simulation_time = 0) = 0;
62 
69  virtual void counter_removed(const std::string& module_name,
70  const std::string& counter_name,
71  double simulation_time = 0) = 0;
72 
80  virtual void counter_updated(const std::string& module_name,
81  const std::string& counter_name,
82  std::size_t new_value,
83  double simulation_time) = 0;
84 
91  virtual void data_written(const std::string& from_module,
92  const std::shared_ptr<pfp::core::TrType> data,
93  double simulation_time) = 0;
94 
101  virtual void data_read(const std::string& to_module,
102  const std::shared_ptr<pfp::core::TrType> data,
103  double simulation_time) = 0;
104 
111  virtual void data_dropped(const std::string& in_module,
112  const std::shared_ptr<pfp::core::TrType> data,
113  const std::string& drop_reason,
114  double simulation_time) = 0;
115 
123  virtual void thread_begin(const std::string& teu_mod,
124  const std::string& tec_mod,
125  std::size_t thread_id,
126  std::size_t packet_id,
127  double simulation_time) = 0;
128 
136  virtual void thread_end(const std::string& teu_mod,
137  const std::string& tec_mod,
138  std::size_t thread_id,
139  std::size_t packet_id,
140  double simulation_time) = 0;
141 
149  virtual void thread_idle(const std::string& teu_mod,
150  const std::string& tec_mod,
151  std::size_t thread_id,
152  std::size_t packet_id,
153  double simulation_time) = 0;
154 
155  virtual void core_busy(const std::string& teu_mod,
156  const std::string& tec_mod,
157  double simulation_time) = 0;
158 
159  virtual void core_idle(const std::string& teu_mod,
160  const std::string& tec_mod,
161  double simulation_time) = 0;
162 
163  protected:
167  virtual ~PFPObserver() = default;
168 };
169 }; // namespace core
170 }; // namespace pfp
171 #endif // CORE_PFPOBSERVER_H_
virtual void data_written(const std::string &from_module, const std::shared_ptr< pfp::core::TrType > data, double simulation_time)=0
Function called by the NPU when data is written by a module.
virtual void data_read(const std::string &to_module, const std::shared_ptr< pfp::core::TrType > data, double simulation_time)=0
Function called by the NPU when data is read by a module.
virtual void data_dropped(const std::string &in_module, const std::shared_ptr< pfp::core::TrType > data, const std::string &drop_reason, double simulation_time)=0
Function called by the NPU when data is dropped in a module.
Definition: PFPObserver.h:51
virtual void counter_updated(const std::string &module_name, const std::string &counter_name, std::size_t new_value, double simulation_time)=0
Function called by the NPU when a counter is updated.
virtual void counter_removed(const std::string &module_name, const std::string &counter_name, double simulation_time=0)=0
Function called by the NPU when a counter is removed from a module.
virtual void counter_added(const std::string &module_name, const std::string &counter_name, double simulation_time=0)=0
Function called by the NPU when a counter is added to a module.
virtual void thread_idle(const std::string &teu_mod, const std::string &tec_mod, std::size_t thread_id, std::size_t packet_id, double simulation_time)=0
Function called by the NPU when a TEU thread starts idling.
virtual ~PFPObserver()=default
Default destructor.
virtual void thread_end(const std::string &teu_mod, const std::string &tec_mod, std::size_t thread_id, std::size_t packet_id, double simulation_time)=0
Function called by the NPU when a TEU thread ends.
virtual void thread_begin(const std::string &teu_mod, const std::string &tec_mod, std::size_t thread_id, std::size_t packet_id, double simulation_time)=0
Function called by the NPU when a TEU thread begins.
PacketBase.h.
Definition: ConfigurationParameters.cpp:36