summaryrefslogtreecommitdiffstats
path: root/chrome/browser/metrics
diff options
context:
space:
mode:
authorrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-09 05:11:41 +0000
committerrtenneti@chromium.org <rtenneti@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-06-09 05:11:41 +0000
commitd67d10528eb68753d19db1698b3688fa48fa44b3 (patch)
tree3797e452b5c689ff8da97dc9a73b775c610b07ea /chrome/browser/metrics
parent785db4fe43f9b4b3ce1231dec4d723e379ed992b (diff)
downloadchromium_src-d67d10528eb68753d19db1698b3688fa48fa44b3.zip
chromium_src-d67d10528eb68753d19db1698b3688fa48fa44b3.tar.gz
chromium_src-d67d10528eb68753d19db1698b3688fa48fa44b3.tar.bz2
Collect stats to investigate the viability of UDP
connectivity from the browser (first cut). Collect stats for TCP connectivity also. - What percentage of users can get a message end-to-end to an TCP and UDP server. - What is the latency for TCP and UDP messages. Added TCP and UDP echo servers to testserver.py for unittests. BUG=82565 TEST=udp tests Review URL: http://codereview.chromium.org/7056031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@88495 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/metrics')
-rw-r--r--chrome/browser/metrics/metrics_service.cc10
-rw-r--r--chrome/browser/metrics/metrics_service.h9
2 files changed, 19 insertions, 0 deletions
diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc
index 674f966..9243951 100644
--- a/chrome/browser/metrics/metrics_service.cc
+++ b/chrome/browser/metrics/metrics_service.cc
@@ -174,6 +174,7 @@
#include "chrome/browser/metrics/histogram_synchronizer.h"
#include "chrome/browser/metrics/metrics_log.h"
#include "chrome/browser/metrics/metrics_reporting_scheduler.h"
+#include "chrome/browser/net/network_stats.h"
#include "chrome/browser/prefs/pref_service.h"
#include "chrome/browser/prefs/scoped_user_pref_update.h"
#include "chrome/browser/profiles/profile.h"
@@ -438,6 +439,7 @@ MetricsService::MetricsService()
reporting_active_(false),
state_(INITIALIZED),
current_fetch_(NULL),
+ io_thread_(NULL),
idle_since_last_transmission_(false),
next_window_id_(0),
ALLOW_THIS_IN_INITIALIZER_LIST(log_sender_factory_(this)),
@@ -694,9 +696,12 @@ void MetricsService::RecordBreakpadHasDebugger(bool has_debugger) {
void MetricsService::InitializeMetricsState() {
#if defined(OS_POSIX)
server_url_ = L"https://clients4.google.com/firefox/metrics/collect";
+ // TODO(rtenneti): Return the network stats server name.
+ network_stats_server_ = "";
#else
BrowserDistribution* dist = BrowserDistribution::GetDistribution();
server_url_ = dist->GetStatsServerURL();
+ network_stats_server_ = dist->GetNetworkStatsServer();
#endif
PrefService* pref = g_browser_process->local_state();
@@ -792,6 +797,7 @@ void MetricsService::OnInitTaskComplete(
DCHECK(state_ == INIT_TASK_SCHEDULED);
hardware_class_ = hardware_class;
plugins_ = plugins;
+ io_thread_ = g_browser_process->io_thread();
if (state_ == INIT_TASK_SCHEDULED)
state_ = INIT_TASK_DONE;
}
@@ -1365,6 +1371,10 @@ void MetricsService::OnURLFetchComplete(const URLFetcher* source,
bool server_is_healthy = upload_succeeded || response_code == 400;
scheduler_->UploadFinished(server_is_healthy, unsent_logs());
+
+ // Collect network stats if UMA upload succeeded.
+ if (server_is_healthy && io_thread_)
+ chrome_browser_net::CollectNetworkStats(network_stats_server_, io_thread_);
}
void MetricsService::LogBadResponseCode() {
diff --git a/chrome/browser/metrics/metrics_service.h b/chrome/browser/metrics/metrics_service.h
index cb61682..5a031ed 100644
--- a/chrome/browser/metrics/metrics_service.h
+++ b/chrome/browser/metrics/metrics_service.h
@@ -16,6 +16,7 @@
#include "base/basictypes.h"
#include "base/gtest_prod_util.h"
#include "base/memory/scoped_ptr.h"
+#include "chrome/browser/io_thread.h"
#include "chrome/common/metrics_helpers.h"
#include "content/common/notification_observer.h"
#include "content/common/notification_registrar.h"
@@ -360,6 +361,14 @@ class MetricsService : public NotificationObserver,
// The URL for the metrics server.
std::wstring server_url_;
+ // The TCP/UDP echo server to collect network connectivity stats.
+ std::string network_stats_server_;
+
+ // The IOThread for accessing global HostResolver to resolve
+ // network_stats_server_ host. |io_thread_| is accessed on IO thread and it is
+ // safe to access it on IO thread.
+ IOThread* io_thread_;
+
// The identifier that's sent to the server with the log reports.
std::string client_id_;