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

[ns] Problems when post-processing a nam file



Hi all,

I'm trying to calculate the average delay and the jitter of two traffic flows when running from nodes 0 and 1 to node 3. I've written an awk script to calculate these statistics but when I run on Linux Red Hat 6.0 "gawk -f delay.awk out.nam > delay.txt" I get the following messages:

warning: BEGIN blocks must have an action part.
warning: END blocks must have an action part.

Any  ideas of why am I getting these messages? When I look into the output file it's empty.

Any suggestions will be greatly appreciated.

Thanks and best regards,

Jorge

This is my awk script:

BEGIN
{
	
	{
		llegadas1 = 0;
		llegadas2 = 0;
	}
}
{
	if (($1 == "+") && ($5 == "0") && ($17 == "1"))
	{
		tsalida1[$15] = $3;
		salidas1++;
	}
	
	if (($1 == "+") && ($5 == "1") && ($17 == "2"))
	{
		tsalida2[$15] = $3;
		salidas2++;
	}

	if (($1 == "r") && ($7 == "3") && ($17 == "1"))
	{
		tllegada1[$15] = $3
		llegadas1++;
		printf(llegadas1);	
	}

	if (($1 == "r") && ($7 == "3") && ($17 == "2"))
	{
		tllegada2 [$15] = $3
		llegadas2++;
		printf(llegadas2);
	}

	
}

END
{
	for (i=1;i<=salidas1;i++) if (tllegada[i]) average1 = average1 + (tllegada1 - tsalida1)/llegadas1;
	for (i=1;i<=salidas2;i++) if (tllegada[i]) average2 = average2 + (tllegada2 - tsalida2)/llegadas2;
	print (average1);
	print (average2);
}