def gen_mpstats(benchmarks): print "parsing..." jgraph_input = [] stacks = [] for benchmark in benchmarks: bars = [] for config in configs: print " %s %s" % (benchmark, config) filenames = glob.glob(benchmark + "/" + benchmark + "*-" + config + "-*.xterm") for filename in filenames: stats = get_mpstats(filename) stats = stats[12:] stats.reverse() config_label = string.split(config, "-")[0] bar = [config_label] + mfgraph.stack_bars(stats) bars.append(bar) stacks.append([benchmark] + bars) jgraph_input.append( mfgraph.stacked_bar_graph( stacks, bar_segment_labels=["idle", "wait", "system", "user"], title="utilization", ylabel="percent", colors=[".8 .8 .8", "0 .5 0", "0 0 1", "1 0 0"], patterns=["stripe 45", "solid", "solid", "solid"])) column_label = "CPU minor-faults major-faults cross-calls interrupts interrupts-as-threads context-switches involuntary-context-switches migrations mutex-spins read-write-spins system-calls usr sys wt idl" column_name = string.split(column_label) column_name = map(string.strip, column_name) for column in range(1, 12): stacks = [] for benchmark in benchmarks: bars = [] for config in configs: filenames = glob.glob(benchmark + "/" + benchmark + "*-" + config + "-*.xterm") for filename in filenames: stats = get_mpstats(filename) config_label = string.split(config, "-")[0] bars.append([config_label, stats[column]]) stacks.append([benchmark] + bars) jgraph_input.append( mfgraph.stacked_bar_graph( stacks, title=column_name[column], ylabel="operations/second (for each processor)", colors=["0 0 1"], patterns=["solid"])) return jgraph_input
def gen_mpstats(benchmarks): print "parsing..." jgraph_input = [] stacks = []; for benchmark in benchmarks: bars = [] for config in configs: print " %s %s" % (benchmark, config) filenames = glob.glob(benchmark + "/" + benchmark + "*-" + config + "-*.xterm") for filename in filenames: stats = get_mpstats(filename) stats = stats[12:] stats.reverse() config_label = string.split(config, "-")[0] bar = [config_label] + mfgraph.stack_bars(stats) bars.append(bar) stacks.append([benchmark] + bars) jgraph_input.append(mfgraph.stacked_bar_graph(stacks, bar_segment_labels = ["idle", "wait", "system", "user"], title = "utilization", ylabel = "percent", colors = [".8 .8 .8", "0 .5 0", "0 0 1", "1 0 0"], patterns = ["stripe 45", "solid", "solid", "solid"])) column_label = "CPU minor-faults major-faults cross-calls interrupts interrupts-as-threads context-switches involuntary-context-switches migrations mutex-spins read-write-spins system-calls usr sys wt idl" column_name = string.split(column_label) column_name = map(string.strip, column_name) for column in range(1, 12): stacks = [] for benchmark in benchmarks: bars = [] for config in configs: filenames = glob.glob(benchmark + "/" + benchmark + "*-" + config + "-*.xterm") for filename in filenames: stats = get_mpstats(filename) config_label = string.split(config, "-")[0] bars.append([config_label, stats[column]]) stacks.append([benchmark] + bars) jgraph_input.append(mfgraph.stacked_bar_graph(stacks, title = column_name[column], ylabel = "operations/second (for each processor)", colors = ["0 0 1"], patterns = ["solid"])) return jgraph_input
def gen_misses(benchmarks): configs = [ "1p-MOSI_bcast_opt", "2p-MOSI_bcast_opt", "4p-MOSI_bcast_opt", "8p-MOSI_bcast_opt", "16p-MOSI_bcast_opt" ] parameters = [ "Request_type_IFETCH", "Request_type_LD", "Request_type_ST", "Request_type_ATOMIC" ] stacks = [] for benchmark in benchmarks: bars = [] for config in configs: print " %s %s" % (benchmark, config) filenames = glob.glob(benchmark + "/*-" + config + "-*.stats") for filename in filenames: numbers = [] lines = mfgraph.grep(filename, "instruction_executed") line = string.split(lines[0]) insn = long(line[1]) for parameter in parameters: lines = mfgraph.grep(filename, parameter) line = string.split(lines[0]) map(string.strip, line) numbers.append(1000.0 * (float(line[1]) / insn)) numbers = mfgraph.stack_bars(numbers) config_label = string.split(config, "-")[0] bars.append([config_label] + numbers) stacks.append([benchmark] + bars) labels = [] for label in parameters: labels.append(string.split(label, "_")[2]) return [ mfgraph.stacked_bar_graph( stacks, bar_segment_labels=labels, title="Breakdown of misses", ylabel="misses per thousand instructions", patterns=["solid"], ) ]
def gen_sharing(benchmarks, normalize=1): configs = ["1p", "2p", "4p", "8p", "16p"] stacks = [] for benchmark in benchmarks: bars = [] for config in configs: print " %s %s" % (benchmark, config) filenames = glob.glob(benchmark + "/*-" + config + "-*.stats") for filename in filenames: lines = mfgraph.grep(filename, "instruction_executed") line = string.split(lines[0]) insn = long(line[1]) numbers = get_sharing(filename) if normalize: sum = reduce(lambda x, y: x + y, numbers) for index in range(len(numbers)): numbers[index] = (numbers[index] / sum) * 100.0 else: for index in range(len(numbers)): numbers[index] = (numbers[index] / float(insn)) * 1000.0 numbers = mfgraph.stack_bars(numbers) bars.append([config] + numbers) stacks.append([benchmark] + bars) if normalize: y_axis_label = "percent of misses" else: y_axis_label = "misses per thousand instructions", return [ mfgraph.stacked_bar_graph( stacks, bar_segment_labels=labels, title="Breakdown of misses", ylabel=y_axis_label, patterns=[ "stripe -45", "stripe -45", "stripe -45", "solid", "solid" ], ) ]
def gen_cache_state(benchmarks): configs = ["1p", "2p", "4p", "8p", "16p"] parameters = ["GETS NP", "GETS I", "GETX NP", "GETX I", "GETX S", "GETX O"] stacks = [] for benchmark in benchmarks: bars = [] for config in configs: filenames = glob.glob(benchmark + "/*-" + config + "-*.stats") print " %s %s" % (benchmark, config), filenames numbers = [] for parameter in parameters: sum = 0 for filename in filenames: # print benchmark, config, parameter, filename lines = mfgraph.grep(filename, "instruction_executed") line = string.split(lines[0]) insn = long(line[1]) lines = mfgraph.grep(filename, parameter) for line in lines: fields = string.split(line) # print fields sum += int(fields[3]) numbers.append(float(sum) / float(insn)) numbers = mfgraph.stack_bars(numbers) bars.append([config] + numbers) stacks.append([benchmark] + bars) labels = [] for label in parameters: labels.append(label) return [ mfgraph.stacked_bar_graph( stacks, bar_segment_labels=labels, title="Cache Misses by state", ylabel="Number", ) ]
def gen_cache_state(benchmarks): configs = ["1p", "2p", "4p", "8p", "16p"] parameters = ["GETS NP", "GETS I", "GETX NP", "GETX I", "GETX S", "GETX O"] stacks = [] for benchmark in benchmarks: bars = [] for config in configs: filenames = glob.glob(benchmark + "/*-" + config + "-*.stats") print " %s %s" % (benchmark, config), filenames numbers = [] for parameter in parameters: sum = 0 for filename in filenames: # print benchmark, config, parameter, filename lines = mfgraph.grep(filename, "instruction_executed"); line = string.split(lines[0]) insn = long(line[1]) lines = mfgraph.grep(filename, parameter); for line in lines: fields = string.split(line) # print fields sum += int(fields[3]) numbers.append(float(sum)/float(insn)) numbers = mfgraph.stack_bars(numbers) bars.append([config] + numbers) stacks.append([benchmark] + bars) labels = [] for label in parameters: labels.append(label) return [mfgraph.stacked_bar_graph(stacks, bar_segment_labels = labels, title = "Cache Misses by state", ylabel = "Number", )]
def gen_data_size(benchmarks): configs = ["1p-MOSI_bcast_opt", "2p-MOSI_bcast_opt", "4p-MOSI_bcast_opt", "8p-MOSI_bcast_opt", "16p-MOSI_bcast_opt"] parameters = ["C GET_INSTR", "C GETS", "C GETX"] stacks = [] for benchmark in benchmarks: bars = [] for config in configs: print " %s %s" % (benchmark, config) filenames = glob.glob(benchmark + "/*-" + config + "-*.stats") for filename in filenames: numbers = [] for parameter in parameters: lines = mfgraph.grep(filename, parameter); line = string.split(lines[0]) map(string.strip, line) num = string.split(line[2], "%") num = (64L*(long(num[0])))/(1024.0*1024.0) numbers.append(num) numbers = mfgraph.stack_bars(numbers) number = reduce(lambda x,y:x+y, numbers) config_label = string.split(config, "-")[0] bars.append([config_label] + [number]) stacks.append([benchmark] + bars) # labels = [] # for label in parameters: # labels.append(string.split(label)[1]) return [mfgraph.stacked_bar_graph(stacks, # bar_segment_labels = labels, title = "Memory touched", ylabel = "Mbytes", patterns = ["solid"], xsize = 8.5, )]
def gen_sharing(benchmarks, normalize = 1): configs = ["1p", "2p", "4p", "8p", "16p"] stacks = [] for benchmark in benchmarks: bars = [] for config in configs: print " %s %s" % (benchmark, config) filenames = glob.glob(benchmark + "/*-" + config + "-*.stats") for filename in filenames: lines = mfgraph.grep(filename, "instruction_executed"); line = string.split(lines[0]) insn = long(line[1]) numbers = get_sharing(filename) if normalize: sum = reduce(lambda x,y: x+y, numbers) for index in range(len(numbers)): numbers[index] = (numbers[index] / sum) * 100.0 else: for index in range(len(numbers)): numbers[index] = (numbers[index] / float(insn)) * 1000.0 numbers = mfgraph.stack_bars(numbers) bars.append([config] + numbers) stacks.append([benchmark] + bars) if normalize: y_axis_label = "percent of misses" else: y_axis_label = "misses per thousand instructions", return [mfgraph.stacked_bar_graph(stacks, bar_segment_labels = labels, title = "Breakdown of misses", ylabel = y_axis_label, patterns = ["stripe -45", "stripe -45", "stripe -45", "solid", "solid"], )]
def gen_misses(benchmarks): configs = ["1p-MOSI_bcast_opt", "2p-MOSI_bcast_opt", "4p-MOSI_bcast_opt", "8p-MOSI_bcast_opt", "16p-MOSI_bcast_opt"] parameters = ["Request_type_IFETCH", "Request_type_LD", "Request_type_ST", "Request_type_ATOMIC"] stacks = [] for benchmark in benchmarks: bars = [] for config in configs: print " %s %s" % (benchmark, config) filenames = glob.glob(benchmark + "/*-" + config + "-*.stats") for filename in filenames: numbers = [] lines = mfgraph.grep(filename, "instruction_executed"); line = string.split(lines[0]) insn = long(line[1]) for parameter in parameters: lines = mfgraph.grep(filename, parameter); line = string.split(lines[0]) map(string.strip, line) numbers.append(1000.0*(float(line[1])/insn)) numbers = mfgraph.stack_bars(numbers) config_label = string.split(config, "-")[0] bars.append([config_label] + numbers) stacks.append([benchmark] + bars) labels = [] for label in parameters: labels.append(string.split(label, "_")[2]) return [mfgraph.stacked_bar_graph(stacks, bar_segment_labels = labels, title = "Breakdown of misses", ylabel = "misses per thousand instructions", patterns = ["solid"], )]
def make_stacked(tuple_list): stacked_list = [] for tuple in tuple_list: stacked_tuple = [tuple[0]] + mfgraph.stack_bars(tuple[1:]) stacked_list.append(stacked_tuple) return stacked_list
def generate_bar_example(): stacks=[] bars=[] tempval = 0.25 output_list = "" for j in range(i): bars=[] numbers = [] if(float(hash_table0_results[j]) > 43200): output_list = output_list + "graph 2 newstring fontsize 9 x " + str(tempval) + " y 107 hjc vjt rotate 90.0 : " + "inf" + "\n" numbers.append(43200) else: numbers.append(hash_table0_results[j]) numbers=mfgraph.stack_bars(numbers) bars.append([""] + numbers) tempval += 1.1 numbers = [] if(float(hash_table1_results[j]) > 43200): output_list = output_list + "graph 2 newstring fontsize 9 x " + str(tempval) + " y 107 hjc vjt rotate 90.0 : " + "inf" + "\n" numbers.append(43200) else: numbers.append(hash_table1_results[j]) numbers=mfgraph.stack_bars(numbers) bars.append([""] + numbers) tempval += 1.1 numbers = [] if(float(hash_table2_results[j]) > 43200) : output_list = output_list + "graph 2 newstring fontsize 9 x " + str(tempval) + " y 107 hjc vjt rotate 90.0 : " + "inf" + "\n" numbers.append(43200) else: numbers.append(hash_table2_results[j]) numbers=mfgraph.stack_bars(numbers) bars.append([""] + numbers) tempval += 1.1 numbers = [] if(float(hash_table3_results[j]) > 43200): output_list = output_list + "graph 2 newstring fontsize 9 x " + str(tempval) + " y 107 hjc vjt rotate 90.0 : " + "inf" + "\n" numbers.append(43200) else: numbers.append(hash_table3_results[j]) numbers=mfgraph.stack_bars(numbers) bars.append([""] + numbers) stacks.append([benchmarks[j]]+ bars) tempval += 2.15 #print stacks return [mfgraph.stacked_bar_graph(stacks, bar_segment_labels = labels, title = " ", title_y = 140, title_fontsize = "5", ylabel = "Total Time (sec)", #xlabel = "Number of pointer jumps", colors = ["0.375 0.375 0.375", "0.875 0.875 0.875", "0 0 0", "0.625 0.625 0.625"], legend_x = "2", legend_y = "125", legend_type = "Manual", legend_type_x=[0, 20, 0, 20], legend_type_y=[10, 10, 0, 0] , clip = 300, ysize = 1.1, xsize = 6, ymax = 43200, patterns = ["solid"], stack_name_rotate = 25.0, stack_name_font_size = "6", #bmarks names label_fontsize = "6", #y-axis name legend_fontsize = "6", #label names ylog = 10, ymin = 10, yhash_marks = [100, 1000, 10000, 43200], yhash_names = ["100", "1000", "10000", "43200"], ) + output_list]