Hi!
Instead of changing the C++ source you can pipe the trace output through
awk before writing it to the trace file. This takes a little bit of
computing power and (depending on the script) a bit of memory. But you
can also save quite a lot of disk space (eg. by on-the fly calculation
of average values during the simulation) and you save on disk access times.
I do this all the time and it is a lot more flexible than changing the
source code because you can simply plug your awk script into the .tcl
script and change it very quickly whenever you want.
eg. in the .tcl do the following:
set tr [open "| awk -f filter.awk >out.tr" w]
$ns trace-all $tr
in filter.awk put your awk script or; if the awk command is very simple,
just do it directly in the .tcl . eg. to just print column 2 and 4 do
the following:
set tr [open "| awk '{print $2 \" \" $4}' >out.tr" w]
don't forget that you have to escape any " with \ (as shown in the
example above)!
lg,
Martina Umlauft
Diego Soares schrieb:
> Thanks for the answer, but if i exclude the fields that i wanto to
> eliminate, i get segmentation fault from the simulator, after I compile NS
> again.
>
> What should I change to eliminate some fields????
>
>
> On 5/6/06, Sita S. Krishnakumar <[EMAIL PROTECTED]> wrote:
>> cmu-trace.cc
>>
>>
>>> Hello NS users,
>>>
>>> Which source code should I chance to write only the fields that I want
>> in
>>> my
>>> trace files?? I am simulation Ad-Hoc networks using new-trace format!!!
>>>
>>> --
>>> Diego G. Soares
>>>
>>
>>
>
>
> --
> Diego G. Soares