next up previous contents index
Next: 31.3.1 An example Up: 31.3 The class TrafficGenerator Previous: CBR Traffic Trace

A Traffic Trace object is instantiated by the OTcl class Application/Traffic/Trace. The associated class Tracefile is used to enable multiple Traffic/Trace objects to be associated with a single trace file. The Traffic/Trace class uses the method attach-tracefile to associate a Traffic/Trace object with a particular Tracefile object. The method filename of the Tracefile class associates a trace file with the Tracefile object. The following example shows how to create two Application/Traffic/Trace objects, each associated with the same trace file (called "example-trace" in this example). To avoid synchronization of the traffic generated, random starting places within the trace file are chosen for each Traffic/Trace object.
        set tfile [new Tracefile]
        \$tfile filename example-trace

        set t1 [new Application/Traffic/Trace]
        \$t1 attach-tracefile \$tfile
        set t2 [new Application/Traffic/Trace]
        \$t2 attach-tracefile \$tfile