File: dynamics.pl

package info (click to toggle)
ns2 2.35%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 78,796 kB
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 816; awk: 525; csh: 355
file content (44 lines) | stat: -rw-r--r-- 998 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44

# requires either gnuplot.pl or xgraph.pl
#

%su = %lu = %sd = %ld = ();	# su/sd are HoL arrays with semantics:
				# key %su/%sd is the link that went up/down
				# values %su/%sd is implicitly hashed
				# @{${su{link}}/@{$sd{link}} is the list
				# 	of times link went up/down.
				# %lu/%ld are used to ensure that %su/%sd
				# 	is unique.

sub parseDynamics {
    my(@F) = @_;
    my($a, $b) = ($F[3], $F[4]);
    ($a, $b) = ($b, $a)		if ($a > $b);

    if ($F[2] eq 'link-down') {
	if (! defined($lf{"$a:$b:$F[1]"})) {
	    push(@{$sd{"$a$b"}}, $F[1]);
	    $lf{"$a:$b:$F[1]"} = 1;
	}
	return;
    }
    if ($F[2] eq 'link-up') {
	if (! defined($lu{"$a:$b:$F[1]"})) {
	    push(@{$su{"$a$b"}}, $F[1]);
	    $lu{"$a:$b:$F[1]"} = 1;
	}
	return;
    }
}	

sub plotDynamics {
    my($OUT, $minY, $maxY) = @_;
    foreach $i (keys %sd) {
        plotFails($OUT, $minY, $maxY, $i, @{$sd{$i}});
    }
    foreach $i (keys %su) {
        plotRecov($OUT, $minY, $maxY, $i, @{$su{$i}});
    }
}

1;