]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: channel: add the date of last read in the channel
authorWilly Tarreau <w@1wt.eu>
Sun, 9 Feb 2014 16:45:16 +0000 (17:45 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 12 Feb 2014 10:45:59 +0000 (11:45 +0100)
We store the time stamp of last read in the channel in order to
be able to measure some bit rate and pause lengths. We only use
16 bits which were unused for this. We don't need more, as it
allows us to measure with a millisecond precision for up to 65s.

include/proto/channel.h
include/types/channel.h

index 0afdc6588b66be0e276aa27ea413b64d47ce0570..36633c6432e4d7996e29197929239edfd20ff6d8 100644 (file)
@@ -55,6 +55,7 @@ static inline void channel_init(struct channel *chn)
        chn->buf->i = 0;
        chn->buf->p = chn->buf->data;
        chn->to_forward = 0;
+       chn->last_read = now_ms;
        chn->xfer_small = chn->xfer_large = 0;
        chn->total = 0;
        chn->pipe = NULL;
index 905308e1fd8c45b85e67e4e15f528357e2832736..2eea3e81f4eb6f08eb94e3f3871ac3e721f09431 100644 (file)
@@ -172,6 +172,7 @@ struct channel {
        struct stream_interface *prod;  /* producer attached to this channel */
        struct pipe *pipe;              /* non-NULL only when data present */
        unsigned int to_forward;        /* number of bytes to forward after out without a wake-up */
+       unsigned short last_read;       /* 16 lower bits of last read date (max pause=65s) */
        unsigned char xfer_large;       /* number of consecutive large xfers */
        unsigned char xfer_small;       /* number of consecutive small xfers */
        unsigned long long total;       /* total data read */