Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I monitor the rendering time in a browser?

I work on an internal corporate system that has a web front-end using Tomcat.

  1. How can I monitor the rendering time of specific pages in a browser (IE6)?
  2. I would like to be able to record the results in a log file (separate log file or the Tomcat access log).

EDIT: Ideally, I need to monitor the rendering on the clients accessing the pages.

like image 847
adpd Avatar asked Mar 25 '10 15:03

adpd


People also ask

How do you measure render time on a website?

The total Render Time cannot be measured directly, but you can measure the time taken for your webpage to start rendering, The Start Render Metrics. The Start Render metric can be measured using the WebPage Test, and you have a section of the page performance result which show you the Start Render metric score.

What is browser rendering time?

Render time is the metric that refers to the time it takes for a website or web app to load enough that the user can actually interact with the page. While quite similar to load time which measures the time it takes for a page to become visible, render time will tell you how soon your app or website is usable.

How do you measure start render time?

How Do You Measure Start Render Time? Measuring start render time can only be done by noting the exact time the first interactive asset appears on the user's viewport. This can be done in real time with the Edgemesh Portal, or on demand with a tool like WebPageTest by Catchpoint.

What is the rendering process in a browser?

When a web page is loaded, the browser first reads the HTML text and constructs DOM Tree from it. Then it processes the CSS whether that is inline, embedded, or external CSS and constructs the CSSOM Tree from it. After these trees are constructed, then it constructs the Render-Tree from it.


2 Answers

The Navigation Timing API is available in modern browsers (IE9+) except Safari:

function onLoad() { 
  var now = new Date().getTime();
  var page_load_time = now - performance.timing.navigationStart;
  console.log("User-perceived page loading time: " + page_load_time);
}
like image 187
Brian Low Avatar answered Sep 19 '22 12:09

Brian Low


In case a browser has JavaScript enabled one of the things you could do is to write an inline script and send it first thing in your HTML. The script would do two things:

  1. Record current system time in a JS variable (if you're lucky the time could roughly correspond to the page rendering start time).
  2. Attach JS function to the page onLoad event. This function will then query the current system time once again, subtract the start time from step 1 and send it to the server along with the page location (or some unique ID you could insert into the inline script dynamically on your server).
<script language="JavaScript">
var renderStart = new Date().getTime();
window.onload=function() { 
   var elapsed = new Date().getTime()-renderStart;
   // send the info to the server 
   alert('Rendered in ' + elapsed + 'ms'); 
} 

</script>

... usual HTML starts here ...

You'd need to make sure that the page doesn’t override onload later in the code, but adds to the event handlers list instead.

like image 28
Vlad Gudim Avatar answered Sep 18 '22 12:09

Vlad Gudim