[squid-dev] [PATCH] Logging fast things

Tsantilas Christos chtsanti at users.sourceforge.net
Wed Nov 19 18:35:51 UTC 2014


Hi all,

In many cases HITs logged with zero response times. The logging entries 
are correct, those transaction took less than a millisecond. However, to 
better monitor Squid performance and to optimize things further, a user 
may want to see more precise response time measurements logged.

This patch add configurable "precision" for time-related fields such as 
%tr, using a .n syntax similar to the syntax used by the well-known 
printf(3) API to mean "maximum field width".

Examples:
   %tr   -- 0 -- millisecond precision (no change compared to today)
   %.3tr -- 0.123 -- microsecond precision (after this project)
   %.6tr -- 0.123456 -- nanosecond precision (year 2050 trading platform??)


Technical notes
==================

At the first stages of this patch I used double to record times for 
logging, bug finally I selected to use timeval structures. I hope it is 
good choice

A problem I have was to identify uninitialized timeval values.
Currently squid uses signed integers to record millisecond values and a 
negative value means uninitialized variable.
Finally I used -1 to the timeval::tv_sec field, to mark uninitialized 
timeval variables. The timeval::tv_sec member is of type time_t and we 
are already using "-1" to mark uninitialized time_t variables in some 
places inside squid.
An alternate approach is to use for this purpose a MAXLONG, or maybe the 
std::numeric_limits<time_t>::max() value.

The DNS time (%dt code) is still in milliseconds.

Also I did not touch mgr statistics. Still the statistics values 
computed using milliseconds.


Regards,
    Christos



This is a Measurement Factory project
-------------- next part --------------
A non-text attachment was scrubbed...
Name: logging-fast-things-t1.patch
Type: text/x-patch
Size: 44795 bytes
Desc: not available
URL: <http://lists.squid-cache.org/pipermail/squid-dev/attachments/20141119/ca4926e8/attachment-0001.bin>


More information about the squid-dev mailing list