Measuring link utilization

381 views
Skip to first unread message

Antti Mäkelä

unread,
Mar 8, 2010, 7:31:03 AM3/8/10
to ns-3-users
Hey,

Is there some easy way to obtain information on link utilization
(separately for each direction)? Obviously I can just put in a
callback for every packet received and calculate averages, but do the
PtP or Csmadevices themselves keep track of such information? The
rx_callback forwards the entire packet to the callback function which
seems a bit resource-consuming to me when all I really need is packet
size and timestamp..

(Trying to simulate some load-balancing algorithms...which would
naturally require some information to start with).

Gustavo Carneiro

unread,
Mar 8, 2010, 8:40:36 AM3/8/10
to ns-3-...@googlegroups.com
On Mon, Mar 8, 2010 at 12:31 PM, Antti Mäkelä <zar...@gmail.com> wrote:
Hey,

 Is there some easy way to obtain information on link utilization
(separately for each direction)? Obviously I can just put in a
callback for every packet received and calculate averages, but do the
PtP or Csmadevices themselves keep track of such information? The
rx_callback forwards the entire packet to the callback function which
seems a bit resource-consuming to me when all I really need is packet
size and timestamp..

Don't mess with rx_callback; it is used to forward packets up the stack. If you change it, the packet will not be forwarded up the stack.  Use tracing instead (Config::Connect or Object::TraceConnect*).

It is actually not resource consuming since only a pointer to a packet is passed around.  Only if you need to deserialize a header, then you need to make a packet copy first and then it sure is resource consuming.  But if you only need to count the packet sizes or peek the topmost header, it should be painless.
 

 (Trying to simulate some load-balancing algorithms...which would
naturally require some information to start with).

--
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To post to this group, send email to ns-3-...@googlegroups.com.
To unsubscribe from this group, send email to ns-3-users+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/ns-3-users?hl=en.




--
Gustavo J. A. M. Carneiro
INESC Porto, UTM, WiN, http://win.inescporto.pt/gjc
"The universe is always one step beyond logic." -- Frank Herbert

Antti Mäkelä

unread,
Mar 10, 2010, 3:32:18 AM3/10/10
to ns-3-users
On Mar 8, 3:40 pm, Gustavo Carneiro <gjcarne...@gmail.com> wrote:
> Don't mess with rx_callback; it is used to forward packets up the stack. If
> you change it, the packet will not be forwarded up the stack.  Use tracing
> instead (Config::Connect or Object::TraceConnect*).

Ok - I'll try with connecting MacRx trace source and see how it
goes..

Antti Mäkelä

unread,
Mar 15, 2010, 5:46:23 AM3/15/10
to ns-3-users
On Mar 8, 3:40 pm, Gustavo Carneiro <gjcarne...@gmail.com> wrote:
> Don't mess with rx_callback; it is used to forward packets up the stack. If
> you change it, the packet will not be forwarded up the stack.  Use tracing
> instead (Config::Connect or Object::TraceConnect*).
>
> It is actually not resource consuming since only a pointer to a packet is
> passed around.  Only if you need to deserialize a header, then you need to
> make a packet copy first and then it sure is resource consuming.  But if you
> only need to count the packet sizes or peek the topmost header, it should be
> painless.

Ok - only thing that is causing a bit of pain - I want to trace
utilization per link. Now, this is what contexts are for, of course.
However, since I'm going to pass that info back to the process, the
string isn't really the best format. Anyway, what this means now is
that I have to come up with a naming scheme, then do a mapping from
std::string to Ptr<NetDevice>.

Is there a way to achieve "context" with any type?

Right now I basically have

Ptr<PointToPointNetDevice> ptpnetdev (...initialization...)
ptpnetdev->TraceConnect("MacRx", Names::FindName(ptpnetdev),
MakeCallback(&Myapp::RxTracer, this));

and an

void RxTracer(std::string context, Ptr<Packet const> packet);

Is there a way for me to include the ptpnetdev as a parameter to the
rxtracer? If I have to do string-parsing for every packet received, it
means quite a heavy load..As a possible workaround, I checked if point-
to-point-net-device.cc adds a tag to the packet indicating the if
where it came from, but not happening apparently.

Antti Mäkelä

unread,
Mar 17, 2010, 4:22:27 AM3/17/10
to ns-3-users
On Mar 15, 11:46 am, Antti Mäkelä <zar...@gmail.com> wrote:
>   Is there a way for me to include the ptpnetdev as a parameter to the
> rxtracer? If I have to do string-parsing for every packet received, it
> means quite a heavy load..As a possible workaround, I checked if point-
> to-point-net-device.cc adds a tag to the packet indicating the if
> where it came from, but not happening apparently.

Darn, I had forgotten about this thread:
http://groups.google.com/group/ns-3-users/browse_thread/thread/7bec2b1efff9ef58/fc9702d291da8452?lnk=gst&q=makecallback#fc9702d291da8452
:)

Reply all
Reply to author
Forward
0 new messages