Commit 29494d86 authored by vadimt's avatar vadimt Committed by Commit bot

Instrumenting most popular callbacks of HttpNetworkTransaction to locate the source of jankiness.

Previous instrumentations showed that "DoCallback(rv);" call inside HttpNetworkTransaction::OnIOComplete
alone is responsible for 18.2 janks per hour in IO thread. I need to instrument
the code inside it to find out which part causes jank.

This is a mechanical change that adds instrumentation required to locate the
source of jankiness (i.e. a long-running fragment of code executed as a part of
the task that causes jank) in the code. See the bug for details on what kind of
jank we are after.
A number of similar CLs were landed, and none of them caused issues. They've
helped to find and fix janky code. The code of the instrumentation is highly
optimized and is not expected to affect performance. The code simply creates a
diagnostic task which is identical to ones created by PostTask or IPC message
handlers. The task gets created only in developer build and in Canary channel.

BUG=424359

Review URL: https://codereview.chromium.org/670993003

Cr-Commit-Position: refs/heads/master@{#302650}
parent b259c871
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "chrome/browser/devtools/devtools_network_transaction.h" #include "chrome/browser/devtools/devtools_network_transaction.h"
#include "base/profiler/scoped_tracker.h"
#include "chrome/browser/devtools/devtools_network_controller.h" #include "chrome/browser/devtools/devtools_network_controller.h"
#include "chrome/browser/devtools/devtools_network_interceptor.h" #include "chrome/browser/devtools/devtools_network_interceptor.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
...@@ -52,6 +53,11 @@ void DevToolsNetworkTransaction::Throttle(int result) { ...@@ -52,6 +53,11 @@ void DevToolsNetworkTransaction::Throttle(int result) {
} }
void DevToolsNetworkTransaction::OnCallback(int rv) { void DevToolsNetworkTransaction::OnCallback(int rv) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424359 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"424359 DevToolsNetworkTransaction::OnCallback"));
if (failed_) if (failed_)
return; return;
DCHECK(!callback_.is_null()); DCHECK(!callback_.is_null());
......
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include "base/message_loop/message_loop.h" #include "base/message_loop/message_loop.h"
#include "base/metrics/field_trial.h" #include "base/metrics/field_trial.h"
#include "base/metrics/histogram.h" #include "base/metrics/histogram.h"
#include "base/profiler/scoped_tracker.h"
#include "base/rand_util.h" #include "base/rand_util.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "base/time/time.h" #include "base/time/time.h"
...@@ -783,6 +784,11 @@ void URLRequestHttpJob::ProcessPublicKeyPinsHeader() { ...@@ -783,6 +784,11 @@ void URLRequestHttpJob::ProcessPublicKeyPinsHeader() {
} }
void URLRequestHttpJob::OnStartCompleted(int result) { void URLRequestHttpJob::OnStartCompleted(int result) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424359 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"424359 URLRequestHttpJob::OnStartCompleted"));
RecordTimer(); RecordTimer();
// If the request was destroyed, then there is no more work to do. // If the request was destroyed, then there is no more work to do.
...@@ -886,6 +892,11 @@ void URLRequestHttpJob::OnHeadersReceivedCallback(int result) { ...@@ -886,6 +892,11 @@ void URLRequestHttpJob::OnHeadersReceivedCallback(int result) {
} }
void URLRequestHttpJob::OnReadCompleted(int result) { void URLRequestHttpJob::OnReadCompleted(int result) {
// TODO(vadimt): Remove ScopedTracker below once crbug.com/424359 is fixed.
tracked_objects::ScopedTracker tracking_profile(
FROM_HERE_WITH_EXPLICIT_FUNCTION(
"424359 URLRequestHttpJob::OnReadCompleted"));
read_in_progress_ = false; read_in_progress_ = false;
if (ShouldFixMismatchedContentLength(result)) if (ShouldFixMismatchedContentLength(result))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment