Thursday, 5 July 2007

Timidity power usage

A while ago, I tried profiling my computer power usage with PowerTOP. This showed, that Timidity was waking up 100 times per second. As I wasn't using midi for anything at the time, this seemed rather odd. Tracing running Timidity with strace, I noticed that the alsa sequencer interface was polling something.

Digging Timidity cvs tree, I noticed this polling was introduced, when stream tracing support was added to alsa interface. Stream tracing allows for displaying Timidity state in real time, so it can't just sleep until something happens. For normal usage as software midi interface, this is useless. Before this tracing support was added, Timidity did sleep until some event occurred.

So, this patch makes Timidity alsa sequencer interface poll at 100 Hz only, when stream tracing is used. Otherwise, it just sleeps until something happens. This doesn't seem to break anything and considering that it doesn't actually add new functionality, I believe it's safe to use.

The patch: nopoll.diff

No comments: