MINOR: stats: Enhancement to stats page to provide information of last session time.

Summary:
Track and report last session time on the stats page for each server
in every backend, as well as the backend.

This attempts to address the requirement in the ROADMAP

  - add a last activity date for each server (req/resp) that will be
    displayed in the stats. It will be useful with soft stop.

The stats page reports this as time elapsed since last session. This
change does not adequately address the requirement for long running
session (websocket, RDP... etc).
diff --git a/include/proto/backend.h b/include/proto/backend.h
index 74caaaa..68ba3d6 100644
--- a/include/proto/backend.h
+++ b/include/proto/backend.h
@@ -23,6 +23,7 @@
 #define _PROTO_BACKEND_H
 
 #include <common/config.h>
+#include <common/time.h>
 
 #include <types/backend.h>
 #include <types/proxy.h>
@@ -43,6 +44,13 @@
 void update_backend_weight(struct proxy *px);
 struct server *get_server_sh(struct proxy *px, const char *addr, int len);
 struct server *get_server_uh(struct proxy *px, char *uri, int uri_len);
+int be_lastsession(const struct proxy *be);
+
+/* set the time of last session on the backend */
+static void inline be_set_sess_last(struct proxy *be)
+{
+	be->be_counters.last_sess = now.tv_sec;
+}
 
 /* This function returns non-zero if a server with the given weight and state
  * is usable for LB, otherwise zero.
diff --git a/include/proto/server.h b/include/proto/server.h
index 93f4f81..750d8d5 100644
--- a/include/proto/server.h
+++ b/include/proto/server.h
@@ -25,14 +25,17 @@
 #include <unistd.h>
 
 #include <common/config.h>
+#include <common/time.h>
 #include <types/proxy.h>
 #include <types/queue.h>
 #include <types/server.h>
 
 #include <proto/queue.h>
+#include <proto/log.h>
 #include <proto/freq_ctr.h>
 
 int srv_downtime(const struct server *s);
+int srv_lastsession(const struct server *s);
 int srv_getinter(const struct check *check);
 
 /* increase the number of cumulated connections on the designated server */
@@ -44,6 +47,12 @@
 		s->counters.sps_max = s->sess_per_sec.curr_ctr;
 }
 
+/* set the time of last session on the designated server */
+static void inline srv_set_sess_last(struct server *s)
+{
+	s->counters.last_sess = now.tv_sec;
+}
+
 #endif /* _PROTO_SERVER_H */
 
 /*
diff --git a/include/types/counters.h b/include/types/counters.h
index efb48f6..ecdc7cb 100644
--- a/include/types/counters.h
+++ b/include/types/counters.h
@@ -29,6 +29,7 @@
 	long long    cum_conn;                  /* cumulated number of received connections */
 	long long    cum_sess;                  /* cumulated number of accepted connections */
 	long long  cum_lbconn;                  /* cumulated number of sessions processed by load balancing (BE only) */
+	unsigned long last_sess;                /* last session time */
 
 	unsigned int cps_max;                   /* maximum of new connections received per second */
 	unsigned int sps_max;                   /* maximum of new connections accepted per second (sessions) */
@@ -85,6 +86,7 @@
 
 	long long cum_sess;			/* cumulated number of sessions really sent to this server */
 	long long cum_lbconn;			/* cumulated number of sessions directed by load balancing */
+	unsigned long last_sess;                 /* last session time */
 
 	long long bytes_in;			/* number of bytes transferred from the client to the server */
 	long long bytes_out;			/* number of bytes transferred from the server to the client */