-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add javascript timing metrics to timing panel onLoad if available #319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Nice feature, very usefull. Waiting for release:) |
Is there anything I can do to help get this merged? |
👍 |
I like the idea two, but can you do two things:
|
|
Thanks @mindsocket, that sounds sensible. Regarding the fallback, I saw the condition check for With regard to the second point, I'm not sure if we can make an educated guess about all applications and which performance measuring is useful (e.g. domain lookup time isn't totally useless when debugging a frontend issue). Do you think we could make that configurable (without adding another setting)? Is there another way to specify all of them? |
My admittedly opinionated approach was to choose metrics based on those So, in terms of an alternative solution, one could simply add all of the This appears to be possible without an explicit list by iterating over the One way to make it "configurable" might be to have a basic list shown by Let me know what you think, happy to let you run with it, or I can resubmit On 3 March 2013 22:33, Jannis Leidel notifications@github.com wrote:
|
You're right, network and DNS stats are less useful for most debugging sessions, but completely leaving them out would be a bad idea. When using the toolbar to get a picture of the performance of a Django site you usually try to get a picture of a bigger stack -- memory, database, cache, search index, etc. -- effectively the single reason why there are so different panels included. Getting access to information about browser performance is incredibly useful to eventually finding issues that other panels cannot describe successfully. I agree it may delude the frontend related performance stats, so maybe we should group the stats in "rendering" and "networking"? |
Very cool idea. I'm curious... Are the timing set up calls initiated early enough? I haven't played with this yet but was curious. Also, a waterfall like display would be slick but I wouldn't hold this back as it is. |
@jezdez We could group them. I'll try to add the others in the coming days. IMHO the commit as is could go out without that in the interests of getting it in front of more eyes for feedback. @robhudson The timing is captured automatically by the browser (it's a builtin in many modern browsers), the javascript above just grabs it when all is said and done (after page load). A waterfall (a la SQL queries) is a great idea, if I get a chance I'll take a look |
@jezdez I've included more of the timing events. Also, based on @robhudson 's suggestion I took inspiration from the SQL panel and rendered a timeline of timing events. I'm not sure I like the output exactly as I have it now, but it's an improvement. |
Awesome, this looks amazing @mindsocket! Any feedback @robhudson? |
Is there anything I can do to help get this merged? |
Apologies... I missed the original call from @jezdez. This looks pretty good. My only concern is that this is using inline scripts. I've been away from debug toolbar but thought we had some efforts to reduce the amount of inline scripting. (I just found issue #330 which would actually be nice) Would it be much more effort to put this in the javascript file with a hook into the panel display events? |
timingOffset = perf.timing.navigationStart, | ||
timingEnd = perf.timing.loadEventEnd; | ||
var totalTime = timingEnd - timingOffset; | ||
console.log(timingOffset, timingEnd, totalTime); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want this removed before merging.
I'll move the inline javascript to an included file. As an included panel, is toolbar.js ok for that purpose? If not, where, and should the panel then render the inclusion? I'll also remove the console logging and replace the load event binding with a jQuery.bind('load'...) |
I've rebased and updated per suggestions. JS is minified already based on lastest toolbar.js, so hopefully this is good to go. |
…d formatting, and minified js
LGTM! |
Looks great to me too. |
@mindsocket Is there anything you need to add here based on @andymckay's comment? |
@robhudson I believe the solution as committed is the only way to ensure loadEventEnd is picked up in all browsers. So, nothing to add AFAIK |
Committed and pushed a change to the setTimeout call (reduced delay to 0). Tested and working on Firefox and Chrome |
Ping @andymckay and @robhudson , I think we're close :) |
Is there anything I can do to help get this merged? I'm going to use it in a talk at PyConAU next month and having it in mainline means I can say it's a more readily available tool. |
Add javascript timing metrics to timing panel onLoad if available
Add javascript timing metrics to timing panel onLoad if available
Some browsers support navigation timing via javascript. Since these metrics fit the category of timing, this commit adds a section to the timing panel containing key metrics from the browser, triggered soon after the onLoad event.
The change is plain javascript, so no library dependencies.
Background:
https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/NavigationTiming/Overview.html
Screenshot:
http://dl.dropbox.com/u/15940111/browser_timing.png
Tested on Chrome 22 and Firefox 14