]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/adaptation/icap/History.cc
2 #include "adaptation/icap/History.h"
6 Adaptation::Icap::History::History():
7 logType(LOG_TAG_NONE
), req_sz(0),
8 pastTime(0), concurrencyLevel(0)
12 void Adaptation::Icap::History::start(const char *context
)
14 if (!concurrencyLevel
++)
15 currentStart
= current_time
;
17 debugs(93,4, HERE
<< "start " << context
<< " level=" << concurrencyLevel
18 << " time=" << pastTime
<< ' ' << this);
21 void Adaptation::Icap::History::stop(const char *context
)
23 if (!concurrencyLevel
) {
24 debugs(93,1, HERE
<< "Internal error: poor history accounting " << this);
28 const int current
= currentTime();
29 debugs(93,4, HERE
<< "stop " << context
<< " level=" << concurrencyLevel
<<
30 " time=" << pastTime
<< '+' << current
<< ' ' << this);
32 if (!--concurrencyLevel
)
36 int Adaptation::Icap::History::processingTime() const
38 const int total
= pastTime
+ currentTime();
39 debugs(93,7, HERE
<< " current total: " << total
<< ' ' << this);
43 int Adaptation::Icap::History::currentTime() const
45 return concurrencyLevel
> 0 ?
46 max(0, tvSubMsec(currentStart
, current_time
)) : 0;