File: time-series.pl

package info (click to toggle)
ns2 2.35%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 78,864 kB
  • sloc: cpp: 172,923; tcl: 107,130; perl: 6,391; sh: 6,143; ansic: 5,846; makefile: 818; awk: 525; csh: 355
file content (24 lines) | stat: -rwxr-xr-x 444 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
#!/usr/bin/perl -w

$totalSize = 0;
$cur_time= 0;
$start=0;
$time_block = 0.001;
$cur_epoch = 0;

while (<STDIN>) {
      
        ($cur_time,$size) = split(' ',$_);

	if ($cur_time > $cur_epoch) {
	    while ($cur_epoch < $cur_time) {
	        print "$totalSize\n";
		$cur_epoch = $cur_epoch + $time_block;
	        $totalSize=0;
	    }
	    if ($cur_time < $cur_epoch) {$totalSize=$size;}
	} else {
	    $totalSize=$totalSize + $size;
	}
}