Then obviously this article is for you. Learn how to measure your performance using W3C User Timing and Navigation Timing APIs.
Join the DZone community and get the full member experience.Join For Free
Sensu is an open source monitoring event pipeline. Try it today.
W3C User Timing API's
The W3C User Timing API is typically used in conjunction with W3C Navigation Timing API. The Navigation Timing API obtains exact latency measurements from the browser. You can read about it here. It will measure all tasks of a page load such as redirection, app cache, DNS, TCP, request, response, processing, onLoad, unload.
To very simply explain how you use the marks and measures, you put a begin mark at the beginning of the code you wish to measure, and end and measure marks at the end of the code you wish to measure. Here's an example:
Reporting on Timing Results
So now that we have the ability to easily capture our timings, how do we report on them? There are a couple of options. We can log the results to a log file. The positive about this method is that it is easy and requires no setup. The negative is that it will be difficult to analyze the results. Another option is to stream the results to a database. This, however will require database setup and code must be written to stream the data. However, once the timing results are in a database, they can be analyzed with the use of queries.
Things to Consider
Analyzing Results with Nastel AutoPilot Insight
Published at DZone with permission of Catherine Bernardone , DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.