#!/usr/bin/awk -f
BEGIN 	{ 
version="";
num_version=split("seq_par", versions, "_");
thread="";
num_thread=split("1_2_3_4_6_8_12_16_20_24_28_32", threads, "_");
filename="";
run=1;
key="";
times[""]=0;
gamma="";
delta="";
}
{
    if( filename != FILENAME){
	filename = FILENAME;
	split(filename,array,".");
	version=array[2];
	thread=substr(array[3],8,length(array[3])+1);
	run=1;

	#printf("File:%s",filename);
    }

    if ( $0 ~ "Execution time:"){
	if(version == "par"){
	    gamma="ConcurrentSkipListSet";
	    delta="ParallelDeltaNodeInt";
	}else{
	    gamma="TreeSet";
	    delta="DeltaNodeInt";	
	}

	#printf("%s\n",$0);
	split($0, array, " ");	
	key=version","gamma","delta","thread","run;
	times[key]=array[3];
	run+=1;
	#printf("key:%s\tTime:%s",key,times[key]);
    }
 
}
END {
    for(i=1;i<=num_version;i++){
	version = versions[i];
	if(version == "par"){
	    gamma="ConcurrentSkipListSet";
	    delta="ParallelDeltaNodeInt";
	}else{
	    gamma="TreeSet";
	    delta="DeltaNodeInt";	
	}
	
	printf("Machine: Linux cn192 2.6.38-symphony2 # with 32 CPUs ( Intel(R) Xeon(R) CPU E7- 8837  @ 2.67GHz) and 529438876 memory\n");
	printf("MatrixMult\tVersion:%s\tGamma:%s\tDelta:%s\n",version,gamma,delta);
	printf("\nNumThreads:\t1\t2\t3\t4\t6\t8\t12\t16\t20\t24\t28\t32\n");

	for(run=1;run<=30;run++){
	    printf("Run%s",run);
	    for(j=1;j<=num_thread;j++){
		thread=threads[j];
		key=version","gamma","delta","thread","run;
		printf("\t%s",times[key]);
	    }
	    printf("\n");
	}	
	
    }
	
 
 }
