Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef NET_BASE_LOAD_TIMING_INFO_H_ | 5 #ifndef NET_BASE_LOAD_TIMING_INFO_H_ |
| 6 #define NET_BASE_LOAD_TIMING_INFO_H_ | 6 #define NET_BASE_LOAD_TIMING_INFO_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "net/base/net_export.h" | 10 #include "net/base/net_export.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 // Structure containing timing information for a request. | 14 // Structure containing timing information for a request. |
| 15 // It addresses the needs of | 15 // It addresses the needs of |
| 16 // http://groups.google.com/group/http-archive-specification/web/har-1-1-spec, | 16 // http://groups.google.com/group/http-archive-specification/web/har-1-1-spec, |
| 17 // http://dev.w3.org/2006/webapi/WebTiming/, and | 17 // http://dev.w3.org/2006/webapi/WebTiming/, and |
| 18 // http://www.w3.org/TR/resource-timing/. | 18 // http://www.w3.org/TR/resource-timing/. |
| 19 // | 19 // |
| 20 // All events that do not apply to a request have null times. For non-HTTP | 20 // All events that do not apply to a request have null times. For non-HTTP |
| 21 // requests, all times other than the request_start times are null. | 21 // requests, all times other than the request_start times are null. |
| 22 // | 22 // |
| 23 // Requests with connection errors generally only have request start times as | 23 // Requests with connection errors generally only have request start times as |
| 24 // well, since they never received an established socket. | 24 // well, since they never received an established socket. |
| 25 // | 25 // |
| 26 // The general order for events is: | 26 // The general order for events is: |
| 27 // request_start | 27 // request_start |
| 28 // proxy_start | 28 // proxy_start |
| 29 // proxy_end | 29 // proxy_end |
| 30 // *dns_start | 30 // dns_start |
| 31 // *dns_end | 31 // dns_end |
| 32 // *connect_start | 32 // connect_start |
| 33 // *ssl_start | 33 // ssl_start |
| 34 // *ssl_end | 34 // ssl_end |
| 35 // *connect_end | 35 // connect_end |
| 36 // send_start | 36 // send_start |
| 37 // send_end | 37 // send_end |
| 38 // receive_headers_end | 38 // receive_headers_end |
| 39 // | 39 // |
| 40 // Those times without an asterisk are computed by the URLRequest, or by objects | 40 // Times represent the length of time that the request was blocked on an event, |
|
eroman
2013/04/06 01:02:02
This comment confused me on the first read (I thou
mmenke
2013/04/08 15:31:24
Updated it to say "times represent when a request
| |
| 41 // it directly creates and always owns. Those with an asterisk are computed | 41 // not the time they actually occurred. In particular, in the case of |
| 42 // by the connection attempt itself. Since the connection attempt may be | 42 // preconnects and socket reuse, no time is spent blocked on establishing a |
| 43 // started before a URLRequest, the starred times may occur before, during, or | 43 // connection. In the case of SPDY and HTTP pipelining, PAC scripts are only |
| 44 // after the request_start and proxy events. | 44 // run once for each shared session, so no time may be spent blocked on them. |
| 45 // | 45 // |
| 46 // DNS and SSL times are both times for the host, not the proxy, so DNS times | 46 // DNS and SSL times are both times for the host, not the proxy, so DNS times |
| 47 // when using proxies are null, and only requests to HTTPS hosts (Not proxies) | 47 // when using proxies are null, and only requests to HTTPS hosts (Not proxies) |
| 48 // have SSL times. One exception to this is when a proxy server itself returns | 48 // have SSL times. One exception to this is when a proxy server itself returns |
| 49 // a redirect response. In this case, the connect times treat the proxy as the | 49 // a redirect response. In this case, the connect times treat the proxy as the |
| 50 // host. The send and receive times will all be null, however. | 50 // host. The send and receive times will all be null, however. |
| 51 // See HttpNetworkTransaction::OnHttpsProxyTunnelResponse. | 51 // See HttpNetworkTransaction::OnHttpsProxyTunnelResponse. |
| 52 // TODO(mmenke): Is this worth fixing? | 52 // TODO(mmenke): Is this worth fixing? |
| 53 // | |
| 54 // Note that internal to the network stack, times are when events actually | |
| 55 // occurred. URLRequest converts them to time which the network stack was | |
| 56 // blocked on each state. | |
| 53 struct NET_EXPORT LoadTimingInfo { | 57 struct NET_EXPORT LoadTimingInfo { |
| 54 // Contains the LoadTimingInfo events related to establishing a connection. | 58 // Contains the LoadTimingInfo events related to establishing a connection. |
| 55 // These are all set by ConnectJobs. | 59 // These are all set by ConnectJobs. |
| 56 struct NET_EXPORT_PRIVATE ConnectTiming { | 60 struct NET_EXPORT_PRIVATE ConnectTiming { |
| 57 ConnectTiming(); | 61 ConnectTiming(); |
| 58 ~ConnectTiming(); | 62 ~ConnectTiming(); |
| 59 | 63 |
| 60 // The time spent looking up the host's DNS address. Null for requests that | 64 // The time spent looking up the host's DNS address. Null for requests that |
| 61 // used proxies to look up the DNS address. Also null for SOCKS4 proxies, | 65 // used proxies to look up the DNS address. Also null for SOCKS4 proxies, |
| 62 // since the DNS address is only looked up after the connection is | 66 // since the DNS address is only looked up after the connection is |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 128 base::TimeTicks send_start; | 132 base::TimeTicks send_start; |
| 129 base::TimeTicks send_end; | 133 base::TimeTicks send_end; |
| 130 | 134 |
| 131 // The time at which the end of the HTTP headers were received. | 135 // The time at which the end of the HTTP headers were received. |
| 132 base::TimeTicks receive_headers_end; | 136 base::TimeTicks receive_headers_end; |
| 133 }; | 137 }; |
| 134 | 138 |
| 135 } // namespace net | 139 } // namespace net |
| 136 | 140 |
| 137 #endif // NET_BASE_LOAD_TIMING_INFO_H_ | 141 #endif // NET_BASE_LOAD_TIMING_INFO_H_ |
| OLD | NEW |