#!/bin/awk -f
BEGIN {
   
    filename="";
    run=1;   
    times[""]="";    
    files[""]="";
    version="";
    sorted="";
    num_version=split("i7-2600/Disruptor i7-2600/SEQ-Optimized",versionList," ");
    num_sorted=split("sorted unsorted",sortedList," ");
    machine[""]="";
    jvm="";
    jstar="";
    key="";
}
{ 
    if(filename != FILENAME){
	filename=FILENAME;
	n=split(filename,array,".");
	version=array[1];
	sorted=array[2];
	printf("%s %s\n",version,sorted);
	run=1;
    }

    if($0 ~ "Execution time:"){
	split($0,array," "); 
	key=version","sorted","run;	
	#times[filename","run]=array[3];
	times[key]=array[3];
	run++;	    
    }else{	
	 machine["OS"]="Windows 7";
	 machine["core"]=4;
	 machine["model"]="Intel® Core™ i7-2600 Processor@3.4 GHz";
	 machine["memtotal"]="4G"; 
	 machine["jvm"]="-Xmx4G -verbose:gc -XX:+PrintGCDetails";
    }  
   
}
END {     
    
    for(i=1;i<=num_version;i++){	
	for(j=1;j<=num_sorted;j++){
	   version=versionList[i];
	   sorted=sortedList[j];
	   printf("Machine: %s with %d cores (%s) and %s memory\n",machine["OS"],machine["processor"],machine["model"],machine["memtotal"]);
	   printf("Version:%s\tFile:%s\n",version,sorted);
     	   printf("JVM options:%s\n",machine["jvm"]);
	   
	   for(run=1;run<=12;run++){
		printf("Run%s",run);
		key=version","sorted","run;
		printf("\t%s",times[key]);	
		printf("\n");
	   }  	    
	   printf("Average6-12\n");
	   printf("Median6-12\n");
	   printf("Variance6-12\n");
	   printf("Speedup\n");
	   printf("\n");
	    
     }
    }   
    
}
