44 for(
const auto & msg : msgs)
46 clones.push_back(msg->clone());
69 "SHIM %03hu TimingAnalysis::ShimLayer::%s",
78 "Max size of the delta time storage queue.");
86 "SHIM %03hu TimingAnalysis::ShimLayer::%s",
90 for(
const auto & item : update)
92 if(item.first ==
"maxqueuesize")
94 u32MaxQueueSize_ = item.second[0].asUINT32();
98 "SHIM %03hu TimingAnalysis::ShimLayer::%s,%s = %u",
106 throw makeException<ConfigureException>(
"TimingAnalysis::ShimLayer: " 107 "Unexpected configuration item %s",
118 "SHIM %03hu TimingAnalysis::ShimLayer::%s",
127 "SHIM %03hu TimingAnalysis::ShimLayer::%s",
131 char filename[256] = {0};
135 sprintf(filename,
"/tmp/timinganalysis%hu.txt",id_);
137 FILE *fp{fopen(filename,
"w")};
141 while(!queue_.empty())
143 entry = queue_.front();
145 fprintf(fp,
"%hu %hu %f %f\n",
148 std::chrono::duration_cast<DoubleSeconds>(entry.txTime.time_since_epoch()).count(),
149 std::chrono::duration_cast<
DoubleSeconds>(entry.rxTime.time_since_epoch()).count());
160 "SHIM %03hu TimingAnalysis::ShimLayer::%s: Can't open file (%s)",
173 "SHIM %03hu TimingAnalysis::ShimLayer::%s",
183 "SHIM %03hu TimingAnalysis::ShimLayer::%s",
195 "SHIM %03hu TimingAnalysis::ShimLayer::%s",
210 if(len && pkt.
length() >= len)
218 entry.txTime = shimHeader.getTxTime();
220 entry.u16Source = shimHeader.getSource();
222 entry.u16PacketId = shimHeader.getPacketId();
224 entry.rxTime = beginTime;
228 "SHIM %03hu TimingAnalysis::ShimLayer::%s " 229 "Src: %hu PktID: %hu TxTime: %f RxTime: %f, deltaT %f sec",
234 std::chrono::duration_cast<
DoubleSeconds>(entry.txTime.time_since_epoch()).count(),
235 std::chrono::duration_cast<
DoubleSeconds>(entry.rxTime.time_since_epoch()).count(),
236 std::chrono::duration_cast<
DoubleSeconds>(entry.rxTime - entry.txTime).count());
238 if(u32MaxQueueSize_ != 0)
240 if(queue_.size() >= u32MaxQueueSize_)
263 pkt.
prepend(serialization.c_str(), serialization.size());
270 "SHIM %03hu TimingAnalysis::ShimLayer::%s",
std::string Serialization
A Packet class that allows upstream processing to strip layer headers as the packet travels up the st...
The Registrar interface provides access to all of the emulator registrars.
ShimLayer(NEMId id, PlatformServiceProvider *pPlatformService, RadioServiceProvider *pRadioServiceProvider)
virtual ConfigurationRegistrar & configurationRegistrar()=0
#define LOGGER_VERBOSE_LOGGING(logger, level, fmt, args...)
void initialize(Registrar ®istrar) override
std::list< const ControlMessage * > ControlMessages
DECLARE_SHIM_LAYER(EMANE::Models::TimingAnalysis::ShimLayer)
void processDownstreamPacket(DownstreamPacket &pkt, const ControlMessages &msgs) override
std::uint16_t stripLengthPrefixFraming()
void sendDownstreamControl(const ControlMessages &msgs)
size_t strip(size_t size)
void prepend(const void *buf, size_t size)
Interface used to create a Shim layer plugin implementation.
Specialized packet the allows downstream processing to add layer specific headers as the packet trave...
void processUpstreamPacket(UpstreamPacket &pkt, const ControlMessages &msgs) override
std::chrono::duration< double > DoubleSeconds
void configure(const ConfigurationUpdate &update) override
The RadioServiceProvider interface provides access to radio (RF) model specific services.
void sendUpstreamControl(const ControlMessages &msgs)
void processDownstreamControl(const ControlMessages &msgs) override
Shim class that produces latency numbers from one Shim Layer to another.
std::vector< ConfigurationNameAnyValues > ConfigurationUpdate
void registerNumeric(const std::string &sName, const ConfigurationProperties &properties=ConfigurationProperties::NONE, const std::initializer_list< T > &values={}, const std::string &sUsage="", T minValue=std::numeric_limits< T >::lowest(), T maxValue=std::numeric_limits< T >::max(), std::size_t minOccurs=1, std::size_t maxOccurs=1, const std::string &sRegexPattern={})
Clock::time_point TimePoint
void processUpstreamControl(const ControlMessages &msgs) override
void sendUpstreamPacket(UpstreamPacket &pkt, const ControlMessages &msgs=empty)
void prependLengthPrefixFraming(std::uint16_t u16Length)
#define LOGGER_STANDARD_LOGGING(logger, level, fmt, args...)
void sendDownstreamPacket(DownstreamPacket &pkt, const ControlMessages &msgs=empty)