Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(227)

Issue 397443002: [not for review] Add Draw entries to window Performance Timeline

Created:
6 years, 5 months ago by Mike B
Modified:
6 years ago
Reviewers:
Nat, enne (OOO)
CC:
chromium-reviews, Ian Vollick, jam, sievers+watch_chromium.org, jbauman+watch_chromium.org, darin-cc_chromium.org, asvitkine+watch_chromium.org, kalyank, piman+watch_chromium.org, cc-bugs_chromium.org, danakj
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

[not for review] Add Draw entries to window Performance Timeline [not for review] Spec: http://www.w3.org/TR/performance-timeline/ "Entries" in the performance timeline can be extended by browser vendors. This CL is to create a type to use for recording timing events when a frame is drawn to the screen. This will be used to let app developers calculate their effective frames per second and time-to-frame events. BUG=120796 R=nduca@google.com ** For related Blink changes, see https://codereview.chromium.org/390193003/

Patch Set 1 #

Patch Set 2 : Additional virtual methods needing to be overridden #

Patch Set 3 : git #

Patch Set 4 : git pull of third_party/WebKit #

Total comments: 44

Patch Set 5 : Addressed some (most) of Enne's review comments #

Patch Set 6 : Scale contents to match Layer coordinate space #

Patch Set 7 : Add support for 'commit' as well as 'draw' records #

Patch Set 8 : Rename api to Smoothness Timing #

Patch Set 9 : Git pull syncup #

Patch Set 10 : Use damage rect not viewport rect #

Unified diffs Side-by-side diffs Delta from patch set Stats (+384 lines, -1 line) Patch
M cc/blink/web_layer_impl.h View 1 2 3 4 5 6 7 2 chunks +5 lines, -0 lines 0 comments Download
M cc/blink/web_layer_impl.cc View 1 2 3 4 5 6 7 2 chunks +24 lines, -0 lines 0 comments Download
M cc/cc.gyp View 1 2 3 4 5 6 7 8 9 1 chunk +2 lines, -0 lines 0 comments Download
A cc/debug/smoothness_timing_tracker.h View 1 2 3 4 5 6 7 1 chunk +74 lines, -0 lines 0 comments Download
A cc/debug/smoothness_timing_tracker.cc View 1 2 3 4 5 6 7 1 chunk +57 lines, -0 lines 0 comments Download
M cc/layers/layer.h View 1 2 3 4 5 6 7 4 chunks +9 lines, -0 lines 0 comments Download
M cc/layers/layer.cc View 1 2 3 4 5 6 7 2 chunks +10 lines, -0 lines 0 comments Download
M cc/layers/layer_impl.h View 1 2 3 4 5 6 7 8 9 4 chunks +11 lines, -0 lines 0 comments Download
M cc/layers/layer_impl.cc View 1 2 3 4 5 6 7 8 1 chunk +1 line, -0 lines 0 comments Download
M cc/test/fake_layer_tree_host_client.h View 1 2 3 4 5 6 7 8 2 chunks +7 lines, -0 lines 0 comments Download
M cc/test/layer_tree_test.h View 1 2 3 4 5 6 7 8 2 chunks +6 lines, -0 lines 0 comments Download
M cc/test/layer_tree_test.cc View 1 2 3 4 5 6 7 8 1 chunk +7 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host.h View 1 2 3 4 5 6 7 8 2 chunks +2 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host.cc View 1 2 3 4 5 6 7 8 4 chunks +22 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host_client.h View 1 2 3 4 5 6 7 8 2 chunks +9 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host_common.h View 1 2 3 4 5 6 7 8 3 chunks +19 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host_common.cc View 1 2 3 4 5 6 7 1 chunk +12 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host_impl.h View 1 2 3 4 5 6 7 8 4 chunks +8 lines, -0 lines 0 comments Download
M cc/trees/layer_tree_host_impl.cc View 1 2 3 4 5 6 7 8 9 6 chunks +42 lines, -1 line 0 comments Download
M cc/trees/layer_tree_host_unittest_no_message_loop.cc View 1 2 3 4 5 6 7 8 1 chunk +4 lines, -0 lines 0 comments Download
M cc/trees/thread_proxy.h View 1 2 3 4 5 6 7 2 chunks +3 lines, -0 lines 0 comments Download
M cc/trees/thread_proxy.cc View 1 2 3 4 5 6 7 8 3 chunks +10 lines, -0 lines 0 comments Download
M content/renderer/gpu/render_widget_compositor.h View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download
M content/renderer/gpu/render_widget_compositor.cc View 1 2 3 4 5 6 7 8 1 chunk +26 lines, -0 lines 0 comments Download
M tools/metrics/histograms/histograms.xml View 1 chunk +2 lines, -0 lines 0 comments Download
M ui/compositor/compositor.h View 1 2 3 4 5 6 7 8 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (1 generated)
enne (OOO)
I have a lot of small comments, but the general direction seems legit to me. ...
6 years, 5 months ago (2014-07-22 20:44:26 UTC) #1
Mike B
6 years, 5 months ago (2014-07-25 23:09:41 UTC) #2
Still working on moving routine from CalculateRenderPasses to AppendQuads, but
the other review comments should be addressed, thanks!

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
File cc/debug/performance_draw_timing_counter.cc (right):

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
cc/debug/performance_draw_timing_counter.cc:34: struct DrawEvent
drawEvent(it->first, it->second, timestamp);
On 2014/07/22 20:44:24, enne wrote:
> style nit: draw_event, no struct
> 
> bikeshed: Maybe call this DrawTimingEvent for consistency?

