# HG changeset patch # User Mike Pavone # Date 1286932733 0 # Node ID 04148770c229b0eb5be6edf6ce67ab345d5b36ff # Parent 25a205094f9bf0f2f7d510fd11e465c2f3b7006b# Parent 7ca80654c9bb7de6b5d273889249294d36031779 Merge diff -r 25a205094f9b -r 04148770c229 nworker_c.rhope --- a/nworker_c.rhope Wed Oct 13 01:15:04 2010 +0000 +++ b/nworker_c.rhope Wed Oct 13 01:18:53 2010 +0000 @@ -834,7 +834,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] @@ -900,7 +900,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] @@ -908,7 +908,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] @@ -921,7 +921,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 25a205094f9b -r 04148770c229 parser_old.rhope --- a/parser_old.rhope Wed Oct 13 01:15:04 2010 +0000 +++ b/parser_old.rhope Wed Oct 13 01:18:53 2010 +0000 @@ -1651,33 +1651,3 @@ out <- Fold[["Add If Store"]Set Input[2, params], stores, [node]Assignments >>] } - -/* -Main[args] -{ - fname <- [args]Index[1] - { - file <- >, ["Check Worker Literals"]Set Input[1, ~]] ] - { Print["Compiling"] } - } - compiled <- [Tree to Program Native[tree]]Compile Program[C Program[]] - { Print["Compiled program to backend"] } - outfile <- >] } -/* -Main[args] -{ - fname <- [args]Index[1] - { - file <- [File[~]]Open["r"] - text <- String[[file]Read[[file]Length]] - params <- Parser[] - Print[["Parsing "]Append[fname]] - Null[text, params, Parse Program[], 0] - { - Print["Parsing imports"] - Process Imports[~, params] - { - tree <- [~]Workers << [ Map[[~]Workers >>, Check Worker Literals[?, ~]] ] - { Print["Compiling"] } - } - compiled <- [Tree to Program Native[tree]]Compile Program[C Program[]] - { Print["Compiled program to backend"] } - outfile <- [File[ [fname]Append[".c"] ]]Truncate - [outfile]Write[ [Flatten[[compiled]Text]]Buffer >> ] - { Print[["Wrote output to "]Append[ [fname]Append[".c"] ]] } - } - }{ - Print["You must provide a file name to compile"] - } -} -*/ diff -r 25a205094f9b -r 04148770c229 procnames --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/procnames Wed Oct 13 01:18:53 2010 +0000 @@ -0,0 +1,3 @@ +#!/bin/sh + +sed -n 's/^[[:space:]]*\(FUNC_\|RES_\)\([^,]*\),/\2/p' $1 > workernames.txt diff -r 25a205094f9b -r 04148770c229 procprofile.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/procprofile.py Wed Oct 13 01:18:53 2010 +0000 @@ -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 25a205094f9b -r 04148770c229 string.rhope --- a/string.rhope Wed Oct 13 01:15:04 2010 +0000 +++ b/string.rhope Wed Oct 13 01:18:53 2010 +0000 @@ -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]