Hi Tays,<br>If I understood correctly, if your compiler generates Haskell code, then later on you should compile this code (with GHC, for example) and running it implies a main function that is of the tipe IO() (i.e. IO Monad).
<br>What you can do is to add (it could be, for example, in debugging mode in your compiler) the code i paste below at the beginning and in the end of your main function.<br>Well, I don't know exactly if this answers your question. If it doesn't, my apologies.
<br>Cheers<br>Cristian<br><br><span style="font-family: courier new,monospace;">import System.Time</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">import Text.Printf
</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> {</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
; timeStart <- getClockTime</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><span style="font-style: italic; font-family: courier new,monospace;">
... your process</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> </span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ; timeEnd <- getClockTime</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
; let diff = (normalizeTimeDiff (diffClockTimes timeEnd timeStart))</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;">
; print ((((fromIntegral(tdPicosec diff))/(10^12))) + (fromIntegral((tdSec diff) + (60 * (tdMin diff)) + (3600 * (tdHour diff)))))</span><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<span style="font-family: courier new,monospace;"> ; return ()</span><br style="font-family: courier new,monospace;"><span style="font-family: courier new,monospace;"> }</span><br><br><div><span class="gmail_quote">
On 2/6/07, <b class="gmail_sendername">Seth Kurtzberg</b> <<a href="mailto:seth@cql.com">seth@cql.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
GHC has profiling support.<br><br>(By the way, many mail servers these days discard mail with no subject.)<br><br>I've seen a number of papers comparing the speed of Haskell code to code of other functional languages; there is a periodic "shoot out" with ocaml.
<br><br>Some probably have comparisons with imperative languages, and, even if they do not, the methodology should help you.<br><br>Seth Kurtzberg<br><br>On Mon, 5 Feb 2007 11:28:03 -0800 (PST)<br>Tays Soares <<a href="mailto:tayscristina@yahoo.com.br">
tayscristina@yahoo.com.br</a>> wrote:<br><br>> Hello everyone,<br>><br>> I did at my master thesis a compiler that generates Haskell code. Now I need to measure the execution time of my generated code and I've been searched and I don't know if I'm looking with the wrong keywords but I could not find anything. I just need to measure the time of simple functions, like Ackermann and Fibonacci. Does anyone know how to measure the execution time of a Haskell program or function?
<br>><br>> Thank you,<br>> Tays<br>><br>><br>><br>> __________________________________________________<br>> Fale com seus amigos de graça com o novo Yahoo! Messenger<br>> <a href="http://br.messenger.yahoo.com/">
http://br.messenger.yahoo.com/</a><br>_______________________________________________<br>Glasgow-haskell-users mailing list<br><a href="mailto:Glasgow-haskell-users@haskell.org">Glasgow-haskell-users@haskell.org</a><br><a href="http://www.haskell.org/mailman/listinfo/glasgow-haskell-users">
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users</a><br></blockquote></div><br>