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

Unified Diff: net/websockets/websocket_basic_stream.cc

Issue 2762563003: Track data use of WebSockets (Closed)
Patch Set: Addressed tyoshino@ comments Created 3 years, 9 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 | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_basic_stream.cc
diff --git a/net/websockets/websocket_basic_stream.cc b/net/websockets/websocket_basic_stream.cc
index e13e1eb7a9724370a9cd803abb536e84d93ff3f8..3e8c7618ce67b5dcf5a53d11990dc50edf1e0ab9 100644
--- a/net/websockets/websocket_basic_stream.cc
+++ b/net/websockets/websocket_basic_stream.cc
@@ -14,6 +14,7 @@
#include "base/bind.h"
#include "base/logging.h"
+#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "net/base/io_buffer.h"
#include "net/base/net_errors.h"
@@ -211,6 +212,7 @@ int WebSocketBasicStream::WriteEverything(
buffer,
callback));
if (result > 0) {
+ UMA_HISTOGRAM_COUNTS_100000("Net.WebSocket.DataUse.Upstream", result);
buffer->DidConsume(result);
} else {
return result;
@@ -230,6 +232,8 @@ void WebSocketBasicStream::OnWriteComplete(
}
DCHECK_NE(0, result);
+ UMA_HISTOGRAM_COUNTS_100000("Net.WebSocket.DataUse.Upstream", result);
+
buffer->DidConsume(result);
result = WriteEverything(buffer, callback);
if (result != ERR_IO_PENDING)
@@ -245,6 +249,9 @@ int WebSocketBasicStream::HandleReadResult(
return result;
if (result == 0)
return ERR_CONNECTION_CLOSED;
+
+ UMA_HISTOGRAM_COUNTS_100000("Net.WebSocket.DataUse.Downstream", result);
+
std::vector<std::unique_ptr<WebSocketFrameChunk>> frame_chunks;
if (!parser_.Decode(read_buffer_->data(), result, &frame_chunks))
return WebSocketErrorToNetError(parser_.websocket_error());
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698