Commit 3ce5914c authored by Philip Carns's avatar Philip Carns

fancy argument parsing, ability to specify an output file, etc.


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@38 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 748851f5
...@@ -10,13 +10,19 @@ use TeX::Encode; ...@@ -10,13 +10,19 @@ use TeX::Encode;
use Encode; use Encode;
use File::Temp qw/ tempdir /; use File::Temp qw/ tempdir /;
use Cwd; use Cwd;
use Getopt::Long;
use English;
my $gnuplot = ""; my $gnuplot = "";
my $tmp_dir = tempdir( CLEANUP => 1 ); my $tmp_dir = tempdir( CLEANUP => 1 );
my $orig_dir = getcwd; my $orig_dir = getcwd;
my $output_file = "summary.pdf";
my $input_file = "";
open(TRACE, $ARGV[0]) || die("can't open $ARGV[0] for processing: $!\n"); process_args();
open(TRACE, $input_file) || die("can't open $input_file for processing: $!\n");
$max_access = -1; $max_access = -1;
$max_access_hash = 0; $max_access_hash = 0;
...@@ -347,5 +353,56 @@ system "epstopdf time-summary.eps"; ...@@ -347,5 +353,56 @@ system "epstopdf time-summary.eps";
system "pdflatex -halt-on-error summary.tex > latex.output"; system "pdflatex -halt-on-error summary.tex > latex.output";
system "pdflatex -halt-on-error summary.tex > latex.output2"; system "pdflatex -halt-on-error summary.tex > latex.output2";
# move the summary out to final location # get back out of tmp dir and grab results
system "mv summary.pdf $orig_dir/"; chdir $orig_dir;
system "mv $tmp_dir/summary.pdf $output_file";
sub process_args
{
use vars qw( $opt_help $opt_output );
Getopt::Long::Configure("no_ignore_case", "bundling");
GetOptions( "help",
"output=s");
if($opt_help)
{
print_help();
exit(0);
}
if($opt_output)
{
$output_file = $opt_output;
}
# there should only be one remaining argument: the input file
if($#ARGV != 0)
{
print "Error: invalid arguments.\n";
print_help();
exit(1);
}
$input_file = $ARGV[0];
return;
}
sub print_help
{
print <<EOF;
Usage: $PROGRAM_NAME <options> input_file
--help Prints this help message
--output Specifies a file to write pdf output to
(defaults to ./summary.pdf)
Purpose:
This script reads a Darshan output file in text format (as
produced by the darshan-parser utility) and generates a pdf file
summarizing job behavior.
EOF
return;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment