Profiling Tools For F Sharp
Last changed: -62.23.47.74

.

One advantage of F# running on top of the CLR is that the CRL offers lots of hooks that can be used profile it. There are lots of tools available to help you profile applications build on the CLR, and therefore F# applications, some are free and some you probably have already installed on your machine.

Performance Monitor

Perfmon is a good place to start profiling your F# application. As well as being able to view and record important statistics such as processor usage, disk queue and page faults, it all so has a number of counters that are .NET specific. The most interesting for an F# application are probably the .NET CLR memory counters most are useful depending on what you are profiling for. A good place to start is probably “# Bytes in all heaps” and “% time in GC”, these two should give you a reasonably idea if the memory usage of the application needs to be changed.

Odds are you already have perfmon installed on your machine, just press <windows>+R and type perfmon into the run-box to load it. Once loaded it’s fairly intuitive to use.

CLR Profiler

The CLR profile gives a great visual representation of both the objects in memory and the call graph of your application. This is an excellent tool for get a good idea what parts of your code have the longest running time and which objects are taking up significant amounts of space in memory. The only really problem with it is it can be very slow; things can be speeded up by only profile method calls or memory allocations, not both at the same time.

The application can be obtained from the below address, it requires no setup, includes the source and is fairly intuitive to use.

http://www.microsoft.com/downloads/details.aspx?FamilyId=86CE6052-D7F4-4AEB-9B7A-94635BEEBDDA&displaylang=en

People have built a number of extensions for this tool, one that is particularly useful is this tool to summarise average call times form Rico Mariani:

http://blogs.msdn.com/ricom/archive/2005/08/08/449246.aspx

Other tools

There are a fairly large number of profiling tool, the following link provides a good summary:

http://sharptoolbox.com/Search.aspx?Query=ToolName%3d%26Category%3d09009393-4a62-4eb4-97e1-4a2928e43dd1