DebuggerPacket.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 
39 #ifndef CORE_DEBUGGER_DEBUGGERPACKET_H_
40 #define CORE_DEBUGGER_DEBUGGERPACKET_H_
41 
42 #include <string>
43 #include <vector>
44 
45 namespace pfp {
46 namespace core {
47 namespace db {
48 
53  public:
58  public:
59  PacketLocation(): module(""), read_time(-1), write_time(-1) {}
60 
61  std::string module;
62  double read_time;
63  double write_time;
64  };
65 
70 
77  DebuggerPacket(int id, std::string location, double time_ns);
78 
84  void updateTraceReadTime(std::string mod, double rtime);
85 
91  void updateTraceWriteTime(std::string mod, double wtime);
92 
97  int getID() const;
98 
103  std::string getLocation() const;
104 
109  double getTime() const;
110 
115  std::vector<PacketLocation> getTrace() const;
116 
121  void setCurrentLocation(std::string loc);
122 
127  void setTime(double t);
128 
129  private:
130  int packet_id;
131  std::string current_location;
132  double last_notify_time;
133  std::vector<PacketLocation> trace;
134 };
135 
136 }; // namespace db
137 }; // namespace core
138 }; // namespace pfp
139 
140 #endif // CORE_DEBUGGER_DEBUGGERPACKET_H_
void setCurrentLocation(std::string loc)
Set the current location of the packet.
Definition: DebuggerPacket.cpp:80
Class representation of a packet for pfpdb.
Definition: DebuggerPacket.h:52
std::vector< PacketLocation > getTrace() const
Get backtrace of the packet.
Definition: DebuggerPacket.cpp:76
DebuggerPacket()
Empty Constructor.
Definition: DebuggerPacket.cpp:39
void updateTraceWriteTime(std::string mod, double wtime)
Update the time at which the packet left a module.
Definition: DebuggerPacket.cpp:51
void setTime(double t)
Set the current time of the packet.
Definition: DebuggerPacket.cpp:84
int getID() const
Get the packet ID.
Definition: DebuggerPacket.cpp:64
std::string getLocation() const
Get current packet location (which module the packet is in).
Definition: DebuggerPacket.cpp:68
Data structure to represent the location of a packet as well as the times at which it entered and lef...
Definition: DebuggerPacket.h:57
void updateTraceReadTime(std::string mod, double rtime)
Update the time at which the packet entered a module.
Definition: DebuggerPacket.cpp:44
PacketBase.h.
Definition: ConfigurationParameters.cpp:36
double getTime() const
Get the time of the last update (read or write) to this packet.
Definition: DebuggerPacket.cpp:72