+1 in general. However,

- although it results in nice code on the client side, I'm a bit reluctant about putting all the code into the instance initialiser.

- how about reusing org.apache.jackrabbit.oak.stats.Clock instead of using Guava's Stopwatch? If necessary we could still implement Clock based on Stopwatch.

- Timer might not be the best name for the class. Should probably better be something with "Log" in its name

Michael

On 21.6.14 6:41 , Davide Giannella wrote:
Hello team,

in the warm laziness of a summer Saturday I was thinking about a way for
having in oak a timing facility for logging/benchmarking "critical" part
of the code. Something that we could put the logging to DEBUG and we
start see the information.

I started writing this quick sample

https://gist.github.com/davidegiannella/107f1f6bd16058020b64

any feedback? By using slf4j we would be enable to replace the
System.out with a LOG.debug and most of the magic would be done.

Don't know what the actual overhead for the class creation would be but
I like the layout within the code.

Any feedbacks?

Cheers
Davide


Reply via email to