Bugzilla – Bug 622
[PATCH] Friendly names for pcap traces
Last modified: 2010-02-26 12:22:25 UTC
Created attachment 512 [details] Patch to add friendly names for pcap traces Attached is a patch that gives out more meaningful names for trace files. Instead of filename-nodeid-deviceid, which can get quite cumbersome if you have lots of devices, this one uses format filename-nodename-devname if they have been given via Names::Add facility. For Nodes, simply use Ptr<Node> TestBoxNode; Names::Add("TestBox", TestBoxNode) For devices, you need to specify the name belongs to specific node (so you can use e.g. "eth0" for multiple nodes), like so: Ptr<NetDevice> TestDev = TestBoxNode->GetDevice(0); Names::Add(TestBoxNode, "eth0", TestDev); End result what you'll see when you use e.g. PointToPointHelper::EnablePcapAll ("testtrace"); will be that instead of testrace-0-0.pcap, you get testrace-TestBox-eth0.pcap ...which I think is quite useful addition.
*** Bug 617 has been marked as a duplicate of this bug. ***
+1-- reassigning to Craig to review and hopefully merge
Hi all, I have been through this patch and I think small coding style stuff has to be fixed: -Coding style (space after parentheses, space before and after != & = ...) Other than that +1 for patch to be added to ns-3-dev. Anyone has comments about the patch? Thanks
Well, I guess this needs to be documented somewhere, but what is the appropriate place? Doing it with every helper classes EnablePcap*-methods seems a bit wrong - is there some more generic place that would cover them all?
I think that the best way to do is to centralize the code and to delegate the name creation to PcapWriter i.e. something like this: Ptr<PcapWriter> pcap = Create<PcapWriter> (); fileName = pcap->GetFileName (nodeid, deviceid) pcap->Open (fileName); This way the routine GetFileName will contain the job and you don't have to repeat the same code in each helper class. The documentation would be in that case in PcapWriter and the change is minor in the sense that the old style will be maintained. What do you think? Faker
Created attachment 660 [details] Same patch against revision 5744:01f868cf15eb Here is the same patch but against the latest revision: 5744:01f868cf15eb
I agree about the PCapwriter approach.
I have a patch that I am not entirely satisfied with. I will address this after I complete some other work -- before code complete ns-3.7