# HG changeset patch # User Mike Pavone # Date 1286848407 14400 # Node ID fd23ab2c1a739a63d47c193195fd89b030f7be2c # Parent 13dfe821425439110d5913b51eb180d9605c4b67 Small changes to make profile data a little cleaner diff -r 13dfe8214254 -r fd23ab2c1a73 cbackend.rhope --- a/cbackend.rhope Mon Oct 11 20:04:48 2010 -0400 +++ b/cbackend.rhope Mon Oct 11 21:53:27 2010 -0400 @@ -1613,7 +1613,7 @@ for (idx = 0; idx < END; ++idx) { if(profile_counts[idx]) - printf(\"Func: %d\tCount: %llu\tTime: %llu\tAvg: %f\tSelf: %llu\tAvg: %f\n\", idx, profile_counts[idx], profile_totals[idx], ((double)profile_totals[idx])/((double)profile_counts[idx]), profile_selftotals[idx], ((double)profile_selftotals[idx])/((double)profile_counts[idx])); + printf(\"Func: %d\tCount: %llu\tTime: %llu\tAvg: %f\tSelf: %llu\tAvg: %f\\n\", idx, profile_counts[idx], profile_totals[idx], ((double)profile_totals[idx])/((double)profile_counts[idx]), profile_selftotals[idx], ((double)profile_selftotals[idx])/((double)profile_counts[idx])); } #endif if (!numret) diff -r 13dfe8214254 -r fd23ab2c1a73 nworker_c.rhope --- a/nworker_c.rhope Mon Oct 11 20:04:48 2010 -0400 +++ b/nworker_c.rhope Mon Oct 11 21:53:27 2010 -0400 @@ -853,7 +853,7 @@ after save <- Fold[Save Result[?, ?, node index], with call, Range[0, save outs]] } -Compile Node@NWorker[worker,program,func,nodes,current:out,out worker] +Compile Node[worker,program,func,nodes,current:out,out worker] { node index <- [nodes]Index[current] node <- [[worker]Nodes >>]Index[node index] @@ -919,7 +919,7 @@ } } -Save Node Conditions@NWorker[worker,node index:out] +Save Node Conditions[worker,node index:out] { node <- [[worker]Nodes >>]Index[node index] conditions <- [worker]Collect Conditions[node] @@ -927,7 +927,7 @@ } -Save Group Conditions@NWorker[worker, groups,current:out] +Save Group Conditions[worker, groups,current:out] { nodes <- [groups]Index[current] nworker <- Fold[Save Node Conditions[?], worker, nodes] @@ -940,7 +940,7 @@ } } -Compile Group@NWorker[worker,program,func,groups,current:out,out worker] +Compile Group[worker,program,func,groups,current:out,out worker] { nodes <- [groups]Index[current] [nodes]First diff -r 13dfe8214254 -r fd23ab2c1a73 parser_old_c.rhope --- a/parser_old_c.rhope Mon Oct 11 20:04:48 2010 -0400 +++ b/parser_old_c.rhope Mon Oct 11 21:53:27 2010 -0400 @@ -1579,7 +1579,7 @@ } -Main[args] +/* Main[args] { fname <- [args]Index[1] { @@ -1604,4 +1604,5 @@ }{ Print["You must provide a file name to compile"] } -} +} */ + diff -r 13dfe8214254 -r fd23ab2c1a73 procnames --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/procnames Mon Oct 11 21:53:27 2010 -0400 @@ -0,0 +1,3 @@ +#!/bin/sh + +sed -n 's/^[[:space:]]*\(FUNC_\|RES_\)\([^,]*\),/\2/p' $1 > workernames.txt diff -r 13dfe8214254 -r fd23ab2c1a73 procprofile.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/procprofile.py Mon Oct 11 21:53:27 2010 -0400 @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +def unescapename(name): + trans = {"UN":'_',"AT":'@',"SP":' ',"QN":'?',"PL":'+',"MN":'-',"TM":'*',"DV":'/',"LT":'<',"GT":'>',"NT":'!',"EQ":'=',"PR":"'"} + out = '' + while (name): + before,_,name = name.partition('_') + if name: + out += before[:-2] + key = before[-2:] + if key in trans: + out += trans[key] + else: + out += key+_ + else: + out += before + return out.replace('__', '_') + + +names = [unescapename(line.strip()) for line in open('workernames.txt', 'r')] +records = [] + +data = open('profiler.txt', 'r') + +for line in data: + funcid,_,rest = line[len('Func: '):].partition('\tCount: ') + count,_,rest = rest.partition('\tTime: ') + total,_,rest = rest.partition('\tAvg: ') + avg,_,rest = rest.partition('\tSelf: ') + self,_,selfavg = rest.partition('\tAvg: ') + records.append((names[int(funcid)], int(count), int(total), float(avg), int(self), float(selfavg))) + + +records.sort(key=lambda el: el[3]) + +print 'Func\tCount\tTotal(us)\tAvg(us)\tSelf(us)\tSelf Avg(us)' +for record in records: + print '%s\t%d\t%d\t%f\t%d\t%f' % record + + + diff -r 13dfe8214254 -r fd23ab2c1a73 string.rhope --- a/string.rhope Mon Oct 11 20:04:48 2010 -0400 +++ b/string.rhope Mon Oct 11 21:53:27 2010 -0400 @@ -905,8 +905,9 @@ out <- string } -Replace[string,toreplace,with:out] +Replace[string,otoreplace,with:out] { + toreplace <- Pattern[otoreplace] ,delim,after <-[string]Partition[toreplace] { wt <- Blueprint Of[with]