Add Timed Tracing
I'm having trouble tracking down which part is slow so this change
adds a trace method that allows you to trace method calls. It uses
the logger to output debug messages and also calculates the time
spent executing the method.