Done.

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
File cc/debug/performance_draw_timing_counter.h (right):

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
cc/debug/performance_draw_timing_counter.h:22: // intelligently compute average
frames per second.
It does not. That comment was copied over when I cribbed from
frame_rate_counter.h. I'll clean up those vestiges!

On 2014/07/22 20:44:25, enne wrote:
> Where does it compute average fps?

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
cc/debug/performance_draw_timing_counter.h:23: class
PerformanceDrawTimingCounter {
On 2014/07/22 20:44:25, enne wrote:
> bikeshedding: The word "performance" here is a little bit wordy.  You could
> probably just call this DrawTimingCounter to go with DrawTimingSet and
> DrawTimingInfo.

Done.

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
cc/debug/performance_draw_timing_counter.h:47: scoped_ptr<DrawTimingSet>
getDrawTimingCounts();
I think you're right and "get" is probably not appropriate. 
That would suggest it should be CalculateDrawTimingCounts though.


On 2014/07/22 20:44:25, enne wrote:
> style nit: get_draw_timing_counts
> 
> Also, "get" is a bit innocuous of a name for something that seems to do a
bunch
> of work.  Maybe "calculate" instead of "get"?
> 
> You could also skip the allocation and just make this void
> calculate_draw_timing_counts(DrawTimingSet* output)

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
cc/debug/performance_draw_timing_counter.h:49: void clearEvents() {
ring_buffer_.Clear(); }
On 2014/07/22 20:44:25, enne wrote:
> style nit: clear_events

Done.

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
cc/debug/performance_draw_timing_counter.h:54: void SaveTimeStamp(int frame_id,
int64_t rect_id, base::TimeTicks timestamp);
Nope. Removed.
On 2014/07/22 20:44:25, enne wrote:
> Is this function used?

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
cc/debug/performance_draw_timing_counter.h:57: const std::vector<std::pair<int,
int64_t> > &frame_ids);
git cl upload complained about a fair number of style issues, but didn't catch
this one.

On 2014/07/22 20:44:25, enne wrote:
> Did git cl upload complain at you about needing to run git cl format? It
should
> have fixed this.

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
cc/debug/performance_draw_timing_counter.h:59: typedef RingBuffer<struct
DrawEvent, 4096> RingBufferType;
New stuff fails to get appended and drops.
On 2014/07/22 20:44:25, enne wrote:
> What happens when this overflows?

https://codereview.chromium.org/397443002/diff/60001/cc/debug/performance_dra...
cc/debug/performance_draw_timing_counter.h:64: explicit
PerformanceDrawTimingCounter();
On 2014/07/22 20:44:25, enne wrote:
> style nit: explicit only on single-arg constructors

Done.

https://codereview.chromium.org/397443002/diff/60001/cc/layers/layer_impl.h
File cc/layers/layer_impl.h (right):

https://codereview.chromium.org/397443002/diff/60001/cc/layers/layer_impl.h#n...
cc/layers/layer_impl.h:86: typedef std::vector<std::pair<int64_t, gfx::Rect> >
DrawFrameRequestRectsType;
On 2014/07/22 20:44:25, enne wrote:
> This could maybe go in LayerTreeHostCommon too with the other DrawTiming types
> so you don't have to define it in both Layer and LayerImpl?
> 
> bikeshed: You could also maybe call it DrawTimingRequests to match other
> DrawTiming* classes?

Done.

https://codereview.chromium.org/397443002/diff/60001/cc/layers/paint_properti...
File cc/layers/paint_properties.h (right):

https://codereview.chromium.org/397443002/diff/60001/cc/layers/paint_properti...
cc/layers/paint_properties.h:25: std::vector<std::pair<int, int64_t> >
draw_frame_request_ids;
Yes, that was from an earlier iteration and snuck into this change set somehow.

On 2014/07/22 20:44:25, enne wrote:
> This looks unused.  I'm not sure you should be changing PaintProperties
anyway;
> these requests and rects should all live on layers.

https://codereview.chromium.org/397443002/diff/60001/cc/trees/layer_tree_host.cc
File cc/trees/layer_tree_host.cc (right):

https://codereview.chromium.org/397443002/diff/60001/cc/trees/layer_tree_host...
cc/trees/layer_tree_host.cc:1084:
client_->RecordDrawTiming(info.draws[i].rect_id, info.draws[i].timestamps);
Both.. but timestamp is the main thing being delivered to the caller. Ultimately
I wanted to be able to provide the source of the event back to JS. Although now
that I'm down into that part of the API it's possible that number is meaningless
to JS and I'll trim it back out. In the meantime it gets passed almost all of
the way through, but is dropped right towards the end of cc before it goes to
blink.

On 2014/07/22 20:44:25, enne wrote:
> Can you help me understand what the eventual API is supposed to be? In some
> places in the code you are using source frame number and others you're using
> timestamps.

https://codereview.chromium.org/397443002/diff/60001/cc/trees/layer_tree_host.h
File cc/trees/layer_tree_host.h (right):

https://codereview.chromium.org/397443002/diff/60001/cc/trees/layer_tree_host...
cc/trees/layer_tree_host.h:232: void ApplyScrollAndScale(ScrollAndScaleSet*
info);
Someone committed and then uncommitted a change here, it tricked me in the git
conflict resolution screen, it's already fixed in my local repository.
On 2014/07/22 20:44:26, enne wrote:
> ?

https://codereview.chromium.org/397443002/diff/60001/cc/trees/layer_tree_host...
File cc/trees/layer_tree_host_impl.cc (right):

https://codereview.chromium.org/397443002/diff/60001/cc/trees/layer_tree_host...
cc/trees/layer_tree_host_impl.cc:860: if (vec.size()) {
Hm, to do that I need to make it a function I can return from. Or I can
'continue' on the loop, but that might not be clear to future developers who try
and add code below mine in the loop.
Suggestions?
On 2014/07/22 20:44:26, enne wrote:
> style nit: early out here and continue rather than indenting the whole block
> below

https://codereview.chromium.org/397443002/diff/60001/cc/trees/layer_tree_host...
cc/trees/layer_tree_host_impl.cc:861: gfx::Rect viewport =
it->visible_content_rect();
On 2014/07/22 20:44:26, enne wrote:
> bikeshed: This isn't the viewport, it's the viewport projected into the
layer's
> content space.
Gotcha, I'm just creating that variable to print out the contents to stdout. It
won't exist in the actual patch.

https://codereview.chromium.org/397443002/diff/60001/cc/trees/layer_tree_host...
cc/trees/layer_tree_host_impl.cc:869: bool intersects =
it->visible_content_rect().Intersects(
On 2014/07/22 20:44:26, enne wrote:
> visible content rect is in content space (aka layer bounds scaled by
> contents_scale()), so you can't compare them directly.  You need to scale one
or
> the other, take the enclosing content rect to round up to integers, and then
> intersect.

Done.

https://codereview.chromium.org/397443002/diff/60001/cc/trees/layer_tree_host...
cc/trees/layer_tree_host_impl.cc:878:
std::make_pair(active_tree_->source_frame_number(), rect_id));
It gets 2 entries that have the same source frame but different timestamps.
That's ok.

The source frame number is not actually used, in the current implementation
though.

On 2014/07/22 20:44:26, enne wrote:
> How does performance timeline handle getting the same rect ids drawn on
> different compositor frames from the same source frame number?
> 
> Where does this frame number get used? It looks like the only thing that gets
> back up to Blink is an id -> [timestamps] mapping?

https://codereview.chromium.org/397443002/diff/60001/content/renderer/composi...
File content/renderer/compositor_bindings/web_layer_impl.cc (right):

https://codereview.chromium.org/397443002/diff/60001/content/renderer/composi...
content/renderer/compositor_bindings/web_layer_impl.cc:367: gfx::Rect
gfxRect(rects[i].second);
On 2014/07/22 20:44:26, enne wrote:
> style nit: This file should be in Chrome style, so gfxRect => gfx_rect. 
> Actually, you should probably just call it rect or skip the temporary.

Done.

https://codereview.chromium.org/397443002/diff/60001/content/renderer/gpu/ren...
File content/renderer/gpu/render_widget_compositor.cc (right):

https://codereview.chromium.org/397443002/diff/60001/content/renderer/gpu/ren...
content/renderer/gpu/render_widget_compositor.cc:778: const
std::vector<std::pair<int, base::TimeTicks> > &draws) {
On 2014/07/22 20:44:26, enne wrote:
> style nit: ">& draws" not "> &draws"
> 
> Can you git cl format your patch?

Done.

https://codereview.chromium.org/397443002/diff/60001/content/renderer/gpu/ren...
content/renderer/gpu/render_widget_compositor.cc:782:
//widget_->webwidget()->applyScrollAndScale(scroll_delta, page_scale);
On 2014/07/22 20:44:26, enne wrote:
> ?

Done.

https://codereview.chromium.org/397443002/diff/60001/tools/metrics/histograms...
File tools/metrics/histograms/histograms.xml (right):

https://codereview.chromium.org/397443002/diff/60001/tools/metrics/histograms...
tools/metrics/histograms/histograms.xml:39574: +  <int value="477"
label="LegacyFullScreenErrorExemption"/>
No, this happens when I git pull third_party/WebKit. Part of the process has me
regenerate this file.
On 2014/07/22 20:44:26, enne wrote:
> Is this accidentally included?

Powered by Google App Engine
This is Rietveld 408576698