[Haskell-beginners] profiling a program that writes midi events

Dennis Raddle dennis.raddle at gmail.com
Mon Apr 16 23:47:19 CEST 2012

I want to profile a program, but it's not the usual kind of "run once, it
completes" program. It computes a bunch of midi events and writes them to a
MIDI port via the Sound.PortMidi module. It waits between events so that
each one happens in the proper place in the music. And the program must not
exit while it is writing events.

When I run it, it takes about ten seconds until the music starts, so it
must be doing most of the computation then. But it takes several minutes as
it plays music.

How would I profile this kind of program?

One possibility is to modify it a bit so it computes all the midi events
but doesn't send them, and just exits. However, I have to make sure it
actually computes the events all the way (due to language laziness). If I
don't write the events to PortMidi, then they are never used. I'm not sure
on how to ensure an expression is completely evaluated if it never used.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/beginners/attachments/20120416/45712973/attachment.htm>

More information about the Beginners mailing list