[project @ 2002-02-28 18:50:40 by keithw]
authorkeithw <unknown>
Thu, 28 Feb 2002 18:50:42 +0000 (18:50 +0000)
committerkeithw <unknown>
Thu, 28 Feb 2002 18:50:42 +0000 (18:50 +0000)
Un-rot nofib-analyse, so it compiles with ghc-5.02.2.

* add a regexp for GNU time 1.7

* import Html hiding ((!)) now hides Html.! as well as !, so add an
  import qualified Html ((!)) as well.

* compile Printf with -fvia-c to work around bug in foreign import of
  snprintf (was always printing "0.00" no matter what input given).

glafp-utils/nofib-analyse/Main.hs
glafp-utils/nofib-analyse/Makefile
glafp-utils/nofib-analyse/Slurp.hs

index 3822860..40839f3 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: Main.hs,v 1.5 2001/02/21 16:24:34 simonmar Exp $
+-- $Id: Main.hs,v 1.6 2002/02/28 18:50:40 keithw Exp $
 
 -- (c) Simon Marlow 1997-1999
 -----------------------------------------------------------------------------
@@ -12,6 +12,7 @@ import Slurp
 import CmdLine
 
 import Html hiding ((!))
+import qualified Html ((!))
 import GlaExts
 import FiniteMap
 import GetOpt
index f4704da..5bdc6f8 100644 (file)
@@ -1,5 +1,5 @@
 # -----------------------------------------------------------------------------
-# $Id: Makefile,v 1.3 2001/02/21 16:24:34 simonmar Exp $
+# $Id: Makefile,v 1.4 2002/02/28 18:50:42 keithw Exp $
 # (c) Simon Marlow 1999-2000
 
 TOP=..
@@ -8,4 +8,6 @@ include $(TOP)/mk/boilerplate.mk
 SRC_HC_OPTS    += -fglasgow-exts -package util -package data -package text -cpp
 HS_PROG                = nofib-analyse
 
+Printf_HC_OPTS += -fvia-c
+
 include $(TOP)/mk/target.mk
index 2f11a7d..9e82df5 100644 (file)
@@ -1,5 +1,5 @@
 -----------------------------------------------------------------------------
--- $Id: Slurp.hs,v 1.2 2000/02/18 10:25:53 simonmar Exp $
+-- $Id: Slurp.hs,v 1.3 2002/02/28 18:50:42 keithw Exp $
 
 -- (c) Simon Marlow 1997-1999
 -----------------------------------------------------------------------------
@@ -81,6 +81,10 @@ of "time" will need different regexps.
 
 time_re = mkRegex "^[ \t]*([0-9.]+)[ \t]+real[ \t]+([0-9.]+)[ \t]+user[ \t]+([0-9.]+)[ \t]+sys[ \t]*$"
 
+time_gnu17_re = mkRegex "^[ \t]*([0-9.]+)user[ \t]+([0-9.]+)system[ \t]+([0-9.:]+)elapsed"
+                -- /usr/bin/time --version reports: GNU time 1.7
+                -- notice the order is different, and the elapsed time is [hh:]mm:ss.s
+
 size_re = mkRegex "^[ \t]*([0-9]+)[ \t]+([0-9]+)[ \t]+([0-9]+)"
 
 {-
@@ -185,6 +189,13 @@ parse_compile_time prog mod (l:ls) =
                [(prog,emptyResults{compile_time = ct})];
             Nothing -> 
 
+       case matchRegex time_gnu17_re l of {
+            Just (user:system:elapsed:_) ->
+               let ct  = addToFM emptyFM mod (read user)
+               in 
+               [(prog,emptyResults{compile_time = ct})];
+            Nothing -> 
+
        case matchRegex ghc1_re l of {
            Just (allocs:_:_:_:_:init:_:mut:_:gc:_) ->
              let 
@@ -230,14 +241,22 @@ parse_compile_time prog mod (l:ls) =
            Nothing ->
 
                parse_compile_time prog mod ls
-       }}}}}
+       }}}}}}
 
 parse_link_time prog [] = []
 parse_link_time prog (l:ls) =
-         case matchRegex time_re l of
-            Nothing -> parse_link_time prog ls
+         case matchRegex time_re l of {
             Just (real:user:system:_) ->
-               [(prog,emptyResults{link_time = Just (read user)})]
+               [(prog,emptyResults{link_time = Just (read user)})];
+            Nothing ->
+
+         case matchRegex time_gnu17_re l of {
+            Just (user:system:elapsed:_) ->
+               [(prog,emptyResults{link_time = Just (read user)})];
+            Nothing ->
+
+          parse_link_time prog ls
+          }}
 
 parse_run_time prog [] NotDone = []
 parse_run_time prog [] ex =[(prog,emptyResults{run_status=ex})]