[Haskell-beginners] Profiling haskell code

Sayali Kulkarni Sayali.Kulkarni at kpitcummins.com
Thu Nov 13 02:57:50 EST 2008


Hello,

 

I am new to Haskell. I have written a small quicksort function in
Haskell. I want to profile it for time.

 

I have GHC 6.10.1 version and I have also installed the extra-libs that
it has on the Haskell home page. 

 

I followed the following steps for installing the extra-libs:

 

$ cd /to/the/library/source
$ runghc Setup.hs configure --enable-library-profiling
$ runghc Setup.hs build
$ runghc Setup.hs install

 

Following is the quicksort code that I'm using: 

 

quicksort [ ] = [ ]

quicksort (x : xs) = quicksort larger ++ [x ] ++ quicksort smaller

 
where

 
smaller = [a | a <- xs, a <= x ]

 
larger = [b | b <- xs, b > x ]

 

 

When I compile the code with the following command : 

 

$ ghc --make Project.hs -prof -auto-all
 
Then I tested it with the following command :
 
$ Project +RTS -p
 
It generates the .hi and the .o file but I cannot get the .prof file. 
 
Please let me know if any of the steps is missing or where could I check
my profiling info. 

 

 

Regards,

Sayali. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20081113/4351dc75/attachment-0001.htm


More information about the Beginners mailing list