source: branches/reconfiguration/modules/dspin_router/caba/test/synthetic_test/broadcast_latency.sh @ 996

Last change on this file since 996 was 996, checked in by cfuguet, 10 years ago

reconf: introduce scripts to get transactions latency in the synthetic
platform.

  • Property svn:executable set to *
File size: 953 bytes
Line 
1#!/usr/bin/env sh
2# @author       Cesar Armando Fuguet Tortolero
3# @date         24 May, 2015
4# @brief        This script validates that a broadcast transaction reaches once
5#                       and only once every non-faulty router in the platform.
6file=$1
7awk '
8BEGIN {
9        sent=0
10        total=0
11        targets=0
12}
13#   Parse coordinates of routers
14/DSPIN_GENERATOR/ {
15        regex="\\[[0-9]+\\]\\[";
16        if (match($2,regex)) {
17                x=substr($2,RSTART+1,RLENGTH-3);
18        }
19        regex="\\]\\[[0-9]+\\]";
20        if (match($2,regex)) {
21                y=substr($2,RSTART+2,RLENGTH-3);
22        }
23}
24
25#   Parse the number of sent broadcast packets
26/broadcast sent packets += +/ {
27        if ($6 != 0) {
28                sent=$6;
29        }
30}
31
32#   Parse the number of received broadcast packets
33/broadcast received packets +=/ {
34        packets=$6
35}
36
37#   Parse the broadcast latency
38/broadcast latency +=/ {
39        latency=$5;
40        total+=latency;
41        if (latency > 0) {
42                targets++;
43        }
44}
45
46#   Validate the file
47END {
48        print "mean latency=" total/targets
49        exit 0;
50}' $file
51if [[ $? == 1 ]]; then exit 1; fi
52
Note: See TracBrowser for help on using the repository browser.