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

Side by Side Diff: cc/scheduler/scheduler.cc

Issue 2754943002: Reimplement vsync latency UMA to be based on BeginImplFrame rather than BeginMainFrame (Closed)
Patch Set: Changed UMA metric name, removed VsyncTo. Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "cc/scheduler/scheduler.h" 5 #include "cc/scheduler/scheduler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 TRACE_EVENT_SCOPE_THREAD); 402 TRACE_EVENT_SCOPE_THREAD);
403 state_machine_.SetSkipNextBeginMainFrameToReduceLatency(); 403 state_machine_.SetSkipNextBeginMainFrameToReduceLatency();
404 } else if (ShouldRecoverImplLatency(adjusted_args, 404 } else if (ShouldRecoverImplLatency(adjusted_args,
405 can_activate_before_deadline)) { 405 can_activate_before_deadline)) {
406 TRACE_EVENT_INSTANT0("cc", "SkipBeginImplFrameToReduceLatency", 406 TRACE_EVENT_INSTANT0("cc", "SkipBeginImplFrameToReduceLatency",
407 TRACE_EVENT_SCOPE_THREAD); 407 TRACE_EVENT_SCOPE_THREAD);
408 SendBeginFrameAck(begin_main_frame_args_, kBeginFrameSkipped); 408 SendBeginFrameAck(begin_main_frame_args_, kBeginFrameSkipped);
409 return; 409 return;
410 } 410 }
411 411
412 BeginImplFrame(adjusted_args); 412 BeginImplFrame(adjusted_args, now);
413 } 413 }
414 414
415 void Scheduler::BeginImplFrameSynchronous(const BeginFrameArgs& args) { 415 void Scheduler::BeginImplFrameSynchronous(const BeginFrameArgs& args) {
416 TRACE_EVENT1("cc,benchmark", "Scheduler::BeginImplFrame", "args", 416 TRACE_EVENT1("cc,benchmark", "Scheduler::BeginImplFrame", "args",
417 args.AsValue()); 417 args.AsValue());
418
419 // The main thread currently can't commit before we draw with the 418 // The main thread currently can't commit before we draw with the
420 // synchronous compositor, so never consider the BeginMainFrame fast. 419 // synchronous compositor, so never consider the BeginMainFrame fast.
421 state_machine_.SetCriticalBeginMainFrameToActivateIsFast(false); 420 state_machine_.SetCriticalBeginMainFrameToActivateIsFast(false);
422 begin_main_frame_args_ = args; 421 begin_main_frame_args_ = args;
423 begin_main_frame_args_.on_critical_path = !ImplLatencyTakesPriority(); 422 begin_main_frame_args_.on_critical_path = !ImplLatencyTakesPriority();
424 423
425 BeginImplFrame(args); 424 BeginImplFrame(args, Now());
426 compositor_timing_history_->WillFinishImplFrame( 425 compositor_timing_history_->WillFinishImplFrame(
427 state_machine_.needs_redraw()); 426 state_machine_.needs_redraw());
428 FinishImplFrame(); 427 FinishImplFrame();
429 } 428 }
430 429
431 void Scheduler::FinishImplFrame() { 430 void Scheduler::FinishImplFrame() {
432 state_machine_.OnBeginImplFrameIdle(); 431 state_machine_.OnBeginImplFrameIdle();
433 ProcessScheduledActions(); 432 ProcessScheduledActions();
434 433
435 client_->DidFinishImplFrame(); 434 client_->DidFinishImplFrame();
(...skipping 20 matching lines...) Expand all
456 } 455 }
457 456
458 BeginFrameAck ack(args.source_id, args.sequence_number, 457 BeginFrameAck ack(args.source_id, args.sequence_number,
459 latest_confirmed_sequence_number, 0, did_submit); 458 latest_confirmed_sequence_number, 0, did_submit);
460 begin_frame_source_->DidFinishFrame(this, ack); 459 begin_frame_source_->DidFinishFrame(this, ack);
461 } 460 }
462 461
463 // BeginImplFrame starts a compositor frame that will wait up until a deadline 462 // BeginImplFrame starts a compositor frame that will wait up until a deadline
464 // for a BeginMainFrame+activation to complete before it times out and draws 463 // for a BeginMainFrame+activation to complete before it times out and draws
465 // any asynchronous animation and scroll/pinch updates. 464 // any asynchronous animation and scroll/pinch updates.
466 void Scheduler::BeginImplFrame(const BeginFrameArgs& args) { 465 void Scheduler::BeginImplFrame(const BeginFrameArgs& args,
466 base::TimeTicks now) {
467 DCHECK_EQ(state_machine_.begin_impl_frame_state(), 467 DCHECK_EQ(state_machine_.begin_impl_frame_state(),
468 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE); 468 SchedulerStateMachine::BEGIN_IMPL_FRAME_STATE_IDLE);
469 DCHECK(begin_impl_frame_deadline_task_.IsCancelled()); 469 DCHECK(begin_impl_frame_deadline_task_.IsCancelled());
470 DCHECK(state_machine_.HasInitializedCompositorFrameSink()); 470 DCHECK(state_machine_.HasInitializedCompositorFrameSink());
471 471
472 begin_impl_frame_tracker_.Start(args); 472 begin_impl_frame_tracker_.Start(args);
473 state_machine_.OnBeginImplFrame(args.source_id, args.sequence_number); 473 state_machine_.OnBeginImplFrame(args.source_id, args.sequence_number);
474 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_); 474 devtools_instrumentation::DidBeginFrame(layer_tree_host_id_);
475 compositor_timing_history_->WillBeginImplFrame( 475 compositor_timing_history_->WillBeginImplFrame(
476 state_machine_.NewActiveTreeLikely()); 476 state_machine_.NewActiveTreeLikely(), args.frame_time, args.type, now);
477 client_->WillBeginImplFrame(begin_impl_frame_tracker_.Current()); 477 client_->WillBeginImplFrame(begin_impl_frame_tracker_.Current());
478 478
479 ProcessScheduledActions(); 479 ProcessScheduledActions();
480 } 480 }
481 481
482 void Scheduler::ScheduleBeginImplFrameDeadline() { 482 void Scheduler::ScheduleBeginImplFrameDeadline() {
483 // The synchronous compositor does not post a deadline task. 483 // The synchronous compositor does not post a deadline task.
484 DCHECK(!settings_.using_synchronous_renderer_compositor); 484 DCHECK(!settings_.using_synchronous_renderer_compositor);
485 485
486 begin_impl_frame_deadline_task_.Cancel(); 486 begin_impl_frame_deadline_task_.Cancel();
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"), 617 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("cc.debug.scheduler"),
618 "SchedulerStateMachine", "state", AsValue()); 618 "SchedulerStateMachine", "state", AsValue());
619 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action( 619 base::AutoReset<SchedulerStateMachine::Action> mark_inside_action(
620 &inside_action_, action); 620 &inside_action_, action);
621 switch (action) { 621 switch (action) {
622 case SchedulerStateMachine::ACTION_NONE: 622 case SchedulerStateMachine::ACTION_NONE:
623 break; 623 break;
624 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME: 624 case SchedulerStateMachine::ACTION_SEND_BEGIN_MAIN_FRAME:
625 compositor_timing_history_->WillBeginMainFrame( 625 compositor_timing_history_->WillBeginMainFrame(
626 begin_main_frame_args_.on_critical_path, 626 begin_main_frame_args_.on_critical_path,
627 begin_main_frame_args_.frame_time, 627 begin_main_frame_args_.frame_time);
628 begin_main_frame_args_.type);
629 state_machine_.WillSendBeginMainFrame(); 628 state_machine_.WillSendBeginMainFrame();
630 // TODO(brianderson): Pass begin_main_frame_args_ directly to client. 629 // TODO(brianderson): Pass begin_main_frame_args_ directly to client.
631 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_); 630 client_->ScheduledActionSendBeginMainFrame(begin_main_frame_args_);
632 break; 631 break;
633 case SchedulerStateMachine::ACTION_COMMIT: { 632 case SchedulerStateMachine::ACTION_COMMIT: {
634 bool commit_has_no_updates = false; 633 bool commit_has_no_updates = false;
635 state_machine_.WillCommit(commit_has_no_updates); 634 state_machine_.WillCommit(commit_has_no_updates);
636 client_->ScheduledActionCommit(); 635 client_->ScheduledActionCommit();
637 break; 636 break;
638 } 637 }
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 } 799 }
801 800
802 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const { 801 BeginFrameAck Scheduler::CurrentBeginFrameAckForActiveTree() const {
803 return BeginFrameAck( 802 return BeginFrameAck(
804 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number, 803 begin_main_frame_args_.source_id, begin_main_frame_args_.sequence_number,
805 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(), 804 state_machine_.last_begin_frame_sequence_number_active_tree_was_fresh(),
806 0, true); 805 0, true);
807 } 806 }
808 807
809 } // namespace cc 808 } // namespace cc
OLDNEW
« no previous file with comments | « cc/scheduler/scheduler.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698