RESOLVED FIXED 45664
Web Inspector: [Resources panel] Timing accuracy.
https://bugs.webkit.org/show_bug.cgi?id=45664
Summary Web Inspector: [Resources panel] Timing accuracy.
Pavel Feldman
Reported 2010-09-13 06:10:23 PDT
I set up a test page with two images followed by a JavaScript block which executes a script for 5 seconds in a tight loop. In Firebug, the images are correctly shown loading in parallel. In Chrome, the first image stop load time and the second image start show as after the tight loop finishes. It seems that long-running JavaScript code makes the timings in the resources panel inaccurate. Firebug used to have similar problems, but they were fixed. See this blog post for more information: http://www.softwareishard.com/blog/firebug/firebug-http-time-monitor/. See images attached.
Attachments
[PATCH] Proposed change. (27.79 KB, patch)
2010-09-14 09:11 PDT, Pavel Feldman
no flags
[PATCH] Same with the chromium agent call fixed. (28.62 KB, patch)
2010-09-14 09:14 PDT, Pavel Feldman
no flags
[PATCH] More work for bots, no default values this time. (33.83 KB, patch)
2010-09-14 10:08 PDT, Pavel Feldman
no flags
[PATCH] Rebaselined. Bots, jump in. (34.08 KB, patch)
2010-09-15 01:11 PDT, Pavel Feldman
yurys: review+
[PATCH] Review comments addressed (for try bots). (36.85 KB, patch)
2010-09-15 02:06 PDT, Pavel Feldman
no flags
[PATCH] More rebaselines. (36.85 KB, patch)
2010-09-15 02:48 PDT, Pavel Feldman
no flags
[PATCH] More rebaselines. (44.07 KB, patch)
2010-09-15 03:05 PDT, Pavel Feldman
no flags
Pavel Feldman
Comment 1 2010-09-13 08:09:39 PDT
<< Previous post was a report from user >> << Below is a clarification note from Steve >> A note from Steve with A more complete description of the problem: Web Inspector appears to be displaying incorrect network timing info that's thrown off by JS execution in the page. Here's an example page: http://stevesouders.com/cuzillion/?c0=bj2hfff1_5_f&c1=bi2hfff2_0_f There are two resources. Both start downloading at about the same time. The script finishes downloading around 1 second. The image finishes downloading around 2 seconds. This is in fact the behavior shown by HttpWatch and Firebug Net Panel. However, when viewed in Web Inspector in Chrome the image is shown as taking ~6 seconds to download. That's because the script has a 5 second tight loop. This is likely blocking the Web Inspector from determining the correct timing for the image download. (I verified the true image download time by watching my server logs.)
Pavel Feldman
Comment 2 2010-09-13 08:11:16 PDT
The reason is that we mark resource finish time after the JS execution callback. I'll look into it.
Pavel Feldman
Comment 3 2010-09-13 09:28:31 PDT
Investigation note: To problems here: 1) Sync script processing is happening before we measure resource finish time (easy to fix) 2) Resource timing is measured from within WebCore dispatch events that are by definition synchronous. As a result, async network events are serialized and then measured (and hence are bogus). The way to fix it is to rely upon the network stack timers reported as a part of ResourceLoadTiming struct. Two missing pieces here: - resource finish time is currently not a part of load timing, need to extend it - not all of the WebKit platforms will be able to provide resource load timing, hence we will need to fall back to the existing behavior.
Pavel Feldman
Comment 4 2010-09-14 09:11:55 PDT
Created attachment 67561 [details] [PATCH] Proposed change. With this change, platforms have a way to report proper resource load finish time to the WebCore. Rest of the timers can already be pushed by means of ResourceLoadTiming. Resource finish is a bit different since it is not available on didReceiveResponse. Hence it should be reported as a part of didFinishLoad.
Pavel Feldman
Comment 5 2010-09-14 09:14:28 PDT
Created attachment 67563 [details] [PATCH] Same with the chromium agent call fixed. Chromium bots will still fail compile since they need coordinated landing.
Eric Seidel (no email)
Comment 6 2010-09-14 09:28:37 PDT
WebKit Review Bot
Comment 7 2010-09-14 09:30:36 PDT
WebKit Review Bot
Comment 8 2010-09-14 09:39:47 PDT
Eric Seidel (no email)
Comment 9 2010-09-14 09:42:07 PDT
WebKit Review Bot
Comment 10 2010-09-14 09:47:42 PDT
WebKit Review Bot
Comment 11 2010-09-14 09:54:31 PDT
Pavel Feldman
Comment 12 2010-09-14 10:08:07 PDT
Created attachment 67572 [details] [PATCH] More work for bots, no default values this time.
Early Warning System Bot
Comment 13 2010-09-14 10:21:48 PDT
Eric Seidel (no email)
Comment 14 2010-09-14 10:28:11 PDT
WebKit Review Bot
Comment 15 2010-09-14 10:33:40 PDT
WebKit Review Bot
Comment 16 2010-09-14 10:45:26 PDT
WebKit Review Bot
Comment 17 2010-09-14 11:47:27 PDT
Pavel Feldman
Comment 18 2010-09-15 01:11:30 PDT
Created attachment 67653 [details] [PATCH] Rebaselined. Bots, jump in.
Yury Semikhatsky
Comment 19 2010-09-15 01:38:10 PDT
Comment on attachment 67653 [details] [PATCH] Rebaselined. Bots, jump in. Please address the comments before landing. View in context: https://bugs.webkit.org/attachment.cgi?id=67653&action=prettypatch > WebCore/inspector/InspectorController.cpp:1060 > + resource->endTiming(0); It might make sense to pass real time here. The timing may be useful in a scenario where the user checks whether the resource is available and takes further decision based on its availability. > WebCore/platform/network/ResourceHandleClient.h:76 > + virtual void didFinishLoading(ResourceHandle*, double) { } Please specify name for the second parameter. > WebKit/chromium/public/WebURLLoaderClient.h:67 > + virtual void didFinishLoading(WebURLLoader*, double finishTime) { } You will get "unused parameter" warning here. > WebKit/chromium/public/WebURLLoaderClient.h:70 > + void didFinishLoading(WebURLLoader* loader) { didFinishLoading(loader, 0); } This should be virtual, otherwise Chromium may break.
Pavel Feldman
Comment 20 2010-09-15 02:06:55 PDT
Created attachment 67658 [details] [PATCH] Review comments addressed (for try bots).
Eric Seidel (no email)
Comment 21 2010-09-15 02:28:41 PDT
Pavel Feldman
Comment 22 2010-09-15 02:48:06 PDT
Created attachment 67660 [details] [PATCH] More rebaselines.
Pavel Feldman
Comment 23 2010-09-15 03:05:59 PDT
Created attachment 67661 [details] [PATCH] More rebaselines.
Pavel Feldman
Comment 24 2010-09-15 05:13:40 PDT
M WebCore/ChangeLog M WebCore/inspector/InspectorController.cpp M WebCore/inspector/InspectorController.h M WebCore/inspector/InspectorResource.cpp M WebCore/inspector/InspectorResource.h M WebCore/loader/DocumentLoader.cpp M WebCore/loader/MainResourceLoader.cpp M WebCore/loader/MainResourceLoader.h M WebCore/loader/NetscapePlugInStreamLoader.cpp M WebCore/loader/PingLoader.h M WebCore/loader/ResourceLoadNotifier.cpp M WebCore/loader/ResourceLoadNotifier.h M WebCore/loader/ResourceLoader.cpp M WebCore/loader/ResourceLoader.h M WebCore/loader/SubresourceLoader.cpp M WebCore/loader/SubresourceLoader.h M WebCore/loader/appcache/ApplicationCacheGroup.cpp M WebCore/loader/appcache/ApplicationCacheGroup.h M WebCore/loader/icon/IconFetcher.cpp M WebCore/loader/icon/IconFetcher.h M WebCore/platform/graphics/gstreamer/WebKitWebSourceGStreamer.cpp M WebCore/platform/network/BlobResourceHandle.cpp M WebCore/platform/network/ResourceHandleClient.h M WebCore/platform/network/cf/ResourceHandleCFNet.cpp M WebCore/platform/network/curl/ResourceHandleCurl.cpp M WebCore/platform/network/curl/ResourceHandleManager.cpp M WebCore/platform/network/mac/ResourceHandleMac.mm M WebCore/platform/network/qt/QNetworkReplyHandler.cpp M WebCore/platform/network/qt/ResourceHandleQt.cpp M WebCore/platform/network/soup/ResourceHandleSoup.cpp M WebCore/platform/network/win/ResourceHandleWin.cpp M WebKit/chromium/ChangeLog M WebKit/chromium/public/WebURLLoaderClient.h M WebKit/chromium/src/ResourceHandle.cpp M WebKit/chromium/src/WebDevToolsAgentImpl.cpp M WebKit/gtk/ChangeLog M WebKit/gtk/webkit/webkitdownload.cpp Committed r67551
WebKit Review Bot
Comment 25 2010-09-15 05:29:28 PDT
http://trac.webkit.org/changeset/67551 might have broken Qt Linux Release
Eric Seidel (no email)
Comment 26 2010-09-16 01:24:54 PDT
Could this be causing the image load failure seen in bug 45875?
Pavel Feldman
Comment 27 2010-09-16 02:31:08 PDT
(In reply to comment #26) > Could this be causing the image load failure seen in bug 45875? I don't think so. This change only added parameter to the didFinishLoading. Did not change behavior.
Note You need to log in before you can comment on or make changes to this bug.