Iqbal:

I have modified script1 for you, and I have named 'script2'

script2 is a linux script, so you must run it in the linux shell.

I hope that you would need change only the TMP and GRAPHS variables to your system, and rename yor ns-2 trace file to 'out.tr'

Then, execute with:

$script2



On Wed, 28 Mar 2007, wacky wrote:

could you please tell me how to execute this file, i mean exactly what
command should i type in,
i saved this file as "throughput.awk"...
then i changed the cat out.tr ( from $TMP/out.tr | perl column 3 0 2 1 |
sort -g | ) to nodes.tr
i tried awk -f throughput.awk > outfile

the I tried the command awk -f throughput.awk > outfile

i get various errors after executing this. please help me...

rgrds
Iqbal

#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo "[$1:$2:$3] ...Obteniendo bytes/packets/flows sent/dropped TCP "
cat $TMP/nodes.tr | perl column 3 0 2 1 | sort -g |
awk '
   BEGIN { max = 0 }
   {
     # i          = fid
     # flujo[i,1] = packets_arrivals (+)
     # flujo[i,2] = packets_drops    (d)
     # flujo[i,3] = packets_sent     (-)
     # flujo[i,4] = bytes_arrivals
     # flujo[i,5] = bytes_drops
     # flujo[i,6] = bytes_sent
     # flujo[i,7] = instante inicio
     # flujo[i,8] = instante final

     i      = $1;
     tiempo = $4;
     evento = $2;

     max = ((i > max) ? i : max);

     contabilizar = 0;

     if (evento == "+") {
        flujo[i,1]++;
        flujo[i,4] += $3;
        contabilizar = 1;
     } else if (evento == "d") {
        flujo[i,2]++;
        flujo[i,5] += $3;
        contabilizar = 1;
     } else if (evento == "-") {
        flujo[i,3]++;
        flujo[i,6] += $3;
        contabilizar = 1;
     }

     if (contabilizar == 1) {
        tiempo = $4;

        if (flujo[i,7] == 0) { flujo[i,7]= tiempo };
        if (flujo[i,8] == 0) { flujo[i,8]= tiempo };

        if ( tiempo < flujo[i,7]) { flujo[i,7] = tiempo};
        if ( tiempo > flujo[i,8]) { flujo[i,8] = tiempo};
     }
   }
   END {
      for (i=0; i<=max ; i++) {
        lapsus = flujo[i,8] - flujo[i,7];

        if ( lapsus > 0 ) {
printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%f\n",i,flujo[i,1],flujo[i,2],flujo[i,3],flujo[i,4],flujo[i,5],flujo[i,6],lapsus)
}
      }
   }' > $TMP/tcp_flows.dat


#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#::: FIN
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::

#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#!/bin/sh

TMP=./temp
GRAPHS=./graphs

#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
echo "[$1:$2:$3] ...Obteniendo bytes/packets/flows sent/dropped TCP "
cat $TMP/out.tr | perl column 3 0 2 1 | sort -g | 
awk '  
  BEGIN { max = 0 }
  {
    # i          = fid
    # flujo[i,1] = packets_arrivals (+)
    # flujo[i,2] = packets_drops    (d)
    # flujo[i,3] = packets_sent     (-)
    # flujo[i,4] = bytes_arrivals
    # flujo[i,5] = bytes_drops
    # flujo[i,6] = bytes_sent
    # flujo[i,7] = instante inicio
    # flujo[i,8] = instante final

    i      = $1;
    tiempo = $4;
    evento = $2;

    max = ((i > max) ? i : max);

    contabilizar = 0;

    if (evento == "+") { 
       flujo[i,1]++;
       flujo[i,4] += $3;
       contabilizar = 1;
    } else if (evento == "d") { 
       flujo[i,2]++;
       flujo[i,5] += $3;
       contabilizar = 1;
    } else if (evento == "-") { 
       flujo[i,3]++;
       flujo[i,6] += $3;
       contabilizar = 1;
    }

    if (contabilizar == 1) {
       tiempo = $4;

       if (flujo[i,7] == 0) { flujo[i,7]= tiempo };
       if (flujo[i,8] == 0) { flujo[i,8]= tiempo };

       if ( tiempo < flujo[i,7]) { flujo[i,7] = tiempo};
       if ( tiempo > flujo[i,8]) { flujo[i,8] = tiempo};
    }
  }
  END {
     for (i=0; i<=max ; i++) {
       lapsus = flujo[i,8] - flujo[i,7];

       if ( lapsus > 0 ) { 
printf("%d\t%d\t%d\t%d\t%d\t%d\t%d\t%f\n",i,flujo[i,1],flujo[i,2],flujo[i,3],flujo[i,4],flujo[i,5],flujo[i,6],lapsus)
 }
     }
  }' > $TMP/tcp_flows.dat

#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::
#::: FIN
#:::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Reply via email to