Packet Delay using Echo Application

853 views
Skip to first unread message

tomh...@mac.com

unread,
Nov 16, 2008, 6:40:14 AM11/16/08
to ns-3-users
Hi,

I am trying to calculate the delay across the MAC layer (how long
between enqueue and transmission, due to busy MAC), using the echo
application for adhoc wifi nodes. Having looked through the
documentation ad doxygen, I can not see how to get this data out.

Will I need to add a trace source to the wifi-net-device code to
timestamp the Rx and Tx logger functions, or is there an easier way?

I did see the jitter/delay code (delay-jitter-estimation) but am
unsure of how to implement this.

Any help greatly appreciated.

Thanks,

Tom.

Tom Henderson

unread,
Nov 17, 2008, 6:48:14 PM11/17/08
to ns-3-...@googlegroups.com

Hi Tom,
I'm not familiar with the Wifi NetDevice in detail, but I suggest that
you start by looking at two existing trace points:

.AddTraceSource ("Tx", "Send payload to the MAC layer.",
MakeTraceSourceAccessor (&WifiNetDevice::m_txLogger))


.AddTraceSource ("Tx", "Packet transmission is starting.",
MakeTraceSourceAccessor (&WifiPhy::m_txTrace))


If these two trace points bound the points in the model across which you
are trying to measure latency, then you could hook trace sinks to get
the packets, and print out tuples such as (timestamp, packet id) for
each one, and then later post-process by lining up packet ids from the
later phy trace with the mac trace. There are probably more
sophisticated ways to do the above latency estimation directly without
post-processing steps, but hopefully you get the idea.

If the above are not the right trace points for you, you could clone one
of the above and put it at the place where you want to trace.

- Tom

tomh...@mac.com

unread,
Nov 18, 2008, 6:23:13 AM11/18/08
to ns-3-users
Thanks Tom. The problem I'm hitting when trying to hook into those
trace sources, is the compiler complains they are private. Perhaps I'm
not hooking in correctly:

void
NetDevTxLog (std::string netDevTxTime, Ptr<const WifiNetDevice>
txLog)
{
double netDevTx = txLog->WifiNetDevice::m_txLogger ();
NS_LOG_UNCOND (netDevTxTime << "Net Device Sending Payload to MAC = "
<< txLog);
}

I must admit to being a recent convert from NS-2, so may be at fault
with my understanding of hooks.

Many thanks,

Tom.

On Nov 17, 11:48 pm, Tom Henderson <t...@tomh.org> wrote:
> TomHe...@mac.com wrote:
> > Hi,
>
> > I am trying to calculate the delay across the MAC layer (how long
> > between enqueue and transmission, due to busy MAC), using the echo
> > application for adhoc wifi nodes.  Having looked through the
> > documentation ad doxygen, I can not see how to get this data out.
>
> > Will I need to add a trace source to the wifi-net-device code to
> > timestamp the Rx and Tx logger functions, or is there an easier way?
>
> > I did see the jitter/delay code (delay-jitter-estimation) but am
> > unsure of how to implement this.
>
> > Any help greatly appreciated.
>
> > Thanks,
>
> > Tom.
>
> Hi Tom,
> I'm not familiar with the Wifi NetDevice in detail, but I suggest that
> you start by looking at two existing trace points:
>
>      .AddTraceSource ("Tx", "Send payload to the MAC layer.",
>                       MakeTraceSourceAccessor (&WifiNetDevice::m_txLogger))
>
>      .AddTraceSource ("Tx", "Packet transmission is starting.",
>                       MakeTraceSourceAccessor (&WifiPhy::m_txTrace))
>
> If these two trace points bound the points in the model across which you
> are trying to measure latency, then you couldhooktrace sinks to get

Mathieu Lacage

unread,
Nov 18, 2008, 6:29:35 AM11/18/08
to ns-3-...@googlegroups.com
On Tue, 2008-11-18 at 03:23 -0800, TomH...@mac.com wrote:
> Thanks Tom. The problem I'm hitting when trying to hook into those
> trace sources, is the compiler complains they are private. Perhaps I'm
> not hooking in correctly:

indeed :)

See examples/wifi-ap.cc:
void
DevTxTrace (std::string context, Ptr<const Packet> p, Mac48Address
address)
{
std::cout << " TX to=" << address << " p: " << *p << std::endl;
}
void
DevRxTrace (std::string context, Ptr<const Packet> p, Mac48Address
address)
{
std::cout << " RX from=" << address << " p: " << *p << std::endl;
}
Config::Connect ("/NodeList/*/DeviceList/*/Tx", MakeCallback
(&DevTxTrace));
Config::Connect ("/NodeList/*/DeviceList/*/Rx", MakeCallback
(&DevRxTrace));


Mathieu

Reply all
Reply to author
Forward
0 new messages