Commit 7f6433d0 authored by mattm@chromium.org's avatar mattm@chromium.org

Add SBClientDownload.DownloadRequestNetworkDuration and DownloadRequestTimeoutDuration histograms.

BUG=378911

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275326 0039d316-1c4b-4281-b951-d872f2087c98
parent fd2b06f0
......@@ -355,6 +355,7 @@ class DownloadProtectionService::CheckClientDownloadRequest
// Request has already been cancelled.
return;
}
timeout_start_time_ = base::TimeTicks::Now();
BrowserThread::PostDelayedTask(
BrowserThread::UI,
FROM_HERE,
......@@ -450,6 +451,8 @@ class DownloadProtectionService::CheckClientDownloadRequest
fetcher_.reset();
UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestDuration",
base::TimeTicks::Now() - start_time_);
UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestNetworkDuration",
base::TimeTicks::Now() - request_start_time_);
FinishRequest(result, reason);
}
......@@ -733,6 +736,7 @@ class DownloadProtectionService::CheckClientDownloadRequest
fetcher_->SetRequestContext(service_->request_context_getter_.get());
fetcher_->SetUploadData("application/octet-stream",
client_download_request_data_);
request_start_time_ = base::TimeTicks::Now();
UMA_HISTOGRAM_COUNTS("SBClientDownload.DownloadRequestPayloadSize",
client_download_request_data_.size());
fetcher_->Start();
......@@ -757,6 +761,20 @@ class DownloadProtectionService::CheckClientDownloadRequest
// Ensure the timeout task is cancelled while we still have a non-zero
// refcount. (crbug.com/240449)
weakptr_factory_.InvalidateWeakPtrs();
if (!request_start_time_.is_null()) {
UMA_HISTOGRAM_ENUMERATION("SBClientDownload.DownloadRequestNetworkStats",
reason,
REASON_MAX);
}
if (!timeout_start_time_.is_null()) {
UMA_HISTOGRAM_ENUMERATION("SBClientDownload.DownloadRequestTimeoutStats",
reason,
REASON_MAX);
if (reason != REASON_REQUEST_CANCELED) {
UMA_HISTOGRAM_TIMES("SBClientDownload.DownloadRequestTimeoutDuration",
base::TimeTicks::Now() - timeout_start_time_);
}
}
if (service_) {
VLOG(2) << "SafeBrowsing download verdict for: "
<< item_->DebugString(true) << " verdict:" << reason;
......@@ -847,6 +865,8 @@ class DownloadProtectionService::CheckClientDownloadRequest
CancelableRequestConsumer request_consumer_; // For HistoryService lookup.
base::WeakPtrFactory<CheckClientDownloadRequest> weakptr_factory_;
base::TimeTicks start_time_; // Used for stats.
base::TimeTicks timeout_start_time_;
base::TimeTicks request_start_time_;
DISALLOW_COPY_AND_ASSIGN(CheckClientDownloadRequest);
};
......
......@@ -24020,8 +24020,11 @@ Therefore, the affected-histogram name has to have at least one dot in it.
<owner>mattm@chromium.org</owner>
<summary>
Records the total time it takes for the SafeBrowsing download service to
check whether the content of a download is malicious or not. This histogram
only includes requests that are sent to the SafeBrowsing server.
check whether the content of a download is malicious or not, including file
feature extraction, whitelist checking, and server ping. This histogram only
includes checks that sent a ping to the SafeBrowsing server. It does not
include requests that were cancelled, but does include requests that
received a bad response.
</summary>
</histogram>
......@@ -24032,6 +24035,24 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
<histogram name="SBClientDownload.DownloadRequestNetworkDuration"
units="milliseconds">
<owner>mattm@chromium.org</owner>
<summary>
Records the time it takes for the SafeBrowsing download service ping. It is
not recorded for requests that were cancelled.
</summary>
</histogram>
<histogram name="SBClientDownload.DownloadRequestNetworkStats"
enum="SBClientDownloadCheckDownloadStats">
<owner>mattm@chromium.org</owner>
<summary>
Records the results of SafeBrowsing binary download checks which caused a
server ping.
</summary>
</histogram>
<histogram name="SBClientDownload.DownloadRequestPayloadSize" units="bytes">
<owner>mattm@chromium.org</owner>
<summary>
......@@ -24047,6 +24068,27 @@ Therefore, the affected-histogram name has to have at least one dot in it.
</summary>
</histogram>
<histogram name="SBClientDownload.DownloadRequestTimeoutDuration"
units="milliseconds">
<owner>mattm@chromium.org</owner>
<summary>
Records the portion of the SafeBrowsing download service check starting with
the point CheckClientDownloadRequest::StartTimeout() is called. It is
recorded regardless if a ping was sent or not. It is not recorded for
requests that were cancelled.
</summary>
</histogram>
<histogram name="SBClientDownload.DownloadRequestTimeoutStats"
enum="SBClientDownloadCheckDownloadStats">
<owner>mattm@chromium.org</owner>
<summary>
For SafeBrowsing binary download checks which reached the
CheckClientDownloadRequest::StartTimeout() call, records the final result
(once the check finishes or is cancelled).
</summary>
</histogram>
<histogram name="SBClientDownload.ExtractImageHeadersTime" units="milliseconds">
<owner>grt@chromium.org</owner>
<summary>
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