1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // Collect metrics of SocketStream usage.
6 // TODO(ukai): collect WebSocket specific metrics (e.g. handshake time, etc).
8 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_
9 #define NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_
11 #include "base/basictypes.h"
12 #include "base/time/time.h"
13 #include "net/base/net_export.h"
19 class NET_EXPORT_PRIVATE SocketStreamMetrics
{
24 PROTOCOL_WEBSOCKET_SECURE
,
34 SECURE_PROXY_CONNECTION
,
38 enum WireProtocolType
{
39 WIRE_PROTOCOL_WEBSOCKET
,
41 NUM_WIRE_PROTOCOL_TYPES
,
44 explicit SocketStreamMetrics(const GURL
& url
);
45 ~SocketStreamMetrics();
47 void OnWaitConnection();
48 void OnStartConnection();
51 void OnWrite(int len
);
53 void OnCountConnectionType(ConnectionType type
);
54 void OnCountWireProtocolType(WireProtocolType type
);
57 base::TimeTicks wait_start_time_
;
58 base::TimeTicks connect_start_time_
;
59 base::TimeTicks connect_establish_time_
;
65 DISALLOW_COPY_AND_ASSIGN(SocketStreamMetrics
);
70 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_