Bug 151695 - Web Inspector: Split code coverage and type profilers
Summary: Web Inspector: Split code coverage and type profilers
Status: ASSIGNED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Local Build
Hardware: All All
: P2 Normal
Assignee: Nikita Vasilyev
URL:
Keywords: InRadar
Depends on: 162469 160750 160973
Blocks: 146115
  Show dependency treegraph
 
Reported: 2015-11-30 22:34 PST by Nikita Vasilyev
Modified: 2016-12-13 15:37 PST (History)
4 users (show)

See Also:


Attachments
WIP (4.70 KB, patch)
2016-07-28 16:12 PDT, Nikita Vasilyev
nvasilyev: review-
nvasilyev: commit-queue-
Details | Formatted Diff | Diff
WIP (4.68 KB, patch)
2016-07-28 16:14 PDT, Nikita Vasilyev
nvasilyev: review-
nvasilyev: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nikita Vasilyev 2015-11-30 22:34:56 PST
* Split code coverage and type profilers;
* Turn on code coverage profiler (grayed out text) by default;
* Turn off type profiler (type info pills) by default;
* [T] button will continue to toggle type profiler but won't affect code coverage profiler;
* Code hotness visualizer, when implemented, will introduce a new button next to [T] and will be off by default.
Comment 1 Radar WebKit Bug Importer 2015-11-30 22:35:10 PST
<rdar://problem/23700835>
Comment 2 Nikita Vasilyev 2016-07-28 16:12:35 PDT
Created attachment 284830 [details]
WIP
Comment 3 Nikita Vasilyev 2016-07-28 16:14:44 PDT
Created attachment 284831 [details]
WIP
Comment 4 BJ Burg 2016-07-28 16:16:08 PDT
(In reply to comment #0)
> * Split code coverage and type profilers;
> * Turn on code coverage profiler (grayed out text) by default;
> * Turn off type profiler (type info pills) by default;
> * [T] button will continue to toggle type profiler but won't affect code
> coverage profiler;
> * Code hotness visualizer, when implemented, will introduce a new button
> next to [T] and will be off by default.

Please do not do all of these things in one patch.
Comment 5 Joseph Pecoraro 2016-07-28 16:19:06 PDT
(In reply to comment #0)
> * Turn on code coverage profiler (grayed out text) by default;

When doing this, it would be good to understand its performance impact. We spent a lot of time optimizing performance when the inspector is open for Timelines. It would be good to understand what the impact of this is if we have it always on. Or, change Timeline recording to also turn this off, to avoid a performance impact.
Comment 6 Nikita Vasilyev 2016-07-28 16:28:54 PDT
(In reply to comment #5)
> (In reply to comment #0)
> > * Turn on code coverage profiler (grayed out text) by default;
> 
> When doing this, it would be good to understand its performance impact. We
> spent a lot of time optimizing performance when the inspector is open for
> Timelines. It would be good to understand what the impact of this is if we
> have it always on. Or, change Timeline recording to also turn this off, to
> avoid a performance impact.

The front-end doesn't do anything performance intensive until a JS resource is visible.

I don't know what happens on the backend. Saam should know.
Comment 7 Nikita Vasilyev 2016-07-28 16:31:20 PDT
(In reply to comment #4)
> (In reply to comment #0)
> > * Split code coverage and type profilers;
> > * Turn on code coverage profiler (grayed out text) by default;
> > * Turn off type profiler (type info pills) by default;
> > * [T] button will continue to toggle type profiler but won't affect code
> > coverage profiler;
> > * Code hotness visualizer, when implemented, will introduce a new button
> > next to [T] and will be off by default.
> 
> Please do not do all of these things in one patch.

I intended to do the first 4 points in one patch.
2nd to 4th points are just clarifications for the 1st.
Comment 8 Joseph Pecoraro 2016-07-28 16:33:31 PDT
(In reply to comment #6)
> (In reply to comment #5)
> > (In reply to comment #0)
> > > * Turn on code coverage profiler (grayed out text) by default;
> > 
> > When doing this, it would be good to understand its performance impact. We
> > spent a lot of time optimizing performance when the inspector is open for
> > Timelines. It would be good to understand what the impact of this is if we
> > have it always on. Or, change Timeline recording to also turn this off, to
> > avoid a performance impact.
> 
> The front-end doesn't do anything performance intensive until a JS resource
> is visible.
> 
> I don't know what happens on the backend. Saam should know.

I'm worried about how this will slow down content on the page. For example, running a benchmark with the code coverage enabled / not enabled. Anyone can run that and get numbers. It may be negligible, but we don't know until we measure. And we can't easily until this is separated from the Type Profiler, which you are doing!
Comment 9 Nikita Vasilyev 2016-07-28 16:47:02 PDT
Saam,

RuntimeAgent.enableTypeProfiler() currently enables both type profiler AND basic blocks annotator (for grayed out unexecuted code).

How hard would it be to decouple these two?

Currently, calling RuntimeAgent.getBasicBlocks before RuntimeAgent.enableTypeProfiler() results in error:
    [Error] Error in getting basic block locations: The VM does not currently have a Control Flow Profiler.
Comment 10 Saam Barati 2016-07-31 14:24:34 PDT
(In reply to comment #0)
> * Split code coverage and type profilers;
This should be easy to do. It probably requires hacking
on the protocol a bit, but the control flow profiler, and type profiler,
are logically separate inside JSC. I can help review such a patch. I agree
with Brian that this should be done in its own patch (I have less preference on
the combining of other bits in other patches because I don't work on Inspector much).

> * Turn on code coverage profiler (grayed out text) by default;
This sounds like a good idea to me. The performance impact of control flow
profiler was something like 10% last time I checked. Maybe a bit less.
But regardless, as Joe mentioned, this should definitely be disabled when
recording a timeline. We don't want this influencing the data we get out
of the sampling profiler.

> * Turn off type profiler (type info pills) by default;
Isn't this already the default?

> * [T] button will continue to toggle type profiler but won't affect code
> coverage profiler;
Sounds good to me.

> * Code hotness visualizer, when implemented, will introduce a new button
> next to [T] and will be off by default.
What is the code hotness visualizer? Is this going to use data from the sampling
profiler? Were you thinking this should be a hybrid of the sampling profiler and
the control flow profiler? I think it's really important that it's not a hybrid.
We don't want the control flow profiler to be enabled when sampling because it
will bias the data we get from the sample. We worked really hard to have the inspector
disable other JSC profilers/debugger features while taking a sample because we
want JSC to run the program being sampled in as close to its natural state as possible.

I guess if it's not a hybrid of these two profilers, it's important to ask if we really
need to decouple this from the type profiler. It seems like there is both good and bad
in doing this. It's nice to have the control flow profiler always on. It's bad to add complexity
to the inspector's interface by allowing them to be decoupled. Others probably have stronger/more
informed opinions about this than me.
Comment 11 Nikita Vasilyev 2016-08-01 11:34:20 PDT
(In reply to comment #10)
> (In reply to comment #0)
> > * Split code coverage and type profilers;
> This should be easy to do. It probably requires hacking
> on the protocol a bit, but the control flow profiler, and type profiler,
> are logically separate inside JSC. I can help review such a patch. I agree
> with Brian that this should be done in its own patch (I have less preference
> on
> the combining of other bits in other patches because I don't work on
> Inspector much).

I agree now that backend (JSC) and Web Inspector front-end changes should be
in separate patches.

> 
> > * Turn on code coverage profiler (grayed out text) by default;
> This sounds like a good idea to me. The performance impact of control flow
> profiler was something like 10% last time I checked. Maybe a bit less.
> But regardless, as Joe mentioned, this should definitely be disabled when
> recording a timeline. We don't want this influencing the data we get out
> of the sampling profiler.

Yes, it should be disabled when recording a timeline.

> 
> > * Turn off type profiler (type info pills) by default;
> Isn't this already the default?

Yes, it is. I meant to write "Keep type profiler turned off by default".

> > * Code hotness visualizer, when implemented, will introduce a new button
> > next to [T] and will be off by default.
> What is the code hotness visualizer? Is this going to use data from the
> sampling
> profiler? Were you thinking this should be a hybrid of the sampling profiler
> and
> the control flow profiler? I think it's really important that it's not a
> hybrid.
> We don't want the control flow profiler to be enabled when sampling because
> it
> will bias the data we get from the sample. We worked really hard to have the
> inspector
> disable other JSC profilers/debugger features while taking a sample because
> we
> want JSC to run the program being sampled in as close to its natural state
> as possible.

I had written this before sampling profiler was implemented.
Let's keep the code hotness visualizer, whatever it would be, out of the scope of this bug.

> 
> I guess if it's not a hybrid of these two profilers, it's important to ask
> if we really
> need to decouple this from the type profiler. It seems like there is both
> good and bad
> in doing this. It's nice to have the control flow profiler always on. It's
> bad to add complexity
> to the inspector's interface by allowing them to be decoupled. Others
> probably have stronger/more
> informed opinions about this than me.

I find type profiler too intrusive to keep it enabled all the time. 
The control flow profiler adds a lot of value and doesn't
take any extra screen space.
Comment 12 Joseph Pecoraro 2016-08-08 11:57:29 PDT
(In reply to comment #11)
> (In reply to comment #10)
> > (In reply to comment #0)
> > > * Split code coverage and type profilers;
> > [...] I agree with Brian that this should be done in its own patch
> > (I have less preference on the combining of other bits in other
> > patches because I don't work on Inspector much).
> 
> I agree now that backend (JSC) and Web Inspector front-end changes should be
> in separate patches.

This is not so much about separate patches for backend and frontend changes. This is about separate patches for separate work. Splitting the two profilers is a single task, and that task should have its own bug and patch, separate from all the other tasks mentioned in this bug.