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

Unified Diff: net/socket/tcp_client_socket_libevent.cc

Issue 2881022: Fix some network counters to work on linux/mac.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 10 years, 5 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_client_socket_libevent.cc
===================================================================
--- net/socket/tcp_client_socket_libevent.cc (revision 52678)
+++ net/socket/tcp_client_socket_libevent.cc (working copy)
@@ -16,6 +16,7 @@
#include "base/eintr_wrapper.h"
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/stats_counters.h"
#include "base/string_util.h"
#include "net/base/address_list_net_log_param.h"
#include "net/base/io_buffer.h"
@@ -125,6 +126,9 @@
if (socket_ != kInvalidSocket)
return OK;
+ static StatsCounter connects("tcp.connect");
+ connects.Increment();
+
DCHECK(!waiting_connect());
net_log_.BeginEvent(NetLog::TYPE_TCP_CONNECT,
@@ -309,6 +313,9 @@
int nread = HANDLE_EINTR(read(socket_, buf->data(), buf_len));
if (nread >= 0) {
+ static StatsCounter read_bytes("tcp.read_bytes");
+ read_bytes.Add(nread);
+
net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_RECEIVED,
new NetLogIntegerParameter("num_bytes", nread));
return nread;
@@ -344,6 +351,8 @@
int nwrite = HANDLE_EINTR(write(socket_, buf->data(), buf_len));
if (nwrite >= 0) {
+ static StatsCounter write_bytes("tcp.write_bytes");
+ write_bytes.Add(nwrite);
net_log_.AddEvent(NetLog::TYPE_SOCKET_BYTES_SENT,
new NetLogIntegerParameter("num_bytes", nwrite));
return nwrite;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698