OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 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. |
| 4 |
| 5 #ifndef NET_BASE_LOAD_TIMING_INFO_H_ |
| 6 #define NET_BASE_LOAD_TIMING_INFO_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "base/time.h" |
| 10 #include "net/base/net_export.h" |
| 11 |
| 12 namespace net { |
| 13 |
| 14 // All events that do not apply to a request have null times. For non-HTTP |
| 15 // requests, all times other than the request_start times are null. |
| 16 // |
| 17 // The general order for events is: |
| 18 // request_start |
| 19 // proxy_start |
| 20 // proxy_end |
| 21 // *dns_start |
| 22 // *dns_end |
| 23 // *connect_start |
| 24 // *ssl_start |
| 25 // *ssl_end |
| 26 // *connect_end |
| 27 // send_start |
| 28 // send_end |
| 29 // receive_headers_end |
| 30 // |
| 31 // Those times without an asterisk are computed by the URLRequest, or by objects |
| 32 // it directly creates and always owns. Those with an asterisk are computed |
| 33 // by the connection attempt itself. Since the connection attempt may be |
| 34 // started before a URLRequest, the starred times may occur before, during, or |
| 35 // after the request_start and proxy events. |
| 36 struct NET_EXPORT LoadTimingInfo { |
| 37 // Contains the LoadTimingInfo events related to establishing a connection. |
| 38 // These are all set by ConnectJobs. |
| 39 struct NET_EXPORT_PRIVATE ConnectTiming { |
| 40 ConnectTiming(); |
| 41 ~ConnectTiming(); |
| 42 |
| 43 // The time spent looking up the host's DNS address. Null for requests that |
| 44 // used proxies to look up the DNS address. Also null for SOCKS4 proxies, |
| 45 // since the DNS address is only looked up after the connection is |
| 46 // established, which results in unexpected event ordering. |
| 47 // TODO(mmenke): The SOCKS4 event ordering could be refactored to allow |
| 48 // these times to be non-null. |
| 49 base::TimeTicks dns_start; |
| 50 base::TimeTicks dns_end; |
| 51 |
| 52 // The time spent establishing the connection. Connect time includes proxy |
| 53 // connect times (Though not proxy_resolve times), DNS lookup times, time |
| 54 // spent waiting in certain queues, TCP, and SSL time. |
| 55 // TODO(mmenke): For proxies, this includes time spent blocking on higher |
| 56 // level socket pools. Fix this. |
| 57 // TODO(mmenke): Retried connections to the same server should apparently |
| 58 // be included in this time. Consider supporting that. |
| 59 // Since the network stack has multiple notions of a "retry", |
| 60 // handled at different levels, this may not be worth |
| 61 // worrying about - backup jobs, reused socket failure, |
| 62 // multiple round authentication. |
| 63 base::TimeTicks connect_start; |
| 64 base::TimeTicks connect_end; |
| 65 |
| 66 // The time when the SSL handshake started / completed. For non-HTTPS |
| 67 // requests these are null. These times are only for the SSL connection to |
| 68 // the final destination server, not an SSL/SPDY proxy. |
| 69 base::TimeTicks ssl_start; |
| 70 base::TimeTicks ssl_end; |
| 71 }; |
| 72 |
| 73 LoadTimingInfo(); |
| 74 ~LoadTimingInfo(); |
| 75 |
| 76 // True if the socket was reused. When true, DNS, connect, and SSL times |
| 77 // will all be null. When false, those times may be null, too, for non-HTTP |
| 78 // requests, or when they don't apply to a request. |
| 79 bool socket_reused; |
| 80 |
| 81 // Unique socket ID, can be used to identify requests served by the same |
| 82 // socket. |
| 83 // TODO(mmenke): Do something reasonable for SPDY proxies. |
| 84 uint32 socket_log_id; |
| 85 |
| 86 // Start time as a base::Time, so times can be coverted into actual times. |
| 87 // Other times are recorded as TimeTicks so they are not affected by clock |
| 88 // changes. |
| 89 base::Time request_start_time; |
| 90 |
| 91 base::TimeTicks request_start; |
| 92 |
| 93 // The time spent determing which proxy to use. Null when there is no PAC. |
| 94 base::TimeTicks proxy_resolve_start; |
| 95 base::TimeTicks proxy_resolve_end; |
| 96 |
| 97 ConnectTiming connect_timing; |
| 98 |
| 99 // The time that sending HTTP request started / ended. |
| 100 base::TimeTicks send_start; |
| 101 base::TimeTicks send_end; |
| 102 |
| 103 // The time at which the end of the HTTP headers were received. |
| 104 base::TimeTicks receive_headers_end; |
| 105 }; |
| 106 |
| 107 } // namespace net |
| 108 |
| 109 #endif // NET_BASE_LOAD_TIMING_INFO_H_ |
OLD | NEW |