[squid-dev] [PREVIEW] Free AccessLogEntry::url when needed
Amos Jeffries
squid3 at treenet.co.nz
Sat Mar 19 08:34:53 UTC 2016
On 15/03/2016 12:33 p.m., Nathan Hoad wrote:
> Hello,
>
> Attached is a first attempt at converting the AccessLogEntry::url
> member to an SBuf. It's definitely resulted in more data copies - just
> about all sources are still char *.
>
> I'm not sure how I can actually avoid those, aside from converting
> them to SBuf as well, which would mean modifying HTCP and ICP logging,
> and ClientSideRequest::log_uri. I can take a crack at
> ClientSideRequest::log_uri if people are interested, but I'm not in a
> position to test any changes made to HTCP and ICP logging.
in format/Format.cc:
* avoid c_str() like below. Which still copies, but avoids also
reallocating the ALE url field:
if (!al->url.isEmpty()) {
const SBuf &s = al->url;
sb.append(s.rawContent(), s.length());
out = sb.termedBuf();
}
in src/log/FormatHttpdCombined.cc:
* in printf()-like statements we have the SQUIDSBUFPH and
SQUIDSBUFPRINT(x) macros which output an SBuf efficiently as can be done.
- same for all the other printf-like calls.
in src/log/access_log.cc:
* Its worth adding a global "SBuf Dash" to the Format namespace and
using Format::Dash instead of dash_str to set the new SBuf member.
in src/log/FormatSquidReferer.cc
* use a "const SBuf s = ..." local variable which has the if-logic
applied to it separately to assign the Format::Dash then the local is
passed to the printf() call.
Amos
More information about the squid-dev
mailing list