[svn:parrot] r42835 - trunk/compilers/pct/src/PCT

pmichaud at svn.parrot.org pmichaud at svn.parrot.org
Tue Dec 1 16:58:58 UTC 2009


Author: pmichaud
Date: Tue Dec  1 16:58:56 2009
New Revision: 42835
URL: https://trac.parrot.org/parrot/changeset/42835

Log:
[pct]:  Add a simple --stagestats option to PCT::HLLCompiler.

Modified:
   trunk/compilers/pct/src/PCT/HLLCompiler.pir

Modified: trunk/compilers/pct/src/PCT/HLLCompiler.pir
==============================================================================
--- trunk/compilers/pct/src/PCT/HLLCompiler.pir	Tue Dec  1 12:52:00 2009	(r42834)
+++ trunk/compilers/pct/src/PCT/HLLCompiler.pir	Tue Dec  1 16:58:56 2009	(r42835)
@@ -32,7 +32,7 @@
     $P0 = split ' ', 'parse past post pir evalpmc'
     setattribute self, '@stages', $P0
 
-    $P0 = split ' ', 'e=s help|h target=s dumper=s trace|t=s encoding=s output|o=s combine version|v'
+    $P0 = split ' ', 'e=s help|h target=s dumper=s trace|t=s encoding=s output|o=s combine version|v stagestats'
     setattribute self, '@cmdoptions', $P0
 
     $P1 = box <<'    USAGE'
@@ -298,18 +298,37 @@
     target = adverbs['target']
     target = downcase target
 
+    .local int stagestats
+    stagestats = adverbs['stagestats']
+
     .local pmc stages, result, it
     result = source
     stages = getattribute self, '@stages'
     it = iter stages
+    if stagestats goto stagestats_loop
+
   iter_loop:
-    unless it goto iter_end
+    unless it goto have_result
     .local string stagename
     stagename = shift it
     result = self.stagename(result, adverbs :flat :named)
     if target == stagename goto have_result
     goto iter_loop
-  iter_end:
+
+  stagestats_loop:
+    unless it goto have_result
+    stagename = shift it
+    $N0 = time
+    result = self.stagename(result, adverbs :flat :named)
+    $N1 = time
+    $N2 = $N1 - $N0
+    printerr "Stage '"
+    printerr stagename
+    printerr "': "
+    printerr $N2
+    printerr " sec\n"
+    if target == stagename goto have_result
+    goto stagestats_loop
 
   have_result:
     .return (result)


More information about the parrot-commits mailing list