diff scripts/cannabalise___extract_all_loops.pl @ 0:21573f5b2e84

initial add -- all data from Sean's machine
author Me@portablequad
date Mon, 28 Nov 2011 15:37:08 -0800
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/scripts/cannabalise___extract_all_loops.pl	Mon Nov 28 15:37:08 2011 -0800
     1.3 @@ -0,0 +1,60 @@
     1.4 +#!/usr/bin/perl
     1.5 +
     1.6 +# perl script that calls loop extraction on every trace in the
     1.7 +#  standard location for full traces
     1.8 +# For each trace, 
     1.9 +#    create a directory to hold the extracted loops,
    1.10 +#    gunzip the trace and pipe it to the java statement that runs
    1.11 +#     runs the extraction program, passing it the just-created
    1.12 +#     directory to put the extracted loops into
    1.13 +
    1.14 +$BAADRootDir = $ARGV[0];
    1.15 +
    1.16 +print "$BAADRootDir\n";
    1.17 +
    1.18 +   #Set where the extraction program directory is
    1.19 +$extractorDir =  "$BAADRootDir/1__Development/0__Code_Dev/".
    1.20 + "2__DepQ_loop_paper/LoopExtractor/dist";
    1.21 +
    1.22 +# String used to run extractor
    1.23 +$extractCmd = "java -jar $extractorDir/LoopExtractor.jar";
    1.24 + 
    1.25 +$tracesBaseDir = "$BAADRootDir/1__Development/2__Traces_and_Runs".
    1.26 +"/8__Traces_shared/full_traces_Fmt4";
    1.27 +
    1.28 +$loopsBaseDir = "$BAADRootDir/1__Development/".
    1.29 + "2__Traces_and_Runs/8__Traces_shared/loop_files/full_loop_traces";
    1.30 +
    1.31 +
    1.32 +
    1.33 +# grab all file names in current directory
    1.34 +# Expecting to be in the directory with all the trace files to be
    1.35 +#  processed
    1.36 +print "tracesDir: $tracesBaseDir\n";
    1.37 +print "loopsDir: $loopsBaseDir\n";
    1.38 +$dired = `ls $tracesBaseDir`;
    1.39 +@fileNames = split("\n", $dired);
    1.40 +
    1.41 +@fileNames = ("","");
    1.42 +
    1.43 +# filter filenames so have only trace files
    1.44 +#  then extract benchmark name and architecture name from file name
    1.45 +foreach $fileName (@fileNames)
    1.46 + { print "filename: $fileName\n";
    1.47 +   if ($fileName  =~ /trace_(\w+)_X0_(\w+)\.gz/)
    1.48 +    { $traceName  = $fileName;
    1.49 +      $benchName  = $1;
    1.50 +      print "benchmark: $benchName\n";
    1.51 +      $tracePath = "$tracesBaseDir/$fileName";
    1.52 +      
    1.53 +      # make directory to hold extracted loops
    1.54 +      $loopDir = "$loopsBaseDir/$benchName";
    1.55 +      print "loopDir:  $loopDir\n";
    1.56 +      `mkdir -p $loopDir`;
    1.57 +      
    1.58 +      # run the extraction program
    1.59 +      print `zcat $tracePath | $extractCmd $loopDir`;
    1.60 +      `gzip $loopDir/*.trace`;
    1.61 +    }
    1.62 + }
    1.63 +