Bug 709 - Crazy Idea -- Default trace sink
Crazy Idea -- Default trace sink
Status: NEW
Product: ns-3
Classification: Unclassified
Component: core
All All
: P5 enhancement
Assigned To: ns-bugs
Depends on:
  Show dependency treegraph
Reported: 2009-10-08 14:25 EDT by Craig Dowell
Modified: 2009-10-08 14:25 EDT (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Craig Dowell 2009-10-08 14:25:13 EDT
It occurred to me that it might be possible to specify a kind of default trace sink that appends traced text to the end of a file.

If a bound callback is created that takes a file name and a format string to bind, it may be possible to construct a trace sink that just writes trace results to the specified file using the format string without actually having to code a trace sink (the actual trace sink could be made from a template in the core).

As a wild guess on a possible syntax:

Config::ConnectDefault<2> ("/NodeList ... CongestionWindow", "my-trace-file", "CongestionWindow changed from %d<a1> to %d<a2>")

This would try to convince a default trace sink taking four arguments (two provided by the source + two bound) to take template argument a1 and sprintf it using %d, and take argument a2 and sprintf it using %d.  This woud result in a string that looked like, "CongestionWindow changed from 1 to 2" which would be appended to the file "my-trace-file"

Haven't worked it through, multithreading may require locks, but I wanted to write it down since it sounds like it would be incredibly convenient to lots of users.