Commit 0a8b7327 authored by mbelshe@chromium.org's avatar mbelshe@chromium.org

Fix some network counters to work on linux/mac.

These now match the behavior on windows.

BUG=none
TEST=none

Review URL: http://codereview.chromium.org/2881022

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52938 0039d316-1c4b-4281-b951-d872f2087c98
parent 8c03c0ab
......@@ -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 @@ int TCPClientSocketLibevent::Connect(CompletionCallback* callback) {
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 TCPClientSocketLibevent::Read(IOBuffer* buf,
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 TCPClientSocketLibevent::Write(IOBuffer* buf,
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment