O'Reilly logo

GWT in Action, Second Edition by Adam Tacy, Robert Hanson, Jason Essington, and Anne Tökke

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

19.1. Using the lightweight metrics tool

Before we get into what are and what aren’t lightweight metrics, let’s discuss the promise this tool hopes to provide. When developing an application, it’s often valuable to know how long an operation took to perform. This allows you to optimize a routine within the application and get hard data on how much better (or worse) it performs after the change.

Measuring the time it takes to execute an operation isn’t that difficult. You could hardcode a few debug statements to print out timings to the dev-mode console or to some TextArea on the page. Something like the following would work in most cases:

GWT.log("start: " + Duration.currentTimeMillis()); someExpensiveOperation(); GWT.log("end: " + Duration.currentTimeMillis()); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required