File: summarize.pl

package info (click to toggle)
ace 6.0.3%2Bdfsg-0.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 49,368 kB
  • sloc: cpp: 341,826; perl: 30,850; ansic: 20,952; makefile: 10,144; sh: 4,744; python: 828; exp: 787; yacc: 511; xml: 330; lex: 158; lisp: 116; csh: 48; tcl: 5
file content (46 lines) | stat: -rwxr-xr-x 1,194 bytes parent folder | download | duplicates (4)
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
45
46
#! /usr/bin/perl
eval '(exit $?0)' && eval 'exec perl -w -S $0 ${1+"$@"}'
    & eval 'exec perl -w -S $0 $argv:q'
    if 0;

# $Id: summarize.pl 83994 2008-12-09 16:32:55Z johnnyw $
#
# Summarizes results from a series of runs of run_test, with
# different numbers of clients.  Example usage:
#
# $ for i in 1 2 5 10 15 20 25 30 35 40 45 50; do ./run_test $i; done
# $ ./summarize
#
# The first three lines above let this script run without specifying the
# full path to perl, as long as it is in the user's PATH.
# Taken from perlrun man page.

@files = glob 'client-*.log';
@total_threads = ();

foreach $file (@files) {
  my ($i);
  ($i = $file) =~ s/client-(\d+).log/$1/;
  push @total_threads, $i;
}

print "No.of threads\t\tAverage Latency\n\n";

foreach $total_threads (sort {$a <=> $b} @total_threads) {
  undef $high_latency;

  $high_latency = 0;
  open (FILE, "client-${total_threads}.log")  ||
    die "$0: unable to open \"client-${total_threads}.log\"\n";
  while ($line = <FILE>) {
    if ($line =~ /.*usec-per-message = ([\d\.]+)/)
    {
        $high_latency  += $1 ;
	$number++;
    }
  }
  close FILE;

  printf "%3d\t\t\t%8f\n",
    $total_threads, $high_latency/$number;
}