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

Unified Diff: chrome/browser/net/network_stats.h

Issue 10206035: NetConnectivity - Collect stats for TCP/UDP network (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 8 months 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 | chrome/browser/net/network_stats.cc » ('j') | chrome/browser/net/network_stats.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/net/network_stats.h
===================================================================
--- chrome/browser/net/network_stats.h (revision 135283)
+++ chrome/browser/net/network_stats.h (working copy)
@@ -21,6 +21,7 @@
#include "net/base/io_buffer.h"
#include "net/base/ip_endpoint.h"
#include "net/base/test_data_stream.h"
+#include "net/proxy/proxy_info.h"
#include "net/socket/socket.h"
namespace chrome_browser_net {
@@ -101,6 +102,7 @@
bool Start(net::HostResolver* host_resolver,
const net::HostPortPair& server,
HistogramPortSelector histogram_port,
+ bool has_proxy_server,
uint32 bytes_to_send,
uint32 packets_to_send,
const net::CompletionCallback& callback);
@@ -109,6 +111,7 @@
// Constructs an NetworkStats object that collects metrics for network
// connectivity (either TCP or UDP).
NetworkStats();
+ // NetworkStats is deleted when Finish() is called.
virtual ~NetworkStats();
// Initializes |finished_callback_| and the number of bytes to send to the
@@ -116,6 +119,7 @@
// |finished_callback| is mainly useful for unittests.
void Initialize(uint32 bytes_to_send,
HistogramPortSelector histogram_port,
+ bool has_proxy_server,
uint32 packets_to_send,
const net::CompletionCallback& finished_callback);
@@ -271,6 +275,9 @@
// connectivity.
HistogramPortSelector histogram_port_;
+ // |has_proxy_server_| specifies if there is a proxy server or not.
+ bool has_proxy_server_;
+
// HostResolver fills out the |addresses_| after host resolution is completed.
net::AddressList addresses_;
@@ -298,6 +305,7 @@
// Constructs an UDPStatsClient object that collects metrics for UDP
// connectivity.
UDPStatsClient();
+ // UDPStatsClient is deleted when Finish() is called.
virtual ~UDPStatsClient();
protected:
@@ -315,7 +323,8 @@
virtual bool ReadComplete(int result) OVERRIDE;
// Collects stats for UDP connectivity. This is called when all the data from
- // server is read or when there is a failure during connect/read/write.
+ // server is read or when there is a failure during connect/read/write. This
+ // object is deleted at the end of this method.
virtual void Finish(Status status, int result) OVERRIDE;
};
@@ -324,6 +333,7 @@
// Constructs a TCPStatsClient object that collects metrics for TCP
// connectivity.
TCPStatsClient();
+ // TCPStatsClient is deleted when Finish() is called.
virtual ~TCPStatsClient();
protected:
@@ -339,7 +349,8 @@
virtual bool ReadComplete(int result) OVERRIDE;
// Collects stats for TCP connectivity. This is called when all the data from
- // server is read or when there is a failure during connect/read/write.
+ // server is read or when there is a failure during connect/read/write. This
+ // object is deleted at the end of this method.
virtual void Finish(Status status, int result) OVERRIDE;
private:
@@ -348,6 +359,40 @@
void OnConnectComplete(int result);
};
+class ProxyDetector {
+ public:
+ // Constructs a ProxyDetector object that resolves if access to
+ // network_stats_server goes through a proxy server or not.
+ ProxyDetector(const std::string& network_stats_server,
+ NetworkStats::HistogramPortSelector histogram_port,
eroman 2012/05/04 23:08:48 nit: align
ramant (doing other things) 2012/05/07 23:35:47 Done.
+ IOThread* io_thread);
+ virtual ~ProxyDetector();
eroman 2012/05/04 23:08:48 nit: why virtual?
ramant (doing other things) 2012/05/07 23:35:47 Done.
+
+ // This method uses system ProxyService to resolve the proxy for the given
+ // |network_stats_server| and |histogram_port|.
+ void ResolveProxy();
+
+ // Collects the network connectivity stats for UDP and TCP protocols.
+ void OnResolveProxyComplete(int result);
eroman 2012/05/04 23:08:48 This can be private, since it is only an implement
ramant (doing other things) 2012/05/07 23:35:47 Done.
+
+ private:
+ // |network_stats_server_| specifies the TCP/UDP echo server name.
+ std::string network_stats_server_;
+
+ // |histogram_port_| specifies the port for which we are testing the network
+ // connectivity.
+ NetworkStats::HistogramPortSelector histogram_port_;
+
+ // |proxy_info_| holds proxy information returned by ResolveProxy.
+ net::ProxyInfo proxy_info_;
+
+ // The IOThread for accessing global HostResolver to resolve
+ // network_stats_server_ host and for accessing global system ProxyService.
+ // |io_thread_| is accessed on IO thread and it is safe to access it on IO
+ // thread.
+ IOThread* io_thread_;
+};
+
// This collects the network connectivity stats for UDP and TCP for small
// percentage of users who are participating in the experiment. All users must
// have enabled "UMA upload". This method gets called only if UMA upload to the
@@ -355,6 +400,15 @@
void CollectNetworkStats(const std::string& network_stats_server_url,
IOThread* io_thread);
+// This starts a test randomly selected among "TCP test with small packet size",
+// "TCP test with large packet size", "UDP test with small packet size", "UDP
+// test with large packet size" and "UDP multi packet loss" tests to collect the
+// network connectivity stats.
+void StartNetworkStatsTest(const std::string& network_stats_server,
+ NetworkStats::HistogramPortSelector histogram_port,
+ bool has_proxy_server,
+ IOThread* io_thread);
+
} // namespace chrome_browser_net
#endif // CHROME_BROWSER_NET_NETWORK_STATS_H_
« no previous file with comments | « no previous file | chrome/browser/net/network_stats.cc » ('j') | chrome/browser/net/network_stats.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698