EclipseFP supports directly the lightier memory profiling scheme that GHC provides. This scheme shows the memory used, grouped by variable type, during the time the program is executing.
To start an executable with profiling support, right click the project root, go to the Run As menu and then select Haskell Application with Profiling. This will open a window with the list of executables in your Cabal file. Select the one you want and click Run
Once the program finishes, a file will be created in your project root named
<name of your executable>_<date>_<time>
.hp. This is the
file which contains the trace of memory used by your program. This file is automatically opened
by the plug-in, showing a graph of your memory.
Technical note: when profiling mode is selected for an executable, it is run
adding the runtime option -hT
. You can run the executable with other profile options
outside of EclipseFP, and then inspect the resulting .hp
inside Eclipse.
rtsopts
problemSometimes when an executable is set for profiling, an error message is shown telling something
about rtsopts
, and an empty trace is generated. This happens because, from GHC 7 on,
you have to add a special flag to the compiler to generate profiling traces.
To do this, open the Cabal editor and go to the Executables tab. Select the executable
you want to profile and add -rtsopts
to the Compiler flags textbox. Save the Cabal
file and clean your project.