JavaScript Phantom JS - How to get performance timing?

With PhantomJS, I want to gather perfomance timing on page load time.

I test this 2 methods for gathering metrics

Setting own timing

var page = require('webpage').create();   
var system = require('system');
var loadingTime;

loadingTime = Date.now();
page.open('http://crawlbin.com', function (status) {
     loadingTime = Date.now() - loadingTime;
     console.log('Loading time ' + loadingTime + ' msec');
     phantom.exit();
});

Result : Loading time 499 msec

Using W3C Navigation Timing

var page = require('webpage').create();   
var system = require('system');

page.open('http://crawlbin.com', function (status) {
     console.log(window.performance.timing.loadEventEnd - window.performance.timing.navigationStart); 
     phantom.exit();
});

Result : 256

But I don't get the same result. Navigation Timing is always less than own timing and Navigation Timing has a much lower value.

What is the most accurate measurement?

Answer:1

I have a jqgrid and the first column I have a checkbox (checkAll others checkbox). I don't know how i do it. How I do a function to select all others checkbox in my jqgrid? $.getJSON("/Page/Table", ...

I have a jqgrid and the first column I have a checkbox (checkAll others checkbox). I don't know how i do it. How I do a function to select all others checkbox in my jqgrid? $.getJSON("/Page/Table", ...

  1. function select all checkbox
  2. select checkbox function

i'm trying to make a popup to draggable. does anyone help me how to do that, here is my code http://jsfiddle.net/Ur5Xn/38/ $(document).ready(function(){ function showAlertBox(){ $("#alert"...

i'm trying to make a popup to draggable. does anyone help me how to do that, here is my code http://jsfiddle.net/Ur5Xn/38/ $(document).ready(function(){ function showAlertBox(){ $("#alert"...

  1. make modal popup draggable jquery
  2. make modal popup draggable

I'm having issues with my NavigationUrl, basically if I wasn't storing the web address in the web config file this would be easy but it doesn't appear that you can call appSettings:SFL in line, does ...

I'm having issues with my NavigationUrl, basically if I wasn't storing the web address in the web config file this would be easy but it doesn't appear that you can call appSettings:SFL in line, does ...

I am trying to figure out how to open a link in a new window using Javascript or HTML. Here is what I have tried which I I have found NOT to work: <a href="http://www.google.com/" title="Google" ...

I am trying to figure out how to open a link in a new window using Javascript or HTML. Here is what I have tried which I I have found NOT to work: <a href="http://www.google.com/" title="Google" ...

  1. open link window
  2. open link new window
  3. open link new window html
  4. open link new window javascript
  5. open link incognito window chrome
  6. open link popup window
  7. open link new window jquery
  8. open link same window
  9. open link incognito window
  10. open link new window js
  11. open link modal window
  12. open link in window html
  13. open link new window css
  14. open link new window chrome
  15. open link same window javascript
  16. open link same window html
  17. open link new window angular
  18. open link in new window
  19. open link popup window html
  20. open link new window shortcut