Bug 144808 - Web Inspector: REGRESSION (r175203): No profile information is shown in Inspector
Summary: Web Inspector: REGRESSION (r175203): No profile information is shown in Inspe...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Matt Baker
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2015-05-08 12:08 PDT by Matt Baker
Modified: 2015-05-11 13:10 PDT (History)
9 users (show)

See Also:


Attachments
[TEST] profile test page (431 bytes, text/html)
2015-05-08 12:08 PDT, Matt Baker
no flags Details
[IMAGE] missing profile records (303.54 KB, image/png)
2015-05-08 12:13 PDT, Matt Baker
no flags Details
[Patch] WIP (8.29 KB, patch)
2015-05-08 20:19 PDT, Matt Baker
no flags Details | Formatted Diff | Diff
[Image] timing mismatch (148.75 KB, image/jpeg)
2015-05-08 20:37 PDT, Matt Baker
no flags Details
[Patch] Proposed Fix (8.38 KB, patch)
2015-05-10 17:50 PDT, Matt Baker
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Baker 2015-05-08 12:08:28 PDT
Created attachment 252736 [details]
[TEST] profile test page

* SUMMARY
No profile information is shown in Inspector.

Recording a profile adds a profile parent record to the JavaScript & Events timeline, but it has no child records.

* STEPS TO REPRODUCE
1. Inspect attached test page (profile-test.html)
2. Begin a new timeline recording from the Inspector.
3. Run the test in test page
4. Select the JavaScript & Events timeline, expand all records.
  => "Test" Profile Recorded is visible, but it has no child records (see attached screenshot).
Comment 1 Matt Baker 2015-05-08 12:09:03 PDT
<rdar://problem/20622499>
Comment 2 Matt Baker 2015-05-08 12:13:11 PDT
Created attachment 252737 [details]
[IMAGE] missing profile records
Comment 3 Matt Baker 2015-05-08 20:19:46 PDT
Created attachment 252764 [details]
[Patch] WIP

Ready for feedback, not ready to land
Comment 4 Matt Baker 2015-05-08 20:37:33 PDT
Created attachment 252765 [details]
[Image] timing mismatch

When a profile is started after recording has already begun, there will be two entries for each profiled function call: one for the outer function that called console.profile, and a second for the profile itself.

I noticed that the total, self, and average times reported for the profiled functions are different for the two cases described above (see screenshot).

This seems like a bug, since the profiled code executed only once. The start times also differ.
Comment 5 Brian Burg 2015-05-09 09:55:37 PDT
Comment on attachment 252764 [details]
[Patch] WIP

Ugh, I regret messing with this code :)

It seems to me that we aren't gaining much by using independent stopwatches at all. The only way it would make sense in the UI is if console profiles created a new Timeline recording, but I'm not sure the tiny number of users for this function justifies the complexity.

The start time doesn't show up as "0" even with how the code is now. Is it possible to always use the shared stopwatch?
Comment 6 Darin Adler 2015-05-10 14:00:18 PDT
Comment on attachment 252764 [details]
[Patch] WIP

View in context: https://bugs.webkit.org/attachment.cgi?id=252764&action=review

Patch is OK, but there are two issues we should fix.

> Source/JavaScriptCore/profiler/Profile.h:32
> +#include <wtf/Stopwatch.h>

Should not include the header. Just need a forward declaration here.

> Source/JavaScriptCore/profiler/Profile.h:39
> +    static PassRefPtr<Profile> create(const String& title, unsigned uid, PassRefPtr<Stopwatch>);

New code should not use PassRefPtr. See <http://www.webkit.org/coding/RefPtr.html>. In this case, the argument should be a Stopwatch& because the function does not take ownership of it and it can’t be null.
Comment 7 Matt Baker 2015-05-10 14:40:42 PDT
> > Source/JavaScriptCore/profiler/Profile.h:39
> > +    static PassRefPtr<Profile> create(const String& title, unsigned uid, PassRefPtr<Stopwatch>);
> 
> New code should not use PassRefPtr. See
> <http://www.webkit.org/coding/RefPtr.html>. In this case, the argument
> should be a Stopwatch& because the function does not take ownership of it
> and it can’t be null.

Now I'm thinking ProfileGenerator should just sample its stopwatch and pass the start time to Profile::create, eliminating the need for a Stopwatch reference entirely.
Comment 8 Matt Baker 2015-05-10 17:50:13 PDT
Created attachment 252832 [details]
[Patch] Proposed Fix
Comment 9 Darin Adler 2015-05-10 17:52:31 PDT
Comment on attachment 252832 [details]
[Patch] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=252832&action=review

Looks OK.

> Source/WebCore/inspector/InspectorTimelineAgent.cpp:260
> +    startProfiling(exec, title, m_instrumentingAgents->inspectorEnvironment().executionStopwatch());

This should change from a double to a std::chrono at some point.
Comment 10 WebKit Commit Bot 2015-05-11 13:10:40 PDT
Comment on attachment 252832 [details]
[Patch] Proposed Fix

Clearing flags on attachment: 252832

Committed r184117: <http://trac.webkit.org/changeset/184117>
Comment 11 WebKit Commit Bot 2015-05-11 13:10:44 PDT
All reviewed patches have been landed.  Closing bug.