annotate scripts/cannabalise___extract_all_loops.pl @ 24:6d03033aca59

added config file for HWSim ping-pong test program
author Sean <seanhalle@yahoo.com>
date Thu, 17 May 2012 20:41:06 +0200
parents
children
rev   line source
Me@0 1 #!/usr/bin/perl
Me@0 2
Me@0 3 # perl script that calls loop extraction on every trace in the
Me@0 4 # standard location for full traces
Me@0 5 # For each trace,
Me@0 6 # create a directory to hold the extracted loops,
Me@0 7 # gunzip the trace and pipe it to the java statement that runs
Me@0 8 # runs the extraction program, passing it the just-created
Me@0 9 # directory to put the extracted loops into
Me@0 10
Me@0 11 $BAADRootDir = $ARGV[0];
Me@0 12
Me@0 13 print "$BAADRootDir\n";
Me@0 14
Me@0 15 #Set where the extraction program directory is
Me@0 16 $extractorDir = "$BAADRootDir/1__Development/0__Code_Dev/".
Me@0 17 "2__DepQ_loop_paper/LoopExtractor/dist";
Me@0 18
Me@0 19 # String used to run extractor
Me@0 20 $extractCmd = "java -jar $extractorDir/LoopExtractor.jar";
Me@0 21
Me@0 22 $tracesBaseDir = "$BAADRootDir/1__Development/2__Traces_and_Runs".
Me@0 23 "/8__Traces_shared/full_traces_Fmt4";
Me@0 24
Me@0 25 $loopsBaseDir = "$BAADRootDir/1__Development/".
Me@0 26 "2__Traces_and_Runs/8__Traces_shared/loop_files/full_loop_traces";
Me@0 27
Me@0 28
Me@0 29
Me@0 30 # grab all file names in current directory
Me@0 31 # Expecting to be in the directory with all the trace files to be
Me@0 32 # processed
Me@0 33 print "tracesDir: $tracesBaseDir\n";
Me@0 34 print "loopsDir: $loopsBaseDir\n";
Me@0 35 $dired = `ls $tracesBaseDir`;
Me@0 36 @fileNames = split("\n", $dired);
Me@0 37
Me@0 38 @fileNames = ("","");
Me@0 39
Me@0 40 # filter filenames so have only trace files
Me@0 41 # then extract benchmark name and architecture name from file name
Me@0 42 foreach $fileName (@fileNames)
Me@0 43 { print "filename: $fileName\n";
Me@0 44 if ($fileName =~ /trace_(\w+)_X0_(\w+)\.gz/)
Me@0 45 { $traceName = $fileName;
Me@0 46 $benchName = $1;
Me@0 47 print "benchmark: $benchName\n";
Me@0 48 $tracePath = "$tracesBaseDir/$fileName";
Me@0 49
Me@0 50 # make directory to hold extracted loops
Me@0 51 $loopDir = "$loopsBaseDir/$benchName";
Me@0 52 print "loopDir: $loopDir\n";
Me@0 53 `mkdir -p $loopDir`;
Me@0 54
Me@0 55 # run the extraction program
Me@0 56 print `zcat $tracePath | $extractCmd $loopDir`;
Me@0 57 `gzip $loopDir/*.trace`;
Me@0 58 }
Me@0 59 }
Me@0 60