changeset 115:04148770c229

Merge
author Mike Pavone <pavone@retrodev.com>
date Wed, 13 Oct 2010 01:18:53 +0000
parents 25a205094f9b (current diff) 7ca80654c9bb (diff)
children 60906f8803ef
files nworker_c.rhope parser_old.rhope parser_old_c.rhope
diffstat 6 files changed, 50 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- 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
--- 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 <- <String@File[~]
-		,text <- [file]Get FString[[file]Length]
-		params <- New@Parser[]
-		Print[["Parsing "]Append[fname]]
-		Null[text, params, New@Parse Program[], 0]
-		{
-			Print["Parsing imports"]
-			Process Imports[~, params]
-			{
-				tree <- [~]Workers << [ Map[[~]Workers >>, ["Check Worker Literals"]Set Input[1, ~]] ]
-				{ Print["Compiling"] }
-			}
-			compiled <- [Tree to Program Native[tree]]Compile Program[C Program[]]
-			{ Print["Compiled program to backend"] }
-			outfile <- <String@File[ [fname]Append[".c"] ]
-			[outfile]Put String[ [compiled]Text ]
-			{ Print[["Wrote output to "]Append[ [fname]Append[".c"] ]] }
-		}
-	}{
-		REPL[New@Parser[]]
-	}
-}
-*/
-
--- a/parser_old_c.rhope	Wed Oct 13 01:15:04 2010 +0000
+++ b/parser_old_c.rhope	Wed Oct 13 01:18:53 2010 +0000
@@ -1578,32 +1578,4 @@
 	out <- Fold[Add If Store[?, ?, params], stores, [node]Assignments >>]
 }
 
-/*
-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"]
-	}
-}
-*/
 
--- /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
--- /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
+	
+
+	
--- 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]