VMS/2__runs_and_data

changeset 3:8323aae8c303

plot script rewritten in python and changed labeling
author Merten Sach <msach@mailbox.tu-berlin.de>
date Mon, 12 Dec 2011 20:23:22 +0100
parents c2e8c3b49545
children ef2b8d975a99
files scripts/overhead.py scripts/plot__exe_vs_task_size.py
diffstat 2 files changed, 69 insertions(+), 1 deletions(-) [+]
line diff
     1.1 --- a/scripts/overhead.py	Fri Dec 09 15:09:34 2011 +0100
     1.2 +++ b/scripts/overhead.py	Mon Dec 12 20:23:22 2011 +0100
     1.3 @@ -121,7 +121,7 @@
     1.4  		results.sort(lambda x,y: cmp(x["total_exe_cycles"],y["total_exe_cycles"]))
     1.5  		total_workcycles = results[0]["total_workcycles"]
     1.6  		total_exe_cycles  = results[0]["total_exe_cycles"]
     1.7 -		exeCycles_workCycles_ratio = results[0]["exeCycles_workCycles_ratio"]
     1.8 +		#exeCycles_workCycles_ratio = results[0]["exeCycles_workCycles_ratio"]
     1.9  	
    1.10  		#Calculate numbers
    1.11  		overhead             = total_exe_cycles - total_workcycles
    1.12 @@ -130,6 +130,8 @@
    1.13  		cycles_of_task       = float(total_workcycles) / float(TASKS_PER_THREAD * totalThreads)
    1.14  		overhead_per_core    = float(overhead) / NUM_CORES
    1.15  		workcycles_per_core  = total_workcycles / NUM_CORES
    1.16 +		
    1.17 +		exeCycles_workCycles_ratio = float(total_workcycles+float(overhead)/2)/float(total_workcycles)
    1.18  	
    1.19  		gnuplot_output.write("%20d\t%20d\t%20d\t%20f\t%20d\t%20d\t%20f\t%20f\n" % (
    1.20  						  workload_iterations_in_task,
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/scripts/plot__exe_vs_task_size.py	Mon Dec 12 20:23:22 2011 +0100
     2.3 @@ -0,0 +1,66 @@
     2.4 +#! /usr/bin/python
     2.5 +# -*- coding: utf-8 -*-
     2.6 +
     2.7 +import sys
     2.8 +import re
     2.9 +
    2.10 +usage = """
    2.11 +This generates a gnuplot script that plots the work cycles to exec cycles ratio
    2.12 +against the one task cycles. The scipt is printed to stdout.
    2.13 +	%s [datafiles]
    2.14 +""" % sys.argv[0]
    2.15 +
    2.16 +# Gnupot skeleton that plots several curves in one diagram and a dotted line that marks the 2 on the y-axis.
    2.17 +gnuplot_cmd="""
    2.18 +set terminal postscript enhanced color
    2.19 +set output "%(output_filename)s"
    2.20 +set title "INSERT MACHINE HERE"
    2.21 +set xlabel "Cycles in one Task"
    2.22 +set ylabel "Ratio of Total Execution to Total Work"
    2.23 +set multiplot
    2.24 +	set origin 0,0
    2.25 +	set size   1,1
    2.26 +	set yrange [1:8]
    2.27 +	line(x)=2
    2.28 +	set key box
    2.29 +	plot line(x) notitle with line lc 0 lw 1 lt 2, %(plot_arguments)s
    2.30 +	set notitle
    2.31 +	#set xlabel ""
    2.32 +	#set origin 0.40,0.40
    2.33 +	#set size 0.5,0.5
    2.34 +	#set xrange [0 : 2000]
    2.35 +	#set yrange [1 : 8]
    2.36 +	#set key box
    2.37 +	#replot
    2.38 +set nomultiplot
    2.39 +exit"""
    2.40 +
    2.41 +# strip the script name from argument list
    2.42 +files = sys.argv[1:]
    2.43 +
    2.44 +# no arguments -> print usage
    2.45 +if len(files) == 0:
    2.46 +	print usage	
    2.47 +	sys.exit(0)
    2.48 +
    2.49 +# generate Output file name - this removes the part til the first underscore
    2.50 +gnuplot_output_filename = files[0][files[0].find('_')+1:]
    2.51 +
    2.52 +# generate the plot arguments
    2.53 +curve_arguments        = "'%(data_filename)s' using 4:8 title '%(number_of_threads)s Threads'  with line lw 2"
    2.54 +list_of_thread_numbers = []
    2.55 +plot_arguments         = []
    2.56 +for file in files:
    2.57 +	# get number of threads from filename
    2.58 +	try:
    2.59 +		number_of_threads = re.search("(^[\d]*)",file).groups()[0]
    2.60 +		list_of_thread_numbers.append(number_of_threads)
    2.61 +	except:
    2.62 +		print "Please provide a filename in the format that the number of threads is first the filename."
    2.63 +		sys.exit(0)
    2.64 +	plot_arguments.append(curve_arguments % {"data_filename" : file, "number_of_threads" : number_of_threads})
    2.65 +	
    2.66 +# Output script to stdout so it can be piped into a file
    2.67 +plot_arguments = ",".join(plot_arguments)
    2.68 +gnuplot_output_filename = "_".join(list_of_thread_numbers) + gnuplot_output_filename + ".eps"
    2.69 +print gnuplot_cmd % {"output_filename" :gnuplot_output_filename, "plot_arguments" : plot_arguments}