#!/usr/bin/perl # # find-outlyers -- Extract statistical outlyers from the jobdist.dat file # generated by jobstats # Copyright 2006 Ohio Supercomputer Center # # License: GNU GPL v2; see ../COPYING for details. # Revision info: # $HeadURL$ # $Revision$ # $Date$ # # Usage: find-outlyers [-f file] [-q queue_time_threshold] # [ -m mem_per_proc_theshold] [-t run_time_threshold] # # At least one of {-m,-q,-t} must be specified. If more than one is specified, # any job fitting any one of the criteria will be printed. # # If no file is specified, STDIN is used. open(FILE,"<-"); # argument parsing while ( $ARGV[0] =~ /^-.*/ ) { if ( $ARGV[0] eq "-f" ) { close(FILE); open(FILE,"<$ARGV[1]"); shift(@ARGV); } elsif ( $ARGV[0] eq "-m" ) { $maxmem=$ARGV[1]; shift(@ARGV); } elsif ( $ARGV[0] eq "-q" ) { $maxqtime=$ARGV[1]; shift(@ARGV); } elsif ( $ARGV[0] eq "-t" ) { $maxtime=$ARGV[1]; shift(@ARGV); } else { print STDERR "$0: Unrecognized argument $ARGV[0]\n"; } shift(@ARGV); } # process input while ( ) { chop; # ignore comments and whitespace if ( !( $_ =~ m/^#.*$/ ) && !( $_ =~ m/^\s$/ ) ) { ($jobid,$procs,$qtime,$runtime,$mem)=split(/\s+/); if ( ( defined($maxqtime) && $qtime>$maxqtime ) || ( defined($maxtime) && $runtime>$maxtime ) || ( defined($maxmem) && ($mem/$nprocs)>$maxmem ) ) { print "$_\n"; } } }