On 20-mei-2007, at 17:39, Anthony Chaumas-Pellet wrote:
I'm currently away a wxhaskell program that uses up 100% CPU
even when it should be idle. So, rather than doing blind guesswork,
I've thought about using profiling to spot the zealous function. I do
not need a very accurate result, though.
ghc with -prof -auto(-all) produces the following error message,
however: "Could not find module `Graphics.UI.WX': Perhaps you haven't
installed the profiling libraries for package wx-0.10.1? Use -v to see
a list of the files searched for."
So, I guess I need to rebuild wx with profiling, but I'm not sure how
to do that exactly; <search engine> and the Wiki did not turn up any
pointers, and there are no ready-made options to build wx with
profiling. It seems Cabal can build a library with profiling
automatically, but I don't think there exists a Cabalized version of
That, and I'm not sure if recompiling libraries to add profiling is a
great idea, as wx itself may depend on other external libraries. So,
is there a better way than profiling in my case, or am I missing
something obvious here?
You are not missing anything obvious. The process is in fact
somewhat tricky. What you have to do is the following:
- compile wxHaskell with profiling (by editing the makefiles to
-prof -auto-all argument to GHC)
- *install* the profiled wxHaskell
- manually move the profiled object libraries to ones including the _p
string before the .a, e.g. move
/usr/local/wxhaskell/lib/libwx.a to /usr/local/wxhaskell/lib/libwx_p.a
- manually move the profiled .hi files to .p_hi files, e.g. move
- compile wxHaskell without profiling
- install the non-profiled wxHaskell
- enjoy the ability to use wxHaskell in both profiled and unprofiled
Note: this assumes you are on a Unix-like system. I have no clue how
to do this on Windows, but I'm told it is similar.
Oh, and this is tested and works. The external libraries that wx relies
on are either truly external, as in called through the FFI, or GHC
libs that normally already have a profiling version available.
With regards, Arthur van Leeuwen.
/\ / | arthurvl@xxxxxxxx | Work like you don't need
/__\ / | A friend is someone with whom | Love like you have never
/ \/__ | you can dare to be yourself | Dance like there's nobody
Haskell-Cafe mailing list