diff options
-rw-r--r-- | content/browser/geolocation/network_location_request.cc | 13 | ||||
-rw-r--r-- | content/browser/geolocation/network_location_request.h | 3 |
2 files changed, 16 insertions, 0 deletions
diff --git a/content/browser/geolocation/network_location_request.cc b/content/browser/geolocation/network_location_request.cc index 75868d8..ab53aa5 100644 --- a/content/browser/geolocation/network_location_request.cc +++ b/content/browser/geolocation/network_location_request.cc @@ -9,6 +9,7 @@ #include "base/json/json_reader.h" #include "base/json/json_writer.h" +#include "base/metrics/histogram.h" #include "base/string_number_conversions.h" #include "base/utf_string_conversions.h" #include "base/values.h" @@ -100,6 +101,7 @@ bool NetworkLocationRequest::MakeRequest(const string16& access_token, net::LOAD_DO_NOT_SAVE_COOKIES | net::LOAD_DO_NOT_SEND_COOKIES | net::LOAD_DO_NOT_SEND_AUTH_DATA); + start_time_ = base::TimeTicks::Now(); url_fetcher_->Start(); return true; } @@ -126,6 +128,17 @@ void NetworkLocationRequest::OnURLFetchComplete( !status.is_success() || (response_code >= 500 && response_code < 600); url_fetcher_.reset(); + if (!server_error) { + const base::TimeDelta request_time = base::TimeTicks::Now() - start_time_; + + UMA_HISTOGRAM_CUSTOM_TIMES( + "Net.Wifi.LbsLatency", + request_time, + base::TimeDelta::FromMilliseconds(1), + base::TimeDelta::FromSeconds(10), + 100); + } + DCHECK(listener_); DVLOG(1) << "NetworkLocationRequest::Run() : Calling listener with position."; listener_->LocationResponseAvailable(position, server_error, access_token, diff --git a/content/browser/geolocation/network_location_request.h b/content/browser/geolocation/network_location_request.h index 49ac96c..4fc564a 100644 --- a/content/browser/geolocation/network_location_request.h +++ b/content/browser/geolocation/network_location_request.h @@ -71,6 +71,9 @@ class NetworkLocationRequest : private net::URLFetcherDelegate { WifiData wifi_data_; base::Time timestamp_; // Timestamp of the above data, not of the request. + // The start time for the request. + base::TimeTicks start_time_; + DISALLOW_COPY_AND_ASSIGN(NetworkLocationRequest); }; |