changeset 112:fd23ab2c1a73

Small changes to make profile data a little cleaner
author Mike Pavone <pavone@retrodev.com>
date Mon, 11 Oct 2010 21:53:27 -0400
parents 13dfe8214254
children 7ca80654c9bb
files cbackend.rhope nworker_c.rhope parser_old_c.rhope procnames procprofile.py string.rhope
diffstat 6 files changed, 54 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- 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)
--- 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
--- 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"]
 	}
-}
+} */
+
--- /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
--- /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
+	
+
+	
--- 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]