MINOR: counters: Add fields to store the max observed for {q,c,d,t}_time

For backends and servers, some average times for last 1024 connections are
already calculated. For the moment, the averages for the time passed in the
queue, the connect time, the response time (for HTTP session only) and the total
time are calculated. Now, in addition, the maximum time observed for these
values are also stored.

In addition, These new counters are cleared as all other max values with the CLI
command "clear counters".

This patch is related to #272.
diff --git a/include/types/counters.h b/include/types/counters.h
index 1898548..97df045 100644
--- a/include/types/counters.h
+++ b/include/types/counters.h
@@ -100,6 +100,7 @@
 	long long down_trans;			/* up->down transitions */
 
 	unsigned int q_time, c_time, d_time, t_time; /* sums of conn_time, queue_time, data_time, total_time */
+	unsigned int qtime_max, ctime_max, dtime_max, ttime_max; /* maximum of conn_time, queue_time, data_time, total_time observed */
 
 	union {
 		struct {
diff --git a/src/stats.c b/src/stats.c
index cf692da..c68ab63 100644
--- a/src/stats.c
+++ b/src/stats.c
@@ -3746,6 +3746,10 @@
 			px->be_counters.sps_max = 0;
 			px->be_counters.cps_max = 0;
 			px->be_counters.nbpend_max = 0;
+			px->be_counters.qtime_max = 0;
+			px->be_counters.ctime_max = 0;
+			px->be_counters.dtime_max = 0;
+			px->be_counters.ttime_max = 0;
 
 			px->fe_counters.conn_max = 0;
 			px->fe_counters.p.http.rps_max = 0;
@@ -3760,6 +3764,10 @@
 				sv->counters.cur_sess_max = 0;
 				sv->counters.nbpend_max = 0;
 				sv->counters.sps_max = 0;
+				sv->counters.qtime_max = 0;
+				sv->counters.ctime_max = 0;
+				sv->counters.dtime_max = 0;
+				sv->counters.ttime_max = 0;
 			}
 
 		list_for_each_entry(li, &px->conf.listeners, by_fe)
diff --git a/src/stream.c b/src/stream.c
index 58ebab6..2c0d2c8 100644
--- a/src/stream.c
+++ b/src/stream.c
@@ -2956,11 +2956,19 @@
 		swrate_add(&srv->counters.c_time, TIME_STATS_SAMPLES, t_connect);
 		swrate_add(&srv->counters.d_time, TIME_STATS_SAMPLES, t_data);
 		swrate_add(&srv->counters.t_time, TIME_STATS_SAMPLES, t_close);
+		HA_ATOMIC_UPDATE_MAX(&srv->counters.qtime_max, t_queue);
+		HA_ATOMIC_UPDATE_MAX(&srv->counters.ctime_max, t_connect);
+		HA_ATOMIC_UPDATE_MAX(&srv->counters.dtime_max, t_data);
+		HA_ATOMIC_UPDATE_MAX(&srv->counters.ttime_max, t_close);
 	}
 	swrate_add(&s->be->be_counters.q_time, TIME_STATS_SAMPLES, t_queue);
 	swrate_add(&s->be->be_counters.c_time, TIME_STATS_SAMPLES, t_connect);
 	swrate_add(&s->be->be_counters.d_time, TIME_STATS_SAMPLES, t_data);
 	swrate_add(&s->be->be_counters.t_time, TIME_STATS_SAMPLES, t_close);
+	HA_ATOMIC_UPDATE_MAX(&s->be->be_counters.qtime_max, t_queue);
+	HA_ATOMIC_UPDATE_MAX(&s->be->be_counters.ctime_max, t_connect);
+	HA_ATOMIC_UPDATE_MAX(&s->be->be_counters.dtime_max, t_data);
+	HA_ATOMIC_UPDATE_MAX(&s->be->be_counters.ttime_max, t_close);
 }
 
 /*