blob: 67b1e33a01ede0f692c01691442c6e612c1621c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Collect metrics of SocketStream usage.
// TODO(ukai): collect WebSocket specific metrics (e.g. handshake time, etc).
#ifndef NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_
#define NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_
#include <string>
#include "base/basictypes.h"
#include "base/time.h"
class GURL;
namespace net {
class SocketStreamMetrics {
public:
explicit SocketStreamMetrics(const GURL& url);
~SocketStreamMetrics();
void OnWaitConnection();
void OnStartConnection();
void OnTunnelProxy();
void OnSOCKSProxy();
void OnSSLConnection();
void OnConnected();
void OnRead(int len);
void OnWrite(int len);
void OnClose();
private:
enum ProtocolType {
PROTOCOL_UNKNOWN,
PROTOCOL_WEBSOCKET,
PROTOCOL_WEBSOCKET_SECURE,
NUM_PROTOCOL_TYPES,
};
enum ConnectionType {
CONNECTION_NONE,
ALL_CONNECTIONS,
TUNNEL_CONNECTION,
SOCKS_CONNECTION,
SSL_CONNECTION,
NUM_CONNECTION_TYPES,
};
void CountProtocolType(ProtocolType protocol_type);
void CountConnectionType(ConnectionType connection_type);
base::TimeTicks wait_start_time_;
base::TimeTicks connect_start_time_;
base::TimeTicks connect_establish_time_;
int received_bytes_;
int received_counts_;
int sent_bytes_;
int sent_counts_;
DISALLOW_COPY_AND_ASSIGN(SocketStreamMetrics);
};
} // namespace net
#endif // NET_SOCKET_STREAM_SOCKET_STREAM_METRICS_H_
|