+++ /dev/null
-#!/usr/bin/perl
-
-my $tablen = shift @ARGV;
-my $fn = shift @ARGV;
-
-my $tab = ' ' x $tablen;
-open(I, $fn);
-my $f;
-my $oldtab = ' ' x 4;
-while (<I>) {
- if (my ($oldlen) = /\-\*\- .*tab-width:(\d)/) {
- print "old length was $oldlen\n";
- $oldtab = ' ' x $oldlen;
- s/tab-width:\d/tab-width:$tablen/;
- }
- s/\t/$oldtab/g;
- $f .= $_;
-}
-close I;
-open(O, ">$fn.new");
-print O $f;
-close O;
-
-rename "$fn.new", $fn;
+++ /dev/null
-#!/bin/sh -x
-
-set -e
-
-image="$1"
-root=/tmp/$$
-dist=squeeze
-
-srcdir=`dirname $0`
-
-# image
-[ -e $image ] && echo $image exists && exit 1
-dd if=/dev/zero of=$image bs=1M seek=1023 count=1
-yes | mke2fs -j $image
-
-mkdir $root
-mount -o loop $image $root
-
-cleanup() {
- umount $root/proc || true
- umount $root/sys || true
- umount $root/dev/pts || true
- umount $root
-}
-trap cleanup INT TERM EXIT
-
-debootstrap $dist $root http://http.us.debian.org/debian/
-
-cat <<EOF >> $root/etc/fstab
-none /dev/pts devpts gid=5,mode=620 0 0
-proc /proc proc defaults 0 0
-sysfs /sys sysfs defaults 0 0
-none /sys/kernel/debug debugfs defaults 0 0
-tmpfs /tmp tmpfs defaults,size=768M 0 0
-none /host hostfs defaults 0 0
-EOF
-
-echo "uml" > $root/etc/hostname
-mkdir $root/host
-
-# set up chroot
-mount -t proc proc $root/proc
-mount -t sysfs sysfs $root/sys
-mount -t devpts devptr $root/dev/pts -o gid=5,mode=620
-
-# set up network
-cp $srcdir/network-from-cmdline $root/etc/init.d/network-from-cmdline
-chroot $root update-rc.d network-from-cmdline defaults 20
-
-# kcon_ helpers
-cp $srcdir/kcon_most.sh $root/root/most.sh
-cp $srcdir/kcon_all.sh $root/root/all.sh
-
-# fix up consoles
-cat <<EOF >> $root/etc/securetty
-
-# uml
-tty0
-vc/0
-EOF
-
-cat <<EOF >> $root/etc/inittab
-
-# uml just one console
-c0:1235:respawn:/sbin/getty 38400 tty0 linux
-EOF
-grep -v tty[23456] $root/etc/inittab > $root/etc/inittab.new
-mv $root/etc/inittab.new $root/etc/inittab
-
-# no root password
-chroot $root passwd -d root
-
-# copy creating user's authorized_keys
-mkdir $root/root/.ssh
-chmod 700 $root/root/.ssh
-cp ~/.ssh/authorized_keys $root/root/.ssh/authorized_keys
-chmod 600 $root/root/.ssh/authorized_keys
-
-# packages
-chroot $root apt-get -y --force-yes install ssh libcrypto\+\+ bind9-host
-
-exit 0
+++ /dev/null
-#!/usr/bin/perl
-
-my $epoch = shift || die "specify epoch";
-
-my %auth; # mds -> id -> replica -> nonce
-my %replica; # mds -> id -> auth -> nonce
-
-print "reading\n";
-for (my $i=0; -e "cachedump.$epoch.mds$i"; $i++) {
- open(O,"cachedump.$epoch.mds$i");
- while (<O>) {
- my ($name,$s);
- ($name,$s) = /^\[(inode \d+) \S+ (\S+)/;
- ($name,$s) = /^\[(dir \d+) \S+ (\S+)/ unless $name;
- ($name,$s) = /^\[dentry (\S+) (\S+)/ unless $name;
- if ($name) {
- if ($s =~ /^auth/) {
- $auth{$i}->{$name} = {};
- my ($rl) = $s =~ /\{(.*)\}/;
- for my $r (split(/,/,$rl)) {
- my ($who,$nonce) = $r =~ /(\d+)\=(\d+)/;
- $auth{$i}->{$name}->{$who} = $nonce;
- #print "auth $name rep by $who $nonce $s\n";
- }
- }
- else {
- my ($a,$b,$n) = $s =~ /rep@(\d+)\,([\-\d]+)\.(\d+)/;
- die $_ unless $a >= 0;
- $replica{$i}->{$name}->{$a} = $n;
- if ($b >= 0) {
- $replica{$i}->{$name}->{$b} = $n;
- }
- }
- }
- }
-}
-
-print "verifying replicas\n";
-for my $mds (keys %replica) {
- for my $name (keys %{$replica{$mds}}) {
- for my $auth (keys %{$replica{$mds}->{$name}}) {
- if ($auth{$auth}->{$name}->{$mds}) {
- if ($auth{$auth}->{$name}->{$mds} < $replica{$mds}->{$name}->{$auth}) {
- print "problem: mds$mds has $name from mds$auth nonce $replica{$mds}->{$name}->{$auth}, auth has nonce $auth{$auth}->{$name}->{$mds}\n";
- } else {
- print "ok: mds$mds has $name from mds$auth nonce $replica{$mds}->{$name}->{$auth}, auth has nonce $auth{$auth}->{$name}->{$mds}\n";
- }
- } else {
- print "??: mds$mds has $name from mds$auth nonce $replica{$mds}->{$name}->{$auth}, auth has no nonce\n";
- }
-
- }
- }
-}
-
-
+++ /dev/null
-#!/usr/bin/perl
-
-my $in = 0;
-my $line = 1;
-while (<>) {
- chomp;
- my $l = $_;
- my @w = split(/\s+/, $_);
- for (@w) {
- if (/^(\/\/)?dout\(\s*\-?\s*\d+\s*\)$/) {
- warn "$line: dout without dendl: $l\n" if $in;
- $in = 1;
- }
- elsif (/^derr\(\s*\-?\s*\d+\s*\)$/) {
- warn "$line: dout without dendl: $l\n" if $in;
- $in = 1;
- }
- elsif (/^dendl/) {
- warn "$line: dendl without dout: $l\n" unless $in;
- $in = 0;
- }
- }
- $line++;
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-
-my %r; # reqid -> start
-my %what;
-my %lat_req; # latency -> request
-
-sub tosec($) {
- my $v = shift;
- my ($h, $m, $s) = split(/:/, $v);
- my $r = $s + 60 * ($m + (60 * $h));
- #print "$v = $h $m $s = $r\n";
- return $r;
-}
-
-while (<>) {
- chomp;
- my ($stamp) = /^\S+ (\S+)/;
-
- my ($req,$desc) = /\<\=\= client\d+ \S+ \d+ \=\=\=\= client_request\((\S+) ([^\)]+)/;
-
- if (defined $req) {
- #print "$req\n"; # ($r{$req} - $stamp)\n";
- $r{$req} = $stamp;
- $what{$req} = $desc;
- next;
- }
-
- my $who;
- ($who, $req,$desc) = /\-\-\> (client\d+) \S+ \-\- client_reply\((\S+) ([^\)]+)/;
- if (defined $req) {
- $req =~ s/\?\?\?/$who/;
- if (exists $r{$req}) {
- my $len = tosec($stamp) - tosec($r{$req});
- #print "$req $len ($r{$req} - $stamp)\n";
- $lat_req{$len} = $req;
-
- delete $r{$req};
- }
- }
-}
-
-
-for my $len (sort {$b <=> $a} keys %lat_req) {
- my $req = $lat_req{$len};
- print "$len\t$req\t$what{$req}\n";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-
-my %r; # reqid -> start
-my %lat_req; # latency -> request
-my %desc;
-
-sub tosec($) {
- my $v = shift;
- my ($h, $m, $s) = split(/:/, $v);
- my $r = $s + 60 * ($m + (60 * $h));
- #print "$v = $h $m $s = $r\n";
- return $r;
-}
-
-while (<>) {
- chomp;
- my ($stamp) = /^\S+ (\S+) /;
-
- my ($who,$tid,$desc) = /osd\d+ <.. (\D+\d+) \S+ \d+ \S+ osd_op\((\S+) ([^\)]+)/;
- if (defined $tid) {
- my $req = "$tid";
- $r{$req} = $stamp unless exists $r{$req};
- $desc{$req} = $desc;
- next;
- }
-
- my ($who,$tid) = /\d+ -- \S+ osd\d+ --> (\D+\d+) \S+ \S+ osd_op_reply\((\S+) /;
- if (defined $tid) {
- my $req = "$tid";
- if (exists $r{$req}) {
- my $len = tosec($stamp) - tosec($r{$req});
-
- #print "$req $len ($r{$req} - $stamp)\n";
- $lat_req{$len} = $req;
-
- delete $r{$req};
- }
- next;
- }
-
-}
-
-
-for my $len (sort {$b <=> $a} keys %lat_req) {
- print "$len\t$lat_req{$len}\t$desc{$lat_req{$len}}\n";
-}
+++ /dev/null
-#!/bin/sh
-
-cosd=`which ceph-osd`
-[ -z "$cosd" ] && cosd="./ceph-osd"
-
-bad=0
-for f in $1/current/meta/pglog*
-do
- echo -n "checking $f ... "
- $cosd --dump-pg-log $f > /dev/null && echo ok || ( bad=1 && echo corrupt )
-done
-exit $bad
\ No newline at end of file
+++ /dev/null
-#!/usr/bin/perl
-
-my $n = 0;
-while (<>) {
- next unless /trace: /;
- my $l = $'; $';
- print $l;
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-
-my $xaxis = shift @ARGV;
-my @vars;
-while (@ARGV) {
- $_ = shift @ARGV;
- last if ($_ eq '-');
- push(@vars, $_);
-}
-my @dirs;
-while (@ARGV) {
- $_ = shift @ARGV;
- last if ($_ eq '-');
- push(@dirs, $_) if -d $_;
-}
-my @filt = @ARGV;
-push( @filt, '.' ) unless @filt;
-
-print "#xaxis $xaxis
-#vars @vars
-#dirs @dirs
-#filt @filt
-";
-
-sub load_sum {
- my $fn = shift @_;
-
- open(I, "$fn");
- my $k = <I>;
- chomp($k);
- my @k = split(/\s+/,$k);
- shift @k;
-
- my $s;
- while (<I>) {
- chomp;
- s/^\#//;
- next unless $_;
- my @l = split(/\s+/,$_);
- my $k = shift @l;
- for my $f (@k) {
- $s->{$k}->{$f} = shift @l;
- }
-
- # clnode latency?
- if ($fn =~ /cl/) {
- $s->{$k}->{'wrlat'} = $s->{$k}->{'wrlsum'} / $s->{$k}->{'wrlnum'} if $s->{$k}->{'wrlnum'} > 0;
- $s->{$k}->{'rlat'} = $s->{$k}->{'rlsum'} / $s->{$k}->{'rlnum'} if $s->{$k}->{'rlnum'} > 0;
- $s->{$k}->{'lat'} = $s->{$k}->{'lsum'} / $s->{$k}->{'lnum'} if $s->{$k}->{'lnum'} > 0;
- $s->{$k}->{'latw'} = $s->{$k}->{'lwsum'} / $s->{$k}->{'lwnum'} if $s->{$k}->{'lwnum'} > 0;
- $s->{$k}->{'latr'} = $s->{$k}->{'lrsum'} / $s->{$k}->{'lrnum'} if $s->{$k}->{'lrnum'} > 0;
- $s->{$k}->{'statlat'} = $s->{$k}->{'lstatsum'} / $s->{$k}->{'lstatnum'} if $s->{$k}->{'lstatnum'} > 0;
- $s->{$k}->{'dirlat'} = $s->{$k}->{'ldirsum'} / $s->{$k}->{'ldirnum'} if $s->{$k}->{'ldirnum'} > 0;
- }
- }
- return $s;
-}
-
-
-my %res;
-my @key;
-my %didkey;
-for my $f (@filt) {
- my @reg = split(/,/, $f);
- #print "reg @reg\n";
- for my $d (@dirs) {
- if ($f ne '.') {
- my $r = (split(/\//,$d))[-1];
- my @db = split(/,/, $r);
- #print "db @db\n";
- my $ok = 1;
- for my $r (@reg) {
-
- $ok = 0 unless grep {$_ eq $r} @db;
- }
- next unless $ok;
- }
- #next if ($f ne '.' && $d !~ /$reg/);
- #print "$d\n";
- my ($x) = $d =~ /$xaxis=([\d\.]+)/;
-
- for my $v (@vars) {
- my ($what, $field) = $v =~ /^(.+)\.([^\.]+)$/;
- #print "$what $field .. $v .. $f.$field\n";
- my $s = &load_sum("$d/sum.$what");
-
- #print "\t$v";
- if ($field =~ /^sum=/) {
- #warn "SUM field $field\n";
- push( @{$res{$x}}, $s->{'sum'}->{$'} ); #'});
- } else {
- #warn "avg field $field\n";
- push( @{$res{$x}}, $s->{'avgval'}->{$field} );
- }
-
- push( @key, "$f.$field" ) unless $didkey{"$f.$field"};
- $didkey{"$f.$field"} = 1;
-
- if (0 && exists $s->{'avgvaldevt'}) {
- push( @{$res{$x}}, $s->{'avgvaldevt'}->{$field} );
- push( @key, "$f.$field.dev" ) unless $didkey{"$f.$field.dev"};
- $didkey{"$f.$field.dev"} = 1;
- }
- }
- }
-}
-
-print join("\t", "#", @key) . "\n";
-for my $x (sort {$a <=> $b} keys %res) {
- print join("\t", $x, @{$res{$x}}) . "\n";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-# this reads in one of kristal's anonymized static traces from
-# soe and makes it look like output from
-#
-# find . -exec ls -dilsn --time-style=+%s \{\} \;
-#
-# (which is what SyntheticClient likes to "import", and
-# study_static.pl likes to analyze for hardlinks, dirsizes, etc.)
-
-while (<>) {
- chomp;
- my ($file, $ino, $size, $actime, $ctime, $mtime, $uid, $gid, $omode, $nlink) = split(/ /,substr($_,1));
- $file = '.' . $file;
- my $nmode = oct($omode);
- my $mode = '-...';
- $mode = 'd...' if (($nmode & 0170000) == 0040000);
- $mode = 'f...' if (($nmode & 0170000) == 0100000);
- $size = hex($size);
- $mtime = hex($mtime);
- $uid = hex($uid);
- $gid = hex($gid);
- print "$ino ? $mode ? $nlink $uid $gid $size $mtime $file\n";
-}
-
-__END__
-
-soe format is
-0. a space
-1. full path of file name (MD5-ed and in base 64)
-2. inode number
-3. size of file in bytes (hex)
-4. atime (hex)
-5. ctime (hex)
-6. mtime (hex)
-7. uid (hex)
-8. gid (hex)
-9. mode (octal)
-10. number of links
+++ /dev/null
-#!/usr/bin/perl
-
-my %pin;
-my %hist;
-my $l = 1;
-my @pins;
-while (<>) {
-
- #cdir:adjust_nested_auth_pins on [dir 163 /foo/ rep@13 | child] count now 0 + 1
-
- if (/adjust_nested_auth_pins/) {
- my ($what) = / (\w+)\]/;
- $what =~ s/ 0x/ /;
- $hist{$what} .= "$l: $_"
- if defined $pin{$what};
- }
-
- # cinode:auth_pin on inode [1000000002625 /gnu/blah_client_created. 0x89b7700] count now 1 + 0
-
- elsif (/auth_pin / && !/waiting/) {
- #my ($what) = /\[(\w+ \w+) /;
- my ($what) = / (\w+)\]/;
- $what =~ s/ 0x/ /;
- #print "$_ add_waiter $c $what\n";
- $pin{$what}++;
- $hist{$what} .= "$l: $_";
- push( @pins, $what ) unless grep {$_ eq $what} @pins;
- }
-
- # cinode:auth_unpin on inode [1000000002625 (dangling) 0x89b7700] count now 0 + 0
-
- elsif (/auth_unpin/) {
- #my ($what) = /\[(\w+ \w+) /;# / on (.*\])/;
- my ($what) = / (\w+)\]/;
- $what =~ s/ 0x/ /;
- $pin{$what}--;
- $hist{$what} .= "$l: $_";
- unless ($pin{$what}) {
- delete $hist{$what};
- delete $pin{$what};
- @pins = grep {$_ ne $what} @pins;
- }
- }
- $l++;
-}
-
-for my $what (@pins) {
- print "---- count $pin{$what} on $what
-$hist{$what}
-";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-my %buffers;
-
-my $l = 1;
-while (<>) {
- #print "$l: $_";
-
- if (/^raw_(\w+) alloc (\S+)/) {
- #print "alloc $2\n";
- $buffers{$2} = "$l: $_";
- }
- if (/^raw_(\w+) free (\S+)/) {
- #print "free $2\n";
- print "free without alloc at $l: $_" unless $buffers{$2};
- delete $buffers{$2};
- }
- $l++;
-}
-
-for my $x (sort {$buffers{$a} <=> $buffers{$b}} keys %buffers) {
- print "leaked $buffers{$x}";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-my %op;
-
-my $line = 0;
-while (<>) {
- #print $line . $_ if /0x8d4f6a0/;
- chomp;
- $line++;
-
- #bdev(./ebofsdev/0)._submit_io bio(wr 269~1 usemap 0x4de33cc0)
- if (my ($bio) = /_submit_io bio\(.*(0x\w+)\)/) {
- $op{$bio} = $line;
- }
-
- # cancel
- #bdev(./ebofsdev/3)._cancel_io bio(wr 1525~1 bh_write 0x8a437b8)
- if (my ($bio) = /_cancel_io bio\(.*(0x\w+)\)/ &&
- !(/FAILED/)) {
- delete $op{$bio};
- }
-
- # finish
- #bdev(./ebofsdev/3).complete_thread finishing bio(wr 1131~1 write_cnode 0x832c1f8)
- if (my ($bio) = /complete_thread finishing bio\(.*(0x\w+)\)/) {
- delete $op{$bio};
- }
-
-}
-
-for my $bio (keys %op) {
- print "---- lost bio $bio\n";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-my %op;
-
-my $line = 0;
-while (<>) {
- #print "$line: $_";
- $line++;
-
- #osd3 do_op MOSDOp(client0.933 oid 100000000000008 0x84b4480) in pg[pginfo(4020000000d v 5662/0 e 2/1) r=0 active (0,5662]]
- if (my ($from, $opno, $oid, $op) = /do_op MOSDOp\((\S+) op (\d+) oid (\d+) (\w+)\)/) {
-# print "$op\n";
- if ($opno == 2 || $opno == 11 || $opno == 12 || $opno == 14 || $opno == 15) {
- $op{$op} = $from;
- }
- }
-
- # commits
- #osd1 op_modify_commit on op MOSDOp(client1.289 oid 100000100000002 0x51a2f788)
- if (my ($op) = /op_modify_commit.* (\w+)\)/) {
- delete $op{$op};
- }
- #osd4 rep_modify_commit on op MOSDOp(osd3.289 oid 100000000000008 0x84b0980)
- if (my ($op) = /rep_modify_commit.* (\w+)\)/) {
- delete $op{$op};
- }
-
- # forwarded?
- if (my ($op) = /sending (\w+) to osd/) {
- delete $op{$op};
- }
-
-}
-
-for my $op (keys %op) {
- print "---- lost op $op $op{$op}\n";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-my %ack;
-my %commit;
-
-my $line = 0;
-while (<>) {
- #print "$line: $_";
- $line++;
-
- #client0.objecter writex_submit tid 21 osd0 oid 100000000000001 851424~100000
- if (my ($who, $tid) = /(\S+)\.objecter writex_submit tid\D+(\d+)\D+osd/) {
-# print "$who.$tid\n";
- $ack{"$who.$tid"} = $line;
- $commit{"$who.$tid"} = $line;
- }
-
- #client1.objecter handle_osd_write_reply 304 commit 0
- #client1.objecter handle_osd_write_reply 777 commit 1
- if (my ($who, $tid, $commit) = /(\S+)\.objecter handle_osd_write_reply\D+(\d+)\D+commit\D+(\d)/) {
-# print "$who.$tid\n";
- delete $ack{"$who.$tid"};
- delete $commit{"$who.$tid"} if $commit;
- }
-
-}
-
-for my $op (keys %commit) {
- print "---- lost commit $op $commit{$op}\n";
-}
-for my $op (keys %ack) {
- print "---- lost ack $op $commit{$op}\n";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-my %pin;
-my %hist;
-my $l = 1;
-my @pins;
-while (<>) {
-
- # cinode:auth_pin on inode [1000000002625 /gnu/blah_client_created. 0x89b7700] count now 1 + 0
-
- if (/path_pinned /) {
- my ($dname, $dir) = /\[dentry (\S+) .* in \[dir (\d+) /;
- $what = "$dname $dir";
- #print "$l pin $what\n";
- $pin{$what}++;
- $hist{$what} .= "$l: $_";
- push( @pins, $what ) unless grep {$_ eq $what} @pins;
- }
-
- # cinode:auth_unpin on inode [1000000002625 (dangling) 0x89b7700] count now 0 + 0
-
- if (/path_unpinned/) {
- my ($dname, $dir) = /\[dentry (\S+) .* in \[dir (\d+) /;
- $what = "$dname $dir";
- #print "$l unpin $what\n";
- $pin{$what}--;
- $hist{$what} .= "$l: $_";
- unless ($pin{$what}) {
- delete $hist{$what};
- delete $pin{$what};
- @pins = grep {$_ ne $what} @pins;
- }
- }
- $l++;
-}
-
-for my $what (@pins) {
- print "---- count $pin{$what} on $what
-$hist{$what}
-";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-my %waiting; # context => what where what is "inode ..." or "dir ..."
-my %hist; # context => history since waited
-my @waiting;
-
-my $line = 0;
-while (<>) {
-
- #print $line . $_ if /0x8d4f6a0/;
- $line++;
- if (/request_start/) {
- my ($c) = /(0x\w+)/;
- my ($what) = $'; #';
- chomp $what;
- #print "$line add_waiter $c $what\n" if /0x8d4f6a0/;
- $waiting{$c} = $what
- if $what && !$waiting{$c};
- $hist{$c} .= "$line: $_";
- unless (grep {$_ eq $c} @waiting) {
- push( @waiting, $c );
- }
- }
- #if (/finish_waiting/) {
- # my ($c) = /(0x\w+)/;
- # $hist{$c} .= "$line: $_";
- #}
- if (/request_finish/ ||
- /request_forward/) {
- my ($c) = /(0x\w+)/;
- #print "took\n" if /0x8d4f6a0/;
- delete $waiting{$c};
- delete $hist{$c};
- @waiting = grep {$_ ne $c} @waiting;
- }
-}
-
-for my $c (@waiting) {
- print "---- lost request $c $waiting{$c}
-$hist{$c}
-";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-my %waiting; # context => what where what is "inode ..." or "dir ..."
-my %hist; # context => history since waited
-my @waiting;
-
-my $line = 0;
-while (<>) {
- #print $line . $_ if /0x8d4f6a0/;
- $line++;
- if (/add_waiter/) {
- my ($c) = /(0x\w+)/;
- my ($what) = / on (.*\])/;
- #print "$line add_waiter $c $what\n" if /0x8d4f6a0/;
- $waiting{$c} = $what
- if $what && !$waiting{$c};
- $hist{$c} .= "$line: $_";
- unless (grep {$_ eq $c} @waiting) {
- push( @waiting, $c );
- }
- }
- #if (/finish_waiting/) {
- # my ($c) = /(0x\w+)/;
- # $hist{$c} .= "$line: $_";
- #}
- if (/take_waiting/) {
- my ($c) = /(0x\w+)/;
- if (/SKIPPING/) {
- #print "skipping\n" if /0x8d4f6a0/;
- $hist{$c} .= "$line: $_";
- } elsif (/took/) {
- #print "took\n" if /0x8d4f6a0/;
- delete $waiting{$c};
- delete $hist{$c};
- @waiting = grep {$_ ne $c} @waiting;
- } else {
- die "i don't understand: $_";
- }
- }
-}
-
-for my $c (@waiting) {
- print "---- lost waiter $c $waiting{$c}
-$hist{$c}
-";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-my @ranks = @ARGV;
-unless (@ranks) {
- @ranks = split(/\n/,`/bin/ls gmon`);
-}
-print "will do @ranks\n";
-for my $r (@ranks) {
- print "$r\n";
- system "test -e gmon.out && rm gmon.out ; ln -f gmon/$r/gmon.out ; gprof newsyn > gmon/$r/o";
-}
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-
-my $block = shift ARGV;
-die unless int $block;
-
-while (<>) {
- my $yes = 0;
- for my $x (/(\d+\~\d+)/) {
- my ($s,$l) = split(/\~/,$x);
- $yes = 1 if ($block >= $s && $block < $s+$l);
- }
- print if $yes;
-}
+++ /dev/null
-#!/usr/bin/perl
-
-my %rows; # val -> [ count1, count2, ... ]
-
-my $filen = 0;
-for my $file (@ARGV) {
- open(I,"$file");
- while (<I>) {
- next if /^\#/;
- chomp;
- my ($v, $c) = split(/\t/,$_);
- $rows{$v}->[$filen] = $c;
- }
- $filen++;
-}
-
-for my $v (sort {$a <=> $b} keys %rows) {
- print "$v";
- for (my $i=0; $i < $filen; $i++) {
- print "\t" . int($rows{$v}->[$i]);
- }
- print "\n";
- #print join("\t", $v, @{$rows{$v}}) . "\n";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-
-my @file = <>;
-sub get_op {
- my @op = shift @file;
- while (@file &&
- $file[0] !~ /^[a-z]+$/) {
- push( @op, shift @file );
- }
- #print "op = ( @op )\n";
- return @op;
-}
-
-my $n = 0;
-while (@file) {
- my ($op, @args) = &get_op;
- while ($op eq "read\n" ||
- $op eq "write\n") {
- die unless scalar(@args) == 3;
- my ($nop, @nargs) = &get_op;
- if ($nop eq $op
- && ($args[0] == $nargs[0] )
- && ($args[2] + $args[1] == $nargs[2])
- ) {
- die unless scalar(@nargs) == 3;
- $args[1] += $nargs[1];
- $args[1] .= "\n";
- die unless scalar(@args) == 3;
- #print STDOUT "combining $n $op @args\n";
- $n++;
- } else {
-# print STDERR "not combinging\n";
- unshift( @file, $nop, @nargs );
- die unless scalar(@args) == 3;
- last;
- }
- }
- print $op;
- print join('', @args);
-}
+++ /dev/null
-#!/bin/sh -e
-
-ip=`cat /proc/cmdline | sed 's/ /\n/g' | grep '^ip=' | cut -d = -f 2`
-gw=`cat /proc/cmdline | sed 's/ /\n/g' | grep '^gw=' | cut -d = -f 2`
-nm=`cat /proc/cmdline | sed 's/ /\n/g' | grep '^netmask=' | cut -d = -f 2`
-
-if [ -n "$ip" ]; then
- echo
- echo "Configuring eth0 with $ip netmask $nm gw $gw (via /proc/cmdline)"
- ifconfig eth0 $ip netmask $netmask
- route add default gw $gw
-fi
-
-exit 0
+++ /dev/null
-#!/usr/bin/env python
-
-import json
-import argparse
-import logging
-import time
-import commands
-
-
-def parse_args():
- parser = argparse.ArgumentParser(description='watch ceph perf')
- parser.add_argument(
- '-v', '--verbose',
- action='store_true', default=None,
- help='be more verbose',
- )
- parser.add_argument(
- '-s', '--socket',
- help='path to admin socket file',
- )
- parser.add_argument(
- 'vars',
- nargs='+',
- help='variable to watch, section.value',
- )
- parser.add_argument(
- '-t', '--time',
- action='store_true',
- default=False,
- help='include relative time column',
- )
- parser.add_argument(
- '--absolute-time',
- action='store_true',
- default=False,
- help='include absolute time column',
- )
- args = parser.parse_args()
- return args
-
-
-def main():
- ctx = parse_args()
- log = logging.getLogger(__name__)
- loglevel = logging.INFO
- if ctx.verbose:
- loglevel = logging.DEBUG
-
- logging.basicConfig(
- level=loglevel,
- )
-
- log.info('ctx %s', ctx)
-
- # check schema
- (code, raw) = commands.getstatusoutput('./ceph --admin-daemon %s perf schema' % ctx.socket)
- schema = json.loads(raw)
-
- # normalize var list
- vars = []
- vartype = {}
- for v in ctx.vars:
- if v.find('.') < 0:
- if v in schema:
- for var in schema[v].iterkeys():
- vv = '%s.%s' % (v, var)
- vars.append(vv)
- vartype[vv] = int(schema[v][var]['type'])
-
- else:
- (sec, var) = v.split('.')
- if sec in schema and var in schema[sec]:
- vars.append(v)
- vartype[v] = int(schema[sec][var]['type'])
- else:
- log.warning('%s not present in schema', v)
-
- log.info('vars are %s', vars)
- log.info('vartype is %s', vartype)
-
- varline = '#'
- if ctx.time or ctx.absolute_time:
- varline = varline + ' %8s' % 'time'
- for v in vars:
- varline = varline + (' %8s' % v)
-
- print_count = 0
- prev = None
- start = time.time()
- while True:
- if print_count % 10 == 0:
- print(varline)
- print_count += 1
-
- (code, raw) = commands.getstatusoutput('./ceph --admin-daemon %s perf dump' % ctx.socket)
- perfstats = json.loads(raw)
- if prev is None:
- prev = perfstats
-
- vline = ' '
- now = time.time()
- if ctx.absolute_time:
- vline = '%10d' % int(now)
- elif ctx.time:
- vline = '%10d' % int(now - start)
-
- for v in vars:
- (sec, var) = v.split('.')
- val = 0
- if sec in perfstats and var in perfstats[sec]:
-
- formatstr = '%' + str(max(len(v), 8))
- if vartype[v] & 1:
- formatstr = formatstr + 'f'
- else:
- formatstr = formatstr + 'd'
-
- val = 0
- if vartype[v] & 4:
- den = (perfstats[sec][var]['avgcount'] - perfstats[sec][var]['avgcount'])
- if den > 0:
- val = (perfstats[sec][var]['sum'] - prev[sec][var]['sum']) / den
- elif vartype[v] & 8:
- val = perfstats[sec][var] - prev[sec][var]
- else:
- val = perfstats[sec][var]
-
- vline = vline + ' ' + (formatstr % val)
- print(vline)
-
- prev = perfstats
- time.sleep(1)
-
-
-main()
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-my @lines = <>;
-
-while (@lines) {
- my $r = int rand(scalar(@lines));
- print $lines[$r];
- splice(@lines, $r, 1);
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-
-my $dir = shift @ARGV;
-my ($type,$subtype) = split(/\./, shift @ARGV);
-$subtype = '.' . $subtype if $subtype;
-
-# list files
-my @files;
-my %fields;
-for my $f (`ls $dir/$type*$subtype`) {
- chomp $f;
- next unless $f =~ /$type(\d+)$subtype$/;
- push(@files, $f);
- unless (%fields) {
- open(I,$f);
- while (<I>) {
- next unless /^\#/;
- my @f = split(/\t/,$_);
- for (my $n=1; @f; $n++) {
- my $f = shift @f;
- $fields{$f} = $n;
- #print "$f = $n\n";
- }
- last;
- }
- close I;
- }
-}
-#print "#files @files\n";
-
-# get field names
-my $var = shift @ARGV;
-my $rest = join(' ', @ARGV);
-
-print "set style data lines\nset grid\n";
-print "set title \"$dir .. $var\"\n";
-if (scalar(@files) > 30) { print "set key off\n"; }
-#for my $var (@ARGV) {
- my @p;
- for my $f (@files) {
- my ($lastbit) = $f =~ /\/([^\/]+)$/;
- push(@p, "\"$f\" u 1:$fields{$var} $rest t \"$lastbit\"");
- }
- print "plot " . join(',', @p) . "\n";
-#}
-#print "pause 60000\n";
+++ /dev/null
-#!/usr/bin/perl
-
-my $rank = shift @ARGV;
-my $args = join(' ',@ARGV);
-if ($rank == $ENV{MPD_JRANK}) {
- $c = "LD_PRELOAD=$ENV{'HOME'}/csl/obsd/src/pmds/gprof-helper.so ./newsyn $args";
-} else {
- $c = "./newsyn.nopg $args";
-}
-
-#print "$rank: $c\n";
-system $c;
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use Data::Dumper;
-
-
-my $usage = "script/runset.pl [--clean] jobs/some/job blah\n";
-
-my $clean;
-my $use_srun = 0;
-my $nobg = '&';
-my $in = shift || die $usage;
-if ($in eq '--clean') {
- $clean = 1;
- $in = shift || die $usage;
-}
-if ($in eq '--srun') {
- $use_srun = 1;
- $in = shift || die $usage;
-}
-if ($in eq '--nobg') {
- $nobg = '';
- $in = shift || die $usage;
-}
-my $tag = shift || die $usage;
-my $fake = shift;
-
-
-my ($job) = $in =~ /^jobs\/(.*)/;
-my ($jname) = $job =~ /\/(\w+)$/;
-$jname ||= $job;
-die "not jobs/?" unless defined $job;
-my $out = "log/$job.$tag";
-my $relout = "$job.$tag";
-
-
-my $cwd = `/bin/pwd`;
-chomp($cwd);
-
-
-
-print "# --- job $job, tag $tag ---\n";
-
-
-# get input
-my $raw = `cat $in`;
-my $sim = eval $raw;
-unless (ref $sim) {
- print "bad input: $in\n";
- system "perl -c $in";
- exit 1;
-}
-
-# prep output
-system "mkdir -p $out" unless -d "$out";
-
-open(W, ">$out/in");
-print W $raw;
-close W;
-
-my $comb = $sim->{'_comb'};
-delete $sim->{'_comb'};
-my %filters;
-my @fulldirs;
-
-
-
-sub reset {
- print "reset: restarting mpd in 3 seconds\n";
- system "sleep 3 && (mpiexec -l -n 32 killall newsyn ; restartmpd.sh)";
- print "reset: done\n";
-}
-
-
-if (`hostname` =~ /alc/ && !$use_srun) {
- print "# this looks like alc\n";
- $sim->{'_psub'} = 'jobs/alc.tp';
-}
-
-
-sub iterate {
- my $sim = shift @_;
- my $fix = shift @_ || {};
- my $vary;
- my @r;
-
- my $this;
- for my $k (sort keys %$sim) {
- #next if $k =~ /^_/;
- if (defined $fix->{$k}) {
- $this->{$k} = $fix->{$k};
- }
- elsif (ref $sim->{$k} eq 'HASH') {
- # nothing
- }
- elsif ($k =~ /^_/ || !(ref $sim->{$k})) {
- $this->{$k} = $sim->{$k};
- }
- else {
- #print ref $sim->{$k};
- if (!(defined $vary)) {
- $vary = $k;
- }
- }
- }
-
- if ($vary) {
- #print "vary $vary\n";
- for my $v (@{$sim->{$vary}}) {
- $this->{$vary} = $v;
- push(@r, &iterate($sim, $this));
- }
- } else {
-
- if ($sim->{'_dep'}) {
- my @s = @{$sim->{'_dep'}};
- while (@s) {
- my $dv = shift @s;
- my $eq = shift @s;
-
- $eq =~ s/\$(\w+)/"\$this->{'$1'}"/eg;
- $this->{$dv} = eval $eq;
- #print "$dv : $eq -> $this->{$dv}\n";
- }
- }
-
- push(@r, $this);
- }
- return @r;
-}
-
-
-
-sub run {
- my $h = shift @_;
-
- my @fn;
- my @filt;
- my @vals;
- for my $k (sort keys %$sim) {
- next if $k =~ /^_/;
- next unless ref $sim->{$k} eq 'ARRAY';
- push(@fn, "$k=$h->{$k}");
- push(@vals, $h->{$k});
- next if $comb && $k eq $comb->{'x'};
- push(@filt, "$k=$h->{$k}");
- }
- my $keys = join(",", @fn);
- $keys =~ s/ /_/g;
- my $fn = $out . '/' . $keys;
- my $name = $jname . '_' . join('_',@vals); #$tag . '_' . $keys;
-
- push( @fulldirs, "" . $fn );
-
-
- # filters
- $filters{ join(',', @filt) } = 1;
-
-
- #system "sh $fn/sh.post" if -e "$fn/sh.post";# && !(-e "$fn/.post");
-
- if (-e "$fn/.done") {
- print "already done.\n";
- return;
- }
- system "rm -r $fn" if $clean && -d "$fn";
- system "mkdir $fn" unless -d "$fn";
- system "mkdir $fn/out" unless -d "$fn/out";
-
- my $e = './newsyn';
- #$e = './tcpsynobfs' if $h->{'fs'} eq 'obfs';
- my $c = "$e";
- $c .= " --mkfs" unless $h->{'_no_mkfs'};
-
- for my $k (keys %$h) {
- next if $k =~ /^_/;
- next if $h->{'_noarg'} && grep {$k eq $_} @{$h->{'_noarg'}};
- next if $h->{'_subst'} && grep {$k eq $_} @{$h->{'_subst'}};
- $c .= " --$k $h->{$k}";
- }
-
- if ($h->{'_custom'}) {
- if ($h->{'_subst'}) {
- for my $var (@{$h->{'_subst'}}) {
- $h->{'_custom'} =~ s/\$$var/$h->{$var}/g;
- }
- }
- $c .= ' ' . $h->{'_custom'};
- }
-
- $c .= " --log_name $relout/$keys";
- $c .= " --doutdir log/$relout/$keys/out";
-
- my $post = "#!/bin/sh
-script/sum.pl -start $h->{'_start'} -end $h->{'_end'} $fn/osd\\* > $fn/sum.osd
-script/sum.pl -start $h->{'_start'} -end $h->{'_end'} $fn/mds? $fn/mds?? > $fn/sum.mds
-script/sum.pl -start $h->{'_start'} -end $h->{'_end'} $fn/mds*.log > $fn/sum.mds.log
-script/sum.pl -start $h->{'_start'} -end $h->{'_end'} $fn/clnode* > $fn/sum.cl
-touch $fn/.post
-";
- open(O,">$fn/sh.post");
- print O $post;
- close O;
-
- my $killmin;
- if ($h->{'_kill_after'}) {
- $killmin = 1 + int ($h->{'_kill_after'} / 60);
- $killmin = "-t $killmin";
- }
-
- $c = "bash -c \"ulimit -c 0 ; $c\"";
- #$c = "bash -c \"$c\"";
-
- #print "h keys are " . join(' ', sort keys %$h) . "\n";
-
- my $srun = "srun --wait=600 -x jobs/ltest.ignore -l $killmin -N $h->{'_n'} -p ltest";
- my $mpiexec = "mpiexec -l -n $h->{'_n'}";
- my $launch;
- if ($use_srun) {
- $launch = $srun;
- } else {
- $launch = $mpiexec;
- }
-
- if ($sim->{'_psub'}) {
- # template!
- my $tp = `cat $sim->{'_psub'}`;
- $tp =~ s/\$CWD/$cwd/g;
- $tp =~ s/\$NAME/$name/g;
- $tp =~ s/\$NUM/$h->{'_n'}/g;
- $tp =~ s/\$OUT/$fn\/o/g;
- $tp =~ s/\$DONE/$fn\/.done/g;
- $tp =~ s/\$CMD/$c/g;
- open(O,">$out/$name");
- print O $tp;
- close O;
- print "\npsub $out/$name\n";
- return;
- } else {
- # run
- my $cmd = "\n$launch $c > $fn/o && touch $fn/.done";#
- #my $cmd = "\n$launch $c > $fn/o ; touch $fn/.done";
- print "$cmd $nobg\n";
- my $r = undef;
- unless ($fake) {
- if ($sim->{'_pre'}) {
- print "pre: $launch $sim->{'_pre'}\n";
- system "$launch $sim->{'_pre'}";
- }
- $r = system $cmd;
- if ($sim->{'_post'}) {
- print "post: $launch $sim->{'_post'}\n";
- system "$launch $sim->{'_post'}";
- }
- if ($r) {
- print "r = $r\n";
- #&reset;
- }
- system "sh $fn/sh.post";
- }
- return $r;
- }
-}
-
-
-
-my @r = &iterate($sim);
-my $n = scalar(@r);
-my $c = 1;
-my %r;
-my $nfailed = 0;
-for my $h (@r) {
- my $d = `date`;
- chomp($d);
- $d =~ s/ P.T .*//;
- print "# === $c/$n";
- print " ($nfailed failed)" if $nfailed;
- print " $d: ";
- my $r = &run($h);
-
- if (!(defined $r)) {
- # already done
- } else {
- if ($r) {
- $nfailed++;
- }
- print "sleep $h->{'_sleep'}\n";
- sleep $h->{'_sleep'};
- }
-
- $c++;
-}
-print "$nfailed failed\n";
-
-
-my @comb;
-if ($comb) {
- my $x = $comb->{'x'};
- my @vars = @{$comb->{'vars'}};
-
- print "\n\n# post\n";
- for my $p (@fulldirs) {
- print "sh $p/sh.post\n";
- }
-
- my @filters = sort keys %filters;
- my $cmd = "script/comb.pl $x @vars - @fulldirs - @filters > $out/c";
- print "$cmd\n";
- open(O,">$out/comb");
- print O "$cmd\n";
- close O;
- system $cmd;
-
- print "\n\n";
-
- my $plot;
- $plot .= "set data style linespoints;\n";
- my $s = 2;
- for my $v (@vars) {
- my $c = $s;
- $s++;
- my @p;
- for my $f (@filters) {
- my $t = $f;
- if ($comb->{'maptitle'}) {
- for my $a (keys %{$comb->{'maptitle'}}) {
- my $b = $comb->{'maptitle'}->{$a};
- $t =~ s/$a/$b/;
- }
- }
- push (@p, "\"$out/c\" u 1:$c t \"$t\"" );
- $c += scalar(@vars);
- }
- $plot .= "# $v\nplot " . join(", ", @p) . ";\n\n";
- }
- print $plot;
- open(O,">$out/plot");
- print O $plot;
- close O;
-}
-
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-use Data::Dumper;
-
-=item sample input file
-
-# hi there
-{
- # startup
- 'n' => 30, # mpi nodes
- 'sleep' => 10, # seconds between runs
- 'nummds' => 1,
- 'numosd' => 8,
- 'numclient' => 400,#[10, 50, 100, 200, 400],
-
- # parameters
- 'fs' => [ 'fakestore' ],
- 'until' => 150, # --syn until $n ... when to stop clients
- 'writefile' => 1,
- 'writefile_size' => [ 4096, 65526, 256000, 1024000, 2560000 ],
- 'writefile_mb' => 1000,
-
- 'custom' => '--tcp_skip_rank0 --osd_maxthreads 0';
-
- # for final summation (script/sum.pl)
- 'start' => 30,
- 'end' => 120,
-
- '_psub' => 'alc.tp' # switch to psub mode!
-};
-
-=cut
-
-my $usage = "script/runset.pl [--clean] jobs/some/job blah\n";
-
-my $clean;
-my $use_srun;
-my $nobg = '&';
-my $in = shift || die $usage;
-if ($in eq '--clean') {
- $clean = 1;
- $in = shift || die $usage;
-}
-if ($in eq '--srun') {
- $use_srun = 1;
- $in = shift || die $usage;
-}
-if ($in eq '--nobg') {
- $nobg = '';
- $in = shift || die $usage;
-}
-my $tag = shift || die $usage;
-my $fake = shift;
-
-
-my ($job) = $in =~ /^jobs\/(.*)/;
-my ($jname) = $job =~ /\/(\w+)$/;
-$jname ||= $job;
-die "not jobs/?" unless defined $job;
-my $out = "log/$job.$tag";
-my $relout = "$job.$tag";
-
-
-my $cwd = `/bin/pwd`;
-chomp($cwd);
-
-
-
-print "# --- job $job, tag $tag ---\n";
-
-
-# get input
-my $raw = `cat $in`;
-my $sim = eval $raw;
-unless (ref $sim) {
- print "bad input: $in\n";
- system "perl -c $in";
- exit 1;
-}
-
-# prep output
-system "mkdir -p $out" unless -d "$out";
-
-open(W, ">$out/in");
-print W $raw;
-close W;
-
-my $comb = $sim->{'comb'};
-delete $sim->{'comb'};
-my %filters;
-my @fulldirs;
-
-
-
-sub reset {
- print "reset: restarting mpd in 3 seconds\n";
- system "sleep 3 && (mpiexec -l -n 32 killall newsyn ; restartmpd.sh)";
- print "reset: done\n";
-}
-
-
-if (`hostname` =~ /alc/ && !$use_srun) {
- print "# this looks like alc\n";
- $sim->{'_psub'} = 'jobs/alc.tp';
-}
-
-
-sub iterate {
- my $sim = shift @_;
- my $fix = shift @_ || {};
- my $vary;
- my @r;
-
- my $this;
- for my $k (sort keys %$sim) {
- next if $k =~ /^_/;
- if (defined $fix->{$k}) {
- $this->{$k} = $fix->{$k};
- }
- elsif (ref $sim->{$k} eq 'HASH') {
- # nothing
- }
- elsif (!(ref $sim->{$k})) {
- $this->{$k} = $sim->{$k};
- }
- else {
- #print ref $sim->{$k};
- if (!(defined $vary)) {
- $vary = $k;
- }
- }
- }
-
- if ($vary) {
- #print "vary $vary\n";
- for my $v (@{$sim->{$vary}}) {
- $this->{$vary} = $v;
- push(@r, &iterate($sim, $this));
- }
- } else {
-
- if ($sim->{'_dep'}) {
- my @s = @{$sim->{'_dep'}};
- while (@s) {
- my $dv = shift @s;
- my $eq = shift @s;
-
- $eq =~ s/\$(\w+)/"\$this->{'$1'}"/eg;
- $this->{$dv} = eval $eq;
- #print "$dv : $eq -> $this->{$dv}\n";
- }
- }
-
- push(@r, $this);
- }
- return @r;
-}
-
-
-
-sub run {
- my $h = shift @_;
-
- my @fn;
- my @filt;
- my @vals;
- for my $k (sort keys %$sim) {
- next if $k =~ /^_/;
- next unless ref $sim->{$k} eq 'ARRAY';
- push(@fn, "$k=$h->{$k}");
- push(@vals, $h->{$k});
- next if $comb && $k eq $comb->{'x'};
- push(@filt, "$k=$h->{$k}");
- }
- my $keys = join(",", @fn);
- $keys =~ s/ /_/g;
- my $fn = $out . '/' . $keys;
- my $name = $jname . '_' . join('_',@vals); #$tag . '_' . $keys;
-
- push( @fulldirs, "" . $fn );
-
-
- # filters
- $filters{ join(',', @filt) } = 1;
-
-
- #system "sh $fn/sh.post" if -e "$fn/sh.post";# && !(-e "$fn/.post");
- if (-e "$fn/.done") {
- print "already done.\n";
- return;
- }
- system "rm -r $fn" if $clean && -d "$fn";
- system "mkdir $fn" unless -d "$fn";
-
- my $e = './newsyn';
- #$e = './tcpsynobfs' if $h->{'fs'} eq 'obfs';
- my $c = "$e";
- $c .= " --mkfs" unless $h->{'no_mkfs'};
- $c .= " --$h->{'fs'}" if $h->{'fs'};
- $c .= " --syn until $h->{'until'}" if $h->{'until'};
-
- $c .= " --syn writefile $h->{'writefile_mb'} $h->{'writefile_size'}" if $h->{'writefile'};
- $c .= " --syn rw $h->{'rw_mb'} $h->{'rw_size'}" if $h->{'rw'};
- $c .= " --syn readfile $h->{'readfile_mb'} $h->{'readfile_size'}" if $h->{'readfile'};
- $c .= " --syn makedirs $h->{'makedirs_dirs'} $h->{'makedirs_files'} $h->{'makedirs_depth'}" if $h->{'makedirs'};
-
- for my $k ('nummds', 'numclient', 'numosd', 'kill_after',
- 'osd_maxthreads', 'osd_object_layout', 'osd_pg_layout','osd_pg_bits',
- 'mds_bal_rep', 'mds_bal_interval', 'mds_bal_max','mds_decay_halflife',
- 'mds_bal_hash_rd','mds_bal_hash_wr','mds_bal_unhash_rd','mds_bal_unhash_wr',
- 'mds_cache_size','mds_log_max_len',
- 'mds_local_osd',
- 'osd_age_time','osd_age',
- 'osd_rep',
- 'osd_pad_pg_log',
- 'osd_balance_reads',
- 'tcp_multi_out',
- 'client_cache_stat_ttl','client_cache_readdir_ttl',
- 'client_oc',
- 'fake_osdmap_updates',
- 'bdev_el_bidir',
- 'file_layout_ssize','file_layout_scount','file_layout_osize','file_layout_num_rep',
- 'meta_dir_layout_ssize','meta_dir_layout_scount','meta_dir_layout_osize','meta_dir_layout_num_rep',
- 'meta_log_layout_ssize','meta_log_layout_scount','meta_log_layout_osize','meta_log_layout_num_rep') {
- $c .= " --$k $h->{$k}" if defined $h->{$k};
- }
-
- $c .= ' ' . $h->{'custom'} if $h->{'custom'};
-
- $c .= " --log_name $relout/$keys";
-
- my $post = "#!/bin/sh
-script/sum.pl -start $h->{'start'} -end $h->{'end'} $fn/osd\\* > $fn/sum.osd
-script/sum.pl -start $h->{'start'} -end $h->{'end'} $fn/mds? $fn/mds?? > $fn/sum.mds
-script/sum.pl -start $h->{'start'} -end $h->{'end'} $fn/mds*.log > $fn/sum.mds.log
-script/sum.pl -start $h->{'start'} -end $h->{'end'} $fn/clnode* > $fn/sum.cl
-touch $fn/.post
-";
- open(O,">$fn/sh.post");
- print O $post;
- close O;
-
- my $killmin = 1 + int ($h->{'kill_after'} / 60);
-
- $c = "bash -c \"ulimit -c 0 ; $c\"";
- #$c = "bash -c \"$c\"";
-
- my $srun = "srun --wait=600 --exclude=jobs/ltest.ignore -l -t $killmin -N $h->{'n'} -p ltest";
- my $mpiexec = "mpiexec -l -n $h->{'n'}";
- my $launch;
- if ($use_srun) {
- $launch = $srun;
- } else {
- $launch = $mpiexec;
- }
-
- if ($sim->{'_psub'}) {
- # template!
- my $tp = `cat $sim->{'_psub'}`;
- $tp =~ s/\$CWD/$cwd/g;
- $tp =~ s/\$NAME/$name/g;
- $tp =~ s/\$NUM/$h->{'n'}/g;
- $tp =~ s/\$OUT/$fn\/o/g;
- $tp =~ s/\$DONE/$fn\/.done/g;
- $tp =~ s/\$CMD/$c/g;
- open(O,">$out/$name");
- print O $tp;
- close O;
- print "\npsub $out/$name\n";
- return;
- } else {
- # run
- my $cmd = "\n$launch $c > $fn/o && touch $fn/.done";#
- #my $cmd = "\n$launch $c > $fn/o ; touch $fn/.done";
- print "$cmd $nobg\n";
- my $r = undef;
- unless ($fake) {
- if ($sim->{'_pre'}) {
- print "pre: $launch $sim->{'_pre'}\n";
- system "$launch $sim->{'_pre'}";
- }
- $r = system $cmd;
- if ($sim->{'_post'}) {
- print "post: $launch $sim->{'_post'}\n";
- system "$launch $sim->{'_post'}";
- }
- if ($r) {
- print "r = $r\n";
- #&reset;
- }
- system "sh $fn/sh.post";
- }
- return $r;
- }
-}
-
-
-
-my @r = &iterate($sim);
-my $n = scalar(@r);
-my $c = 1;
-my %r;
-my $nfailed = 0;
-for my $h (@r) {
- my $d = `date`;
- chomp($d);
- $d =~ s/ P.T .*//;
- print "# === $c/$n";
- print " ($nfailed failed)" if $nfailed;
- print " $d: ";
- my $r = &run($h);
-
- if (!(defined $r)) {
- # already done
- } else {
- if ($r) {
- $nfailed++;
- }
- print "sleep $h->{'sleep'}\n";
- sleep $h->{'sleep'};
- }
-
- $c++;
-}
-print "$nfailed failed\n";
-
-
-my @comb;
-if ($comb) {
- my $x = $comb->{'x'};
- my @vars = @{$comb->{'vars'}};
-
- print "\n\n# post\n";
- for my $p (@fulldirs) {
- print "sh $p/sh.post\n";
- }
-
- my @filters = sort keys %filters;
- my $cmd = "script/comb.pl $x @vars - @fulldirs - @filters > $out/c";
- print "$cmd\n";
- open(O,">$out/comb");
- print O "$cmd\n";
- close O;
- system $cmd;
-
- print "\n\n";
-
- my $plot;
- $plot .= "set data style linespoints;\n";
- my $s = 2;
- for my $v (@vars) {
- my $c = $s;
- $s++;
- my @p;
- for my $f (@filters) {
- my $t = $f;
- if ($comb->{'maptitle'}) {
- for my $a (keys %{$comb->{'maptitle'}}) {
- my $b = $comb->{'maptitle'}->{$a};
- $t =~ s/$a/$b/;
- }
- }
- push (@p, "\"$out/c\" u 1:$c t \"$t\"" );
- $c += scalar(@vars);
- }
- $plot .= "# $v\nplot " . join(", ", @p) . ";\n\n";
- }
- print $plot;
- open(O,">$out/plot");
- print O $plot;
- close O;
-}
-
+++ /dev/null
-#!/usr/bin/perl
-
-my $n = shift @ARGV || 2;
-
-my %v; # t -> [..]
-while (<>) {
- chomp;
- my @l = split(/\t/,$_);
- my $t = shift @l;
- if (int $t) {
- $v{$t} = \@l;
- } else {
- print "$_\n";
- }
-}
-
-for my $t (sort {$a <=> $b} keys %v) {
- my $s = $t - $n/2;
- my @v;
- my $c = 0;
- for (my $a=0; $a < $n; $a++) {
- my $x = $t + $a;
- next unless ($v{$x});
- my @o = @{$v{$x}};
- #print "$t: $x o @o\n";
- if (@v) {
- for (my $y=0; $y<=$#o; $y++) {
- $v[$y] += $o[$y];
- }
- } else {
- @v = @o;
- }
- #print "$t: $x v @v\n";
- $c++;
- }
- print "$t";
- for my $sum (@v) {
- print "\t" . ($sum / $c);
- }
- print "\n";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-
-my $name = shift @ARGV || die;
-
-my $nfiles = 0;
-my $ndirs = 0;
-my $nreg = 0;
-my $nhardlinks = 0;
-my %nlinks;
-my %ino_nlinks;
-my %names;
-my %dirsize;
-
-my %fnlen;
-
-my %hdepth;
-
-my $bytes;
-my $ebytes;
-
-#
-# output generated with
-#
-# find . -path ./.snapshot -prune -o -exec ls -dilsn --time-style=+%s \{\} \;
-#
-# find output looks like this:
-#4495744 4 drwxrwxrwx 24 0 0 4096 1187290970 .
-#2996320 8 drwxr-xr-x 189 0 1000 8192 1186594257 ./jangle
-#28378499 4 drwxr-x--x 4 1068885 52673 4096 1162938122 ./jangle/cymcruise
-#28378500 4 drwx--S--- 5 1068885 52673 4096 1162938122 ./jangle/cymcruise/Maildir
-#28378501 4 drwx------ 2 1068885 52673 4096 1162938122 ./jangle/cymcruise/Maildir/tmp
-#28378502 4 drwx------ 2 1068885 52673 4096 1162938122 ./jangle/cymcruise/Maildir/new
-#28378503 4 drwx------ 2 1068885 52673 4096 1162938122 ./jangle/cymcruise/Maildir/cur
-#28378504 4 -rw-r--r-- 1 1068885 52673 260 943743700 ./jangle/cymcruise/.alias
-#999425 4 drwxr-xr-x 92 1125 100 4096 1186523060 .
-#999426 0 lrwxrwxrwx 1 0 0 5 1177701093 ./root -> /root
-#1015809 4 drwxr-xr-x 4 1289 1000 4096 1174584949 ./andrea
-#541007 4 drwxr-xr-x 3 0 0 4096 1173111449 ./andrea/lux
-#5014055 4 drwx--S--- 11 70228 51207 4096 1172250346 ./andrea/lux/Maildir
-
-# dirs we're currently counting in
-my %numindir;
-
-sub finish_dir {
- my $curdir = shift @_;
- #print "finish_dir $numindir{$curdir} in $curdir\n";
- $dirsize{$numindir{$curdir}}++;
- $ndirs++;
- delete $numindir{$curdir};
-}
-
-my $curdir;
-while (<>) {
- #print;
- chomp;
- my ($ino, $blah, $mode, $nlink, $uid, $gid, $size, $mtime, @path) = split(/[ ]+/,$_);
- my $file = join(' ',@path);
- ($file) = split(/ \-\> /, $file); # ignore symlink dest
- my @bits = split(/\//, $file);
- my $depth = scalar(@bits);
- my $f = pop @bits;
- my $dir = join('/', @bits);
- #print "file = '$file', dir = '$dir', curdir = '$curdir'\n";
-
- if ($dir ne $curdir) {
- for my $d (keys %numindir) {
- #print "? $d vs $dir\n";
- &finish_dir($d) if ($d ne substr($dir, 0, length($d)));
- }
- $curdir = $dir;
- }
-
- my $esize = 0;
- $esize = int (($size-1)/4096)*4096 + 4096 if $size > 0;
- $esize += 160; # for the inode?
- $bytes += $size;
- $ebytes += $esize;
-
- $nfiles++;
- $numindir{$dir}++;
-
- $hdepth{$depth}++;
-
- my $fnlen = length($f);
- $fnlen{$fnlen}++;
-
- if ($mode =~ /^d/) {
- # find does depth-first search, so assume we descend, so that on empty dir we "back out" above and &finish_dir.
- $numindir{$file} = 0;
- $curdir = $file;
- } else {
- $nreg++ if $mode =~ /^f/;
- if ($nlink > 1) {
- #system "ls -aldi $file";
- $nhardlinks++;
- $nlinks{$nlink}++;
- $ino_nlinks{$ino} = $nlink;
- push(@{$names{$ino}->{$dir}}, $file);
- }
- }
-}
-for my $d (keys %numindir) {
- &finish_dir($d);
-}
-
-
-
-my $nsamedir = 0;
-open(LOG, ">$name.log");
-my %dirmap; # from dir -> to dir
-for my $ino (keys %names) {
- print LOG "# $ino\n";
- my @dirs = keys %{$names{$ino}};
- my $insamedir = 1 if scalar(@dirs) == 1;
- for my $dir (@dirs) {
- print LOG "#\t$dir\n";
- for my $fn (@{$names{$ino}->{$dir}}) {
- print LOG "#\t\t$fn\n";
- $nsamedir++ if $insamedir;
- }
- }
-
- # stick in dirmap
- for (my $i=0; $i<$#dirs; $i++) {
- for (my $j=1; $j <= $#dirs; $j++) {
- print LOG "# $dirs[$i] <-> $dirs[$j]\n";
- push(@{$dirmap{$dirs[$i]}->{$dirs[$j]}}, $ino);
- push(@{$dirmap{$dirs[$j]}->{$dirs[$i]}}, $ino);
- }
- }
-}
-
-
-my $notherinsamedir = 0;
-my $notherinsamedirs = 0;
-for my $ino (keys %names) {
- my @dirs = keys %{$names{$ino}};
- next unless (scalar(@dirs) > 1);
- my $n = 0;
- my $np = 0;
- for (my $i=0; $i<$#dirs; $i++) {
- for (my $j=$i+1; $j <= $#dirs; $j++) {
- $np++;
- if (scalar(@{$dirmap{$dirs[$i]}->{$dirs[$j]}}) > 1 ||
- scalar(@{$dirmap{$dirs[$j]}->{$dirs[$i]}}) > 1) {
- $n++;
- #print LOG "# $ino is not alone between $dirs[$i] and $dirs[$j] : @{$dirmap{$dirs[$j]}->{$dirs[$i]}}\n";
- }
- }
- }
- if ($n) {
- print LOG "# $ino\tfor $n / $np dir pairs, there is another hl between the same pair of dirs\n";
- $notherinsamedir += $ino_nlinks{$ino};
- $notherinsamedirs += ($n / $np) * $ino_nlinks{$ino};
- } else {
- print LOG "# $ino is ALL ALONE\n";
- }
-}
-close LOG;
-$notherinsamedirs = sprintf("%.1f",$notherinsamedirs);
-
-
-sub do_cdf {
- my $hash = shift @_;
- my $num = shift @_;
- my $fn = shift @_;
-
- open(CDF, ">$fn") if $fn;
- print CDF "# $name\n";
-
- my $median;
- my $sum = 0;
- my $p = 0;
- my $lastv = 0;
- for my $v (sort {$a <=> $b} keys %$hash) {
- print CDF "$v\t$hash->{$v}\n";
- $p += $hash->{$v};
- $sum += $hash->{$v} * $v;
- if (!(defined $median) &&
- $p >= ($num/2)) {
- $median = $v;
- }
- }
- if ($p != $num) {
- warn "uh oh, BUG, $p != $num in cdf/median calculation\n";
- }
- my $avg = sprintf("%.2f", $sum/$num);
- print CDF "# avg $avg, median $median, sum $sum, num $num\n";
- return ($avg, $median);
-}
-close DSLOG;
-
-
-# do cdfs
-my ($avgdirsize, $mediandirsize) = &do_cdf(\%dirsize, $ndirs, "$name.ds");
-my ($avgfnlen, $medianfnlen) = &do_cdf(\%fnlen, $nfiles, "$name.fnlen");
-my ($avgdepth, $mediandepth) = &do_cdf(\%hdepth, $nfiles, "$name.hdepth");
-
-
-# stat fs
-#my $df = `df $base`;
-#my $line = (split(/\n/,$df))[1]; # second line
-#my ($kb) = $df =~ /\s+\d+\s+(\d+)/;
-my $gb = sprintf("%.1f",($ebytes / 1024 / 1024 / 1024));
-
-open(O, ">$name.sum");
-
-# final line
-my $pad = '# ' . (' ' x (length($name)-2));
-print O "$pad\tgb\tfiles\tdirs\tdsavg\tdsmed\tfnavg\tfnmed\treg\tnl>1\tsmdr\tothers\totherss\tnlink=2\t=3\t=4\t...\n";
-print O "$name\t$gb\t$nfiles\t$ndirs\t$avgdirsize\t$mediandirsize\t$avgfnlen\t$medianfnlen\t$nreg\t$nhardlinks\t$nsamedir\t$notherinsamedir\t$notherinsamedirs";
-my $i = 2;
-for (sort {$a <=> $b} keys %nlinks) {
- while ($_ < $i) {
- print O "\t0";
- }
- print O "\t$nlinks{$_}";
- $i = $_ + 1;
-}
-print O "\n";
-
-close O;
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-
-my %ns; # parent -> fn -> ino
-my %nlink; # num links to each ino
-my %since; # when it got its second link
-
-my @ignore = ('ll_getattr','ll_setattr','ll_forget','ll_fsync','ll_readlink','ll_statfs','ll_opendir','ll_releasedir','ll_flush','ll_release','ll_open','ll_read','ll_write');
-
-my $when;
-
-my $sumage;
-my $numage;
-
-sub unlink {
- my ($p,$n) = @_;
- my $i = $ns{$p}->{$n};
- my $new = --$nlink{$i};
- if ($new == 1) {
- my $age = $when - $since{$i};
- #print "$since{$i} to $when on $i\t$age\n";
- delete $since{$i};
-
- $numage++;
- $sumage += $age;
-
- } elsif ($new == 0) {
- delete $nlink{$i};
- }
- delete $ns{$p}->{$n};
-}
-
-
-my ($sec, $usec, $cmd);
-$_ = <>;
-while (1) {
- # read trace record
- chomp;
- last unless $_ eq '@';
-
- chomp(my $sec = <>);
- chomp(my $usec = <>);
- $when = sprintf("%d.%06d",$sec,$usec);# + ($usec / 1000000);
- #$when = "$sec.$usec";
-
- chomp($cmd = <>);
-
- #print "cmd $cmd\n";
-
- if ($cmd eq 'll_lookup') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- chomp(my $r = <>);
- $ns{$p}->{$n} = $r;
- }
-
- elsif ($cmd eq 'll_create') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- <>; <>; <>;
- chomp(my $r = <>);
- $ns{$p}->{$n} = $r;
- $nlink{$r} = 1;
- }
- elsif ($cmd eq 'll_mknod') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- <>; <>;
- chomp(my $r = <>);
- $ns{$p}->{$n} = $r;
- $nlink{$r} = 1;
- }
- elsif ($cmd eq 'll_mkdir') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- <>;
- chomp(my $r = <>);
- $ns{$p}->{$n} = $r;
- $nlink{$r} = 1;
- }
- elsif ($cmd eq 'll_symlink') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- <>;
- chomp(my $r = <>);
- $ns{$p}->{$n} = $r;
- $nlink{$r} = 1;
- }
- elsif ($cmd eq 'll_link') {
- chomp(my $i = <>);
- chomp(my $p = <>);
- chomp(my $n = <>);
- $ns{$p}->{$n} = $i;
- if (++$nlink{$i} == 2) {
- $since{$i} = $when;
- }
- }
- elsif ($cmd eq 'll_unlink' ||
- $cmd eq 'll_rmdir') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- &unlink($p, $n);
- }
- elsif ($cmd eq 'll_rename') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- chomp(my $np = <>);
- chomp(my $nn = <>);
- if ($ns{$np}->{$nn}) {
- &unlink($np, $nn);
- }
- $ns{$np}->{$nn} = $ns{$p}->{$n};
- delete $ns{$p}->{$n};
- }
-
- # skip to @
- while (<>) {
- last if $_ eq "@\n";
- print "$cmd: $_"
- unless grep {$_ eq $cmd} @ignore;
- }
-}
-
-print "num $numage .. sum $sumage .. avg lifetime " . ($sumage / $numage) . "\n";
-
-# dump hard link inos
-for my $ino (keys %nlink) {
- next if $nlink{$ino} < 2;
- print "$ino\t$nlink{$ino}\n";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-
-my @buckets = (1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096);
-
-my %dir_miss; # dir(ino) -> last lookup miss
-my %dir_has; # ino -> dentries we have
-
-
-my %ns; # parent -> fn -> ino
-my %nlink; # num links to each ino
-my %since; # when it got its second link
-
-my @ignore = ('ll_getattr','ll_setattr','ll_forget','ll_fsync','ll_readlink','ll_statfs','ll_opendir','ll_releasedir','ll_flush','ll_release','ll_open','ll_read','ll_write');
-
-my $when;
-
-my $sumage;
-my $numage;
-
-sub unlink {
- my ($p,$n) = @_;
- my $i = $ns{$p}->{$n};
- my $new = --$nlink{$i};
- if ($new == 1) {
- my $age = $when - $since{$i};
- #print "$since{$i} to $when on $i\t$age\n";
- delete $since{$i};
-
- $numage++;
- $sumage += $age;
-
- } elsif ($new == 0) {
- delete $nlink{$i};
- }
- delete $ns{$p}->{$n};
-}
-
-
-my ($sec, $usec, $cmd);
-$_ = <>;
-while (1) {
- # read trace record
- chomp;
- last unless $_ eq '@';
-
- chomp(my $sec = <>);
- chomp(my $usec = <>);
- $when = sprintf("%d.%06d",$sec,$usec);# + ($usec / 1000000);
- #$when = "$sec.$usec";
-
- chomp($cmd = <>);
-
- #print "cmd $cmd\n";
-
- if ($cmd eq 'll_lookup') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- chomp(my $r = <>);
- $ns{$p}->{$n} = $r;
- }
-
- elsif ($cmd eq 'll_create') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- <>; <>; <>;
- chomp(my $r = <>);
- $ns{$p}->{$n} = $r;
- $nlink{$r} = 1;
- }
- elsif ($cmd eq 'll_mknod') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- <>; <>;
- chomp(my $r = <>);
- $ns{$p}->{$n} = $r;
- $nlink{$r} = 1;
- }
- elsif ($cmd eq 'll_mkdir') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- <>;
- chomp(my $r = <>);
- $ns{$p}->{$n} = $r;
- $nlink{$r} = 1;
- }
- elsif ($cmd eq 'll_symlink') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- <>;
- chomp(my $r = <>);
- $ns{$p}->{$n} = $r;
- $nlink{$r} = 1;
- }
- elsif ($cmd eq 'll_link') {
- chomp(my $i = <>);
- chomp(my $p = <>);
- chomp(my $n = <>);
- $ns{$p}->{$n} = $i;
- if (++$nlink{$i} == 2) {
- $since{$i} = $when;
- }
- }
- elsif ($cmd eq 'll_unlink' ||
- $cmd eq 'll_rmdir') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- &unlink($p, $n);
- }
- elsif ($cmd eq 'll_rename') {
- chomp(my $p = <>);
- chomp(my $n = <>);
- chomp(my $np = <>);
- chomp(my $nn = <>);
- if ($ns{$np}->{$nn}) {
- &unlink($np, $nn);
- }
- $ns{$np}->{$nn} = $ns{$p}->{$n};
- delete $ns{$p}->{$n};
- }
-
- # skip to @
- while (<>) {
- last if $_ eq "@\n";
- print "$cmd: $_"
- unless grep {$_ eq $cmd} @ignore;
- }
-}
-
-print "num $numage .. sum $sumage .. avg lifetime " . ($sumage / $numage) . "\n";
-
-# dump hard link inos
-for my $ino (keys %nlink) {
- next if $nlink{$ino} < 2;
- print "$ino\t$nlink{$ino}\n";
-}
+++ /dev/null
-#!/usr/bin/perl
-
-use strict;
-my $starttime = 1;
-my $endtime = -1;
-
-my $avgrows = 0;
-
-while ($ARGV[0] =~ /^-/) {
- $_ = shift @ARGV;
- if ($_ eq '-avg') {
- $avgrows = 1;
- }
- elsif ($_ eq '-start') {
- $starttime = shift @ARGV;
- }
- elsif ($_ eq '-end') {
- $endtime = shift @ARGV;
- }
- else {
- die "i don't understand arg $_";
- }
-}
-my @files = @ARGV;
-
-if (scalar(@files) == 1 && $files[0] =~ /\*/) {
- my ($dir, $pat) = $files[0] =~ /^(.*)\/([^\/]+)$/;
- @files = ();
- $pat =~ s/\*//;
-# print "dir $dir pat $pat\n";
- opendir(D,"$dir");
- for my $f (readdir(D)) {
- # print "$f\n";
- next unless $f =~ /^$pat/;
- push(@files, "$dir/$f");
- }
- closedir(D);
-
-# print "files = @files\n";
-}
-
-my @data;
-for my $f (@files) {
- open(I,$f);
- push( @data, <I> );
- close I;
-}
-
-my %sum; # time -> name -> val
-my %col; # colnum -> name .. colnums start at 0 (time doesn't count)
-my %min;
-my %max;
-my %avg;
-my %tcount;
-my $files;
-for (@data) {
- chomp;
- my @r = split(/\s+/,$_);
- my $r = shift @r;
-
- # column headings?
- if ($r =~ /^\#/) {
- my $num = 0;
- while (my $name = shift @r) {
- $col{$num} = $name;
- $num++;
- }
- next;
- }
-
- next unless int $r;
- next if $r < $starttime;
- next if $endtime > 0 && $r > $endtime;
-
- $tcount{$r}++;
- $files = $tcount{$r} if $tcount{$r} > $files;
- #print "$r: @r\n";
- my $i = 0;
- while (@r) {
- my $v = shift @r;
- $sum{$r}->{$col{$i}} += $v; # if $v > 0;
-
- $min{$col{$i}} = $v
- if ($min{$col{$i}} > $v || !(defined $min{$col{$i}}));
- $max{$col{$i}} = $v
- if ($max{$col{$i}} < $v);
-
- $avg{$col{$i}} += $v;
- $i++;
- }
-}
-
-## dump
-my @c = sort {$a <=> $b} keys %col;
-# cols
-print join("\t",'#', map { $col{$_} } @c) . "\n";
-my $n = 0;
-for my $k (sort {$a <=> $b} keys %sum) {
- if ($avgrows) {
- print join("\t",$k, #map int,
- map { $sum{$k}->{$col{$_}}/$tcount{$k} } @c ) . "\n";
- } else {
- print join("\t",$k, map { $sum{$k}->{$col{$_}} } @c ) . "\n";
- }
- $n++;
-}
-
-my $rows = $n || 1;
-#my $files = $tcount{$starttime};
-my %avgval;
-
-## devt
-#warn "rows $rows, files $files\n";
-my %avgvalvart; # std dev of each col avg, over time
-for my $k (keys %avg) {
- my $av = $avgval{$k} = $avg{$k} / ($rows*$files);
-
- my $var = 0.0;
- for my $t (sort {$a <=> $b} keys %sum) {
- my $a = $sum{$t}->{$k} / $files;
- $var += ($a - $av) * ($a - $av);
- }
-
- $avgvalvart{$k} = $var / $rows;
-}
-
-
-
-
-print "\n";
-print join("\t",'#', map { $col{$_} } @c) . "\n";
-print join("\t", '#minval', map { $min{$col{$_}} } @c ) . "\n";
-print join("\t", '#maxval', map { $max{$col{$_}} } @c ) . "\n";
-print join("\t", '#rows', map { $rows } @c) . "\n";
-print join("\t", '#files', map { $files } @c) . "\n";
-print join("\t", '#sum',
- map { $avg{$col{$_}} } @c ) . "\n";
-print join("\t", '#avgval', #map int,
- map { $avgval{$col{$_}} } @c ) . "\n";
-# map { ($rows*$files) ? ($_ / ($rows*$files)):0 } map { $avg{$col{$_}} } @c ) . "\n";
-
-print join("\t", '#avgvalvart',
- map { $avgvalvart{$col{$_}} } @c ) . "\n";
-print join("\t", '#avgvaldevt',
- map { sqrt($_) } map { $avgvalvart{$col{$_}} } @c ) . "\n";
-
-print join("\t", '#avgsum', #map int,
- map { $_ / $rows } map { $avg{$col{$_}} } @c ) . "\n";