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

Unified Diff: sync/internal_api/attachments/attachment_downloader_impl.cc

Issue 796953002: Add Sync.Attachments.DownloadTotalTime. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Store TimeTicks::Now() instead of an ElapsedTimer. Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/attachments/attachment_downloader_impl.cc
diff --git a/sync/internal_api/attachments/attachment_downloader_impl.cc b/sync/internal_api/attachments/attachment_downloader_impl.cc
index 33ac885a8f200be3647a38d1f63a7c24555f200d..56a2c346d7cdb2492afb92fbeec23ef834285a77 100644
--- a/sync/internal_api/attachments/attachment_downloader_impl.cc
+++ b/sync/internal_api/attachments/attachment_downloader_impl.cc
@@ -8,8 +8,10 @@
#include "base/bind.h"
#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
+#include "base/metrics/histogram_macros.h"
#include "base/metrics/sparse_histogram.h"
#include "base/sys_byteorder.h"
+#include "base/time/time.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
#include "net/http/http_status_code.h"
@@ -35,6 +37,7 @@ struct AttachmentDownloaderImpl::DownloadState {
std::string access_token;
scoped_ptr<net::URLFetcher> url_fetcher;
std::vector<DownloadCallback> user_callbacks;
+ base::TimeTicks start_time;
};
AttachmentDownloaderImpl::DownloadState::DownloadState(
@@ -109,6 +112,7 @@ void AttachmentDownloaderImpl::OnGetTokenSuccess(
download_state->access_token = access_token;
download_state->url_fetcher =
CreateFetcher(download_state->attachment_url, access_token).Pass();
+ download_state->start_time = base::TimeTicks::Now();
download_state->url_fetcher->Start();
}
requests_waiting_for_access_token_.clear();
@@ -159,6 +163,9 @@ void AttachmentDownloaderImpl::OnURLFetchComplete(
source->GetResponseAsString(&data_as_string);
attachment_data = base::RefCountedString::TakeString(&data_as_string);
+ UMA_HISTOGRAM_LONG_TIMES("Sync.Attachments.DownloadTotalTime",
+ base::TimeTicks::Now() - download_state.start_time);
+
attachment_crc32c = ComputeCrc32c(attachment_data);
uint32_t crc32c_from_headers = 0;
if (ExtractCrc32c(source->GetResponseHeaders(), &crc32c_from_headers) &&
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698