redcurrant/redcurrant — pull request #14 by jfsmig (2014-11-25 09:19:01+00:00)
Title: Finer gauges for active threads, reliable accesslog delays

This patch provides the maximum number of active threads, and a round-robin storage for that information.
The granularity proposed is intervals of 1s over the past 30s, and intervals of 1 minute over the past 1 hour.
This data is used by the core server library to expose statistics, e.g.

server.thread.max.1 = 0
server.thread.max.5 = 1
server.thread.max.15 = 2
server.thread.max.30 = 2
server.thread.max.60 = 3
server.thread.max.300 = 3
server.thread.max.900 = 3
server.thread.max.3600 = 3

This patch also alters the accesslog format for gridd transports, and it is now unified with http transport.
An access log record now provides 2 treatment durations:
- the total time spent since the reception of the last buffer that completes the request
- the total treatment time, from the moment where a worker thread starts the request handling til the moment an answer is generated.
The delta between both delays is the time spent in the internals queues of the process.

The patch divides in:
- server/stats_holder.* :
- drops the adherence to system time, the current timestamp is now received from the caller. This is necessary to manager counter with a granularity different than 1s.
- New calls to compute the cumulative maximum
- code simplification
- server/network_server.* :
- new round-robin stats now managed
- new stats exposed.
- precise monotonic clock used on the last input
- server/transport_http.c :
- useless variables removed.
- accesslog format reviewed (timers printed : total time spent, time spent in queue)
- server/transport_gridd.c :
- accesslog format reviewed (timers printed : total time spent, time spent in queue)
- sqlx/sqlx_service.c :
- code adapted to match the lost "time adherence"

Change-Id: I248ae7a1937860e4062290e95b68465d7ec62821