Changes for Windows support

* Files are opened with 'b' mode
Portability. SIGUSR1 handler only registered on systems that support it.
Rates are now measured as a moving average

This implementation uses less memory than the previous since
we don't have to save all of the samples.