New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 788744 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Aug 15
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Measure CPU on non-main threads in the renderer processes managed by the scheduler

Project Member Reported by altimin@chromium.org, Nov 27 2017

Issue description

We have extensive metric coverage and understanding of types of work being run on the renderer main thread. Our understanding of work being done on other renderer threads, on the other hand, is very limited.

As a first step, we need to add a metric to compare total CPU usage of the main thread tasks with CPU usage coming from non-main thread tasks.

The main entrypoint for main thread metrics is RendererSchedulerImpl::OnTaskCompleted (and RendererMetricsHelper::RecordTaskMetrics which is being called from the abovementioned function). The RendererSchedulerImpl::OnTaskCompleted is plumbed through MainThreadTaskQueue::OnTaskCompleted, which is called via a callback (task_queue_impl->SetOnTaskCompletedHandler in the constructor of MainThreadTaskQueue).

It is proposed to add similar infrastructure for WorkerTaskQueue and WorkerScheduler and record RendererScheduler.TaskDurationPerThreadType with kMainThread, kWorkerThread and kCompositorThread as thread types. kMainThread-related part can be recorded on the main thread, similar to existing metrics like RendererScheduler.TaskDurationPerQueueType. kWorkerThread and kCompositor thread should be recorded in the newly introduced WorkerScheduler::RecordTaskMetrics. A virtual method may be needed to distinguish WorkerScheduler and CompositorWorkerScheduler.

P.S. For this new metrics, a separated task_duration_reporter per thread will be needed.

 

Comment 1 by l...@chromium.org, Nov 27 2017

Status: Started (was: Assigned)
Project Member

Comment 2 by bugdroid1@chromium.org, Nov 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/1acd2bd8770e7fecf22b097a698d67a290176cb9

commit 1acd2bd8770e7fecf22b097a698d67a290176cb9
Author: Peiyong Lin <lpy@chromium.org>
Date: Thu Nov 30 01:17:14 2017

[scheduler] Add per-thread task duration UMA.

Previously, we have extensive metric coverage and understanding of types of
work being run on the renderer main thread. Our understanding of work being
done on other renderer threads, however, is very limited. This patch:

1. Moved TaskDurationMetricReporter to util/ so that it can be shared by
child/;
2. Added OnTaskCompleted API in WorkerScheduler and implemented it in
WorkerSchedulerImpl and CompositorScheduler;
3. Report per-thread task duration for main thread, worker thread and
compositor thread.

BUG= 788744 

Change-Id: Ida597ccb90ff42129fd786f95f0d9810a5d5b745
Reviewed-on: https://chromium-review.googlesource.com/795014
Reviewed-by: Steven Holte <holte@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Commit-Queue: lpy <lpy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520368}
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/BUILD.gn
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.h
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/idle_helper_unittest.cc
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper_unittest.cc
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler.h
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_helper.cc
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_helper.h
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl.cc
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl.h
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/worker_task_queue.cc
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/child/worker_task_queue.h
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/renderer/auto_advancing_virtual_time_domain_unittest.cc
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper.cc
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper.h
[rename] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/util/task_duration_metric_reporter.h
[rename] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/util/task_duration_metric_reporter_unittest.cc
[add] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/third_party/WebKit/Source/platform/scheduler/util/thread_type.h
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/tools/metrics/histograms/enums.xml
[modify] https://crrev.com/1acd2bd8770e7fecf22b097a698d67a290176cb9/tools/metrics/histograms/histograms.xml

Project Member

Comment 3 by bugdroid1@chromium.org, Nov 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/8d91a6914d544cebd29543007ed64349e78e7c3c

commit 8d91a6914d544cebd29543007ed64349e78e7c3c
Author: lpy <lpy@chromium.org>
Date: Thu Nov 30 01:42:39 2017

Revert "[scheduler] Add per-thread task duration UMA."

This reverts commit 1acd2bd8770e7fecf22b097a698d67a290176cb9.

Reason for revert: Break Win X64 Builder

Original change's description:
> [scheduler] Add per-thread task duration UMA.
> 
> Previously, we have extensive metric coverage and understanding of types of
> work being run on the renderer main thread. Our understanding of work being
> done on other renderer threads, however, is very limited. This patch:
> 
> 1. Moved TaskDurationMetricReporter to util/ so that it can be shared by
> child/;
> 2. Added OnTaskCompleted API in WorkerScheduler and implemented it in
> WorkerSchedulerImpl and CompositorScheduler;
> 3. Report per-thread task duration for main thread, worker thread and
> compositor thread.
> 
> BUG= 788744 
> 
> Change-Id: Ida597ccb90ff42129fd786f95f0d9810a5d5b745
> Reviewed-on: https://chromium-review.googlesource.com/795014
> Reviewed-by: Steven Holte <holte@chromium.org>
> Reviewed-by: Alexander Timin <altimin@chromium.org>
> Commit-Queue: lpy <lpy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#520368}

TBR=holte@chromium.org,altimin@chromium.org,lpy@chromium.org

Change-Id: I3b9752177d9d8b20761ca56679c8a304ffa1dbcf
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug:  788744 
Reviewed-on: https://chromium-review.googlesource.com/798850
Reviewed-by: lpy <lpy@chromium.org>
Commit-Queue: lpy <lpy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520380}
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/BUILD.gn
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.h
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/idle_helper_unittest.cc
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper_unittest.cc
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler.h
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_helper.cc
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_helper.h
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl.cc
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl.h
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/worker_task_queue.cc
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/child/worker_task_queue.h
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/renderer/auto_advancing_virtual_time_domain_unittest.cc
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper.cc
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper.h
[rename] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/renderer/task_duration_metric_reporter.h
[rename] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/third_party/WebKit/Source/platform/scheduler/renderer/task_duration_metric_reporter_unittest.cc
[delete] https://crrev.com/ebe332f7f4c2890efbbea30d8c88d2df0177a06a/third_party/WebKit/Source/platform/scheduler/util/thread_type.h
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/tools/metrics/histograms/enums.xml
[modify] https://crrev.com/8d91a6914d544cebd29543007ed64349e78e7c3c/tools/metrics/histograms/histograms.xml

Project Member

Comment 4 by bugdroid1@chromium.org, Nov 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/01faae55d5cc2581cb95ea5a8f48c63bc67961e2

commit 01faae55d5cc2581cb95ea5a8f48c63bc67961e2
Author: Peiyong Lin <lpy@chromium.org>
Date: Thu Nov 30 19:08:29 2017

Reland "[scheduler] Add per-thread task duration UMA."

This is a reland of 1acd2bd8770e7fecf22b097a698d67a290176cb9
Revert reason: Break Win x64 Builder (dbg)
Original change's description:
> [scheduler] Add per-thread task duration UMA.
>
> Previously, we have extensive metric coverage and understanding of types of
> work being run on the renderer main thread. Our understanding of work being
> done on other renderer threads, however, is very limited. This patch:
>
> 1. Moved TaskDurationMetricReporter to util/ so that it can be shared by
> child/;
> 2. Added OnTaskCompleted API in WorkerScheduler and implemented it in
> WorkerSchedulerImpl and CompositorScheduler;
> 3. Report per-thread task duration for main thread, worker thread and
> compositor thread.
>
> BUG= 788744 
>
> Change-Id: Ida597ccb90ff42129fd786f95f0d9810a5d5b745
> Reviewed-on: https://chromium-review.googlesource.com/795014
> Reviewed-by: Steven Holte <holte@chromium.org>
> Reviewed-by: Alexander Timin <altimin@chromium.org>
> Commit-Queue: lpy <lpy@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#520368}

TBR=holte@chromium.org

Bug:  788744 
Change-Id: Iecdcd17dd9bc5e934be73f38f6bfc9574e250f3f
Reviewed-on: https://chromium-review.googlesource.com/798851
Commit-Queue: lpy <lpy@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520630}
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/BUILD.gn
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.cc
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/compositor_worker_scheduler.h
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/idle_helper_unittest.cc
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/scheduler_helper_unittest.cc
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/webthread_base.cc
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler.h
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_helper.cc
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_helper.h
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl.cc
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/worker_scheduler_impl.h
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/worker_task_queue.cc
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/child/worker_task_queue.h
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/renderer/auto_advancing_virtual_time_domain_unittest.cc
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper.cc
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/renderer/renderer_metrics_helper.h
[rename] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/util/task_duration_metric_reporter.h
[rename] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/util/task_duration_metric_reporter_unittest.cc
[add] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/third_party/WebKit/Source/platform/scheduler/util/thread_type.h
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/tools/metrics/histograms/enums.xml
[modify] https://crrev.com/01faae55d5cc2581cb95ea5a8f48c63bc67961e2/tools/metrics/histograms/histograms.xml

Project Member

Comment 5 by bugdroid1@chromium.org, Nov 30 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/da26b6aa6380e26bd63af0972b56741c0b71e120

commit da26b6aa6380e26bd63af0972b56741c0b71e120
Author: Peiyong Lin <lpy@chromium.org>
Date: Thu Nov 30 21:55:41 2017

[SessionRestore] Ignore WebContents that are not managed by TabLoader.

PageSignalReceiver dispatches page signals to every PageSignalObserver with
WebContents, thus, TabLoader will be notified with WebContents that is not
managed by TabLoader, causing crash when TabLoader tries to remove it from
notification registrar. This patch adds check inside OnPageAlmostIdle to ignore
WebContents that is not managed by TabLoader, as well as a unit test.

BUG= 788744 

Change-Id: If19d3b3ee9d73b932644c0574dc3b381eba3f232
Reviewed-on: https://chromium-review.googlesource.com/801655
Commit-Queue: lpy <lpy@chromium.org>
Reviewed-by: Scott Violet <sky@chromium.org>
Reviewed-by: Zhen Wang <zhenw@chromium.org>
Cr-Commit-Position: refs/heads/master@{#520706}
[modify] https://crrev.com/da26b6aa6380e26bd63af0972b56741c0b71e120/chrome/browser/sessions/tab_loader.cc
[modify] https://crrev.com/da26b6aa6380e26bd63af0972b56741c0b71e120/chrome/browser/sessions/tab_loader_unittest.cc

Comment 6 by l...@chromium.org, Nov 30 2017

For whoever is looking at the patch landed in Comment 5, that patch is for crbug.com/789084

Comment 7 by l...@chromium.org, Dec 19 2017

Cc: -altimin@chromium.org l...@chromium.org
Owner: altimin@chromium.org
Status: Assigned (was: Started)
reassign to altimin@
Status: Fixed (was: Assigned)
This is done, results are in RendererScheduler.TaskDurationPerThreadType histogram.

Sign in to add a comment