[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Problems with trace generated traffic...




Hi all:

	I am having an strange problem while trying to use a trace file to create 
traffic. I have been searching in the distrib list and I found some mails 
explaining how to drive traffic from a trace, but whenever I do my ns 
segfaults inexplicably. This is what I have done (following instructions in a 
mail by Lee Breslau...)

- I created the ascci trace file, with interarrival pkt times in microsecs and 
packet lenght in bytes. (See attached Trace.ascii) It just runs for five 
seconds...
- I transformed it into binary using Lee's small c program (asctobin.c) and 
obtained (I hope...!!) the binary trace (example_trace)...

- Finally I prepared a simple tcl script, modifying one of the examples in the 
tutorial to use the trace... but it does not work (simple.tcl)!!!

I am beginning to turn desperate, could anyone help me!!

Sorry about the number of attachments. I wanted to give you everything I have 
been using, so that you are able to check it...

Could you please Cc: the answer to me, as I am not on the distrib list right 
now..

Thanks in advance

/Nacho

;8��8�
�	�,q�
���SY5�
���
m��z��O������
_L������?�)".�1��$���>&s�_���*@����+U�".�-���'%.�@�*��R2���6�o5�{7���6R@�8�@�7��-<l�R;4@�=�@L=�@^?z�>A�iA�D\�C#��F0�?C��Gi@�D�@�K��Gi@�K�H���M��|I�@3
#Create a simulator object
set ns [new Simulator]

#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf

#Define a 'finish' procedure
proc finish {} {
        global ns nf
        $ns flush-trace
	#Close the trace file
        close $nf
	#Execute nam on the trace file
        exec nam out.nam &
        exit 0
}

#Create two nodes
set n0 [$ns node]
set n1 [$ns node]

#Create a duplex link between the nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail

#Create a CBR agent and attach it to node n0
set udp [new Agent/UDP]
$ns attach-agent $n0 $udp
$udp set packetSize_ 200

set tfile [new Tracefile]
$tfile filename Trace.ascii

set trace_src [new Application/Traffic/Trace]
$trace_src attach-tracefile $tfile


#Create a Null agent (a traffic sink) and attach it to node n1
set null0 [new Agent/Null]
$ns attach-agent $n1 $null0

#Connect the traffic source with the traffic sink
$ns connect $udp $null0  

#Schedule events for the CBR agent
$ns at 0.5 "$trace_src start"
$ns at 4.5 "$trace_src stop"
#Call the finish procedure after 5 seconds of simulation time
$ns at 5.0 "finish"

#Run the simulation
$ns run
/* program to convert from ascii to binary representation of a traffic
 * trace in the ns format.
 */

#include <stdio.h>

typedef struct _trec {
  unsigned int trec_time;
  unsigned int trec_len;
} trec;


main()

{
  trec t;
  void exit();

  /* assume we read and write stdio */

  while (fscanf(stdin, "%d %d", &t.trec_time, &t.trec_len) != EOF) {
	  t.trec_time = (htonl(t.trec_time));
	  t.trec_len = (htonl(t.trec_len));
	  if (fwrite((char *)&t, sizeof(trec), 1, stdout) != 1) {
		  (void)fprintf(stderr, "write failed\n");
		  exit(1);
	  }
  }
  return 0;
}

0 827
80000 239
80000 2741
640000 1068
160000 1201
720000 2295
480000 1369
800000 1498
720000 1513
880000 1756
1120000 3194
1280000 683
1200000 1163
1360000 1226
1280000 2655
1920000 1225
1360000 1219
2000000 1343
1440000 1321
2240000 1507
1520000 1532
2400000 383
1560000 830
2520000 863
1680000 914
2760000 2230
2000000 1479
2840000 1543
2240000 1501
3000000 1926
2560000 1573
3080000 1414
2800000 1874
3320000 7412
3600000 1135
3480000 379
3640000 676
3560000 640
3720000 724
3640000 813
3960000 2130
3880000 1171
4040000 1100
4040000 1374
4160000 482
4080000 617
4320000 2070
4480000 1424
4400000 2000
4600000 319
4440000 517
4680000 754
4520000 705
4920000 2301
4680000 246
4960000 514
4760000 1172
5080000 636
4840000 819
Ignacio M�s Ivars
Department of Teleinformatics - Royal Institute of Technology (KTH/IT)
Electrum, 204  S-164 40 KISTA (Sweden)
Office phone: +46 8 7521497
Office fax: +46 8 7511793
E-mail: [email protected]
http://www.it.kth.se/~nacho/