Files
eden-sim/contrib/trace/model/gantt-trace.h

87 lines
2.3 KiB
C
Raw Normal View History

2025-12-01 15:56:02 +01:00
#ifndef GANTT_TRACE_H
#define GANTT_TRACE_H
#include "ns3/object.h"
#include "ns3/config.h"
#include "ns3/log.h"
#include "ns3/net-device.h"
#include "ns3/node-list.h"
#include "ns3/nstime.h"
#include "ns3/ptr.h"
#include "ns3/simulator.h"
#include <cstdio>
#include <string>
// Add a doxygen group for this module.
// If you have more than one file, this should be in only one of them.
/**
* \defgroup gantt-trace Description of the gantt-trace
*/
namespace ns3
{
class GanttTrace : public Object
{
public:
/**
* \brief Constructor
* \param filename The Filename for the trace file used by the Animator
*
*/
GanttTrace(const std::string filename);
/**
* \brief Destructor for the animator interface.
*
*/
~GanttTrace();
void StartGantt();
void StopGantt();
private:
void SetOutputFile(const std::string& fn);
void ConnectCallbacks();
void DevTxTrace(std::string context,
Ptr<const Packet> p,
Ptr<NetDevice> tx,
Ptr<NetDevice> rx,
Time txTime,
Time rxTime);
void FifoEntryTrace(std::string context,
Ptr<const Packet> p,
Ptr<NetDevice> net);
void WritePacketTxEvent(std::string srcNetDeviceName,
std::string dstNetDeviceName,
Time txBeginTime,
Time txEndTime,
Time rxBeginTime,
Time rxEndTime,
int pktId,
int vlanId,
int prio);
void WriteFifoEnterEvent(Time t,
std::string netDeviceName,
int pktId,
int fifoId);
int WriteN(const std::string& st, FILE* f);
int WriteN(const char* data, uint32_t count, FILE* f);
std::string GetPacketMetadata(Ptr<const Packet> p);
std::string m_outputFileName;
FILE* m_f;
};
}
#endif /* GANTT_TRACE_H */