2 * Copyright (C) 1996-2016 The Squid Software Foundation and contributors
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
9 #ifndef SQUID_HTTPHIERARCHYLOGENTRY_H
10 #define SQUID_HTTPHIERARCHYLOGENTRY_H
12 #include "comm/Connection.h"
14 #include "hier_code.h"
15 #include "http/StatusCode.h"
20 class HierarchyLogEntry
25 ~HierarchyLogEntry() { tcpServer
= NULL
; };
27 /// Record details from a new server connection.
28 /// call this whenever the destination server changes.
29 void note(const Comm::ConnectionPointer
&server
, const char *requestedHost
);
31 /// Start recording total time spent communicating with peers
32 void startPeerClock();
34 * Record total time spent communicating with peers
35 * \param force whether to overwrite old recorded value if any
37 void stopPeerClock(const bool force
);
39 /// Return the total time spent communicating with peers
40 void totalResponseTime(struct timeval
&responseTime
);
44 char host
[SQUIDHOSTNAMELEN
];
46 char cd_host
[SQUIDHOSTNAMELEN
]; /* the host of selected by cd peer */
47 lookup_t cd_lookup
; /* cd prediction: none, miss, hit */
48 int n_choices
; /* #peers we selected from (cd only) */
49 int n_ichoices
; /* #peers with known rtt we selected from (cd only) */
51 struct timeval peer_select_start
;
53 struct timeval store_complete_stop
;
55 Http::StatusCode peer_reply_status
; ///< last HTTP status code received
56 timeval peer_http_request_sent
; ///< last peer finished writing req
57 struct timeval peer_response_time
; ///< last peer response delay
58 Comm::ConnectionPointer tcpServer
; ///< TCP/IP level details of the last peer/server connection
59 int64_t bodyBytesRead
; ///< number of body bytes received from the next hop or -1
62 timeval firstConnStart_
; ///< first connection use among all peers
63 struct timeval totalResponseTime_
; ///< cumulative for all peers
66 #endif /* SQUID_HTTPHIERARCHYLOGENTRY_H */