On Mon, 5 Nov 2007, Krzysztof Oledzki wrote: <CUT>
Eh, forget to inline the new version. :(
diff -Nur haproxy-1.3.13-orig/include/proto/session.h haproxy-1.3.13-contiguous-cunters/include/proto/session.h --- haproxy-1.3.13-orig/include/proto/session.h 2007-10-18 22:38:22.000000000 +0200
+++ haproxy-1.3.13-contiguous-cunters/include/proto/session.h 2007-11-04 16:46:49.000000000 +0100
@@ -33,6 +33,8 @@
+void session_process_counters(struct session *s);
+
#endif /* _PROTO_SESSION_H */
/*
diff -Nur haproxy-1.3.13-orig/include/types/backend.h haproxy-1.3.13-contiguous-cunters/include/types/backend.h --- haproxy-1.3.13-orig/include/types/backend.h 2007-10-18 22:38:22.000000000 +0200
+++ haproxy-1.3.13-contiguous-cunters/include/types/backend.h 2007-11-05 00:21:01.000000000 +0100
@@ -61,6 +61,7 @@ #define PR_O_BALANCE (PR_O_BALANCE_RR | PR_O_BALANCE_SH | PR_O_BALANCE_UH) #define PR_O_SMTP_CHK 0x20000000 /* use SMTP EHLO check for server health - pvandijk#vision6.com.au */ #define PR_O_TCP_NOLING 0x40000000 /* disable lingering on client and server connections */
+#define PR_O_CONTSTATS 0x80000000 /* continous counters */
#endif /* _TYPES_BACKEND_H */
diff -Nur haproxy-1.3.13-orig/src/cfgparse.c haproxy-1.3.13-contiguous-cunters/src/cfgparse.c
--- haproxy-1.3.13-orig/src/cfgparse.c 2007-11-02 01:12:24.000000000 +0100
+++ haproxy-1.3.13-contiguous-cunters/src/cfgparse.c 2007-11-05 00:20:42.000000000 +0100
@@ -95,6 +95,7 @@ { "httpclose", PR_O_HTTP_CLOSE, PR_CAP_FE | PR_CAP_BE, 0 }, { "nolinger", PR_O_TCP_NOLING, PR_CAP_FE | PR_CAP_BE, 0 }, { "logasap", PR_O_LOGASAP, PR_CAP_FE, 0 },
+ { "contstats", PR_O_CONTSTATS, PR_CAP_FE, 0 },
{ "abortonclose", PR_O_ABRT_CLOSE, PR_CAP_BE, 0 }, { "checkcache", PR_O_CHK_CACHE, PR_CAP_BE, 0 }, { "dontlognull", PR_O_NULLNOLOG, PR_CAP_FE, 0 }, diff -Nur haproxy-1.3.13-orig/src/proto_http.c haproxy-1.3.13-contiguous-cunters/src/proto_http.c --- haproxy-1.3.13-orig/src/proto_http.c 2007-10-18 22:38:22.000000000 +0200
+++ haproxy-1.3.13-contiguous-cunters/src/proto_http.c 2007-11-05 01:00:50.000000000 +0100
@@ -613,6 +613,10 @@ } while (fsm_resync); if (likely(s->cli_state != CL_STCLOSE || s->srv_state != SV_STCLOSE)) {
+
+ if ((s->fe->options & PR_O_CONTSTATS) && (s->flags & SN_BE_ASSIGNED))
+ session_process_counters(s);
+
s->req->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE; s->rep->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE; @@ -651,21 +655,7 @@ } s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now); - if (s->req != NULL) - s->logs.bytes_in = s->req->total; - if (s->rep != NULL) - s->logs.bytes_out = s->rep->total; - - s->fe->bytes_in += s->logs.bytes_in; - s->fe->bytes_out += s->logs.bytes_out; - if (s->be != s->fe) { - s->be->bytes_in += s->logs.bytes_in; - s->be->bytes_out += s->logs.bytes_out; - } - if (s->srv) { - s->srv->bytes_in += s->logs.bytes_in; - s->srv->bytes_out += s->logs.bytes_out; - }
+ session_process_counters(s);
/* let's do a final log if we need it */ if (s->logs.logwait && @@ -3094,6 +3084,7 @@ http_sess_log(t); else tcp_sess_log(t);
+ t->logs.bytes_in = 0;
} /* Note: we must not try to cheat by jumping directly to DATA, diff -Nur haproxy-1.3.13-orig/src/proto_uxst.c haproxy-1.3.13-contiguous-cunters/src/proto_uxst.c --- haproxy-1.3.13-orig/src/proto_uxst.c 2007-10-18 22:38:22.000000000 +0200
+++ haproxy-1.3.13-contiguous-cunters/src/proto_uxst.c 2007-11-05 00:32:13.000000000 +0100
@@ -1238,6 +1238,10 @@ } while (fsm_resync); if (likely(s->cli_state != CL_STCLOSE || s->srv_state != SV_STCLOSE)) {
+
+ if ((s->fe->options & PR_O_CONTSTATS) && (s->flags & SN_BE_ASSIGNED))
+ session_process_counters(s);
+
s->req->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE; s->rep->flags &= BF_CLEAR_READ & BF_CLEAR_WRITE; @@ -1270,23 +1274,7 @@ } s->logs.t_close = tv_ms_elapsed(&s->logs.tv_accept, &now); - if (s->req != NULL) - s->logs.bytes_in = s->req->total; - if (s->rep != NULL) - s->logs.bytes_out = s->rep->total; - - if (s->fe) { - s->fe->bytes_in += s->logs.bytes_in; - s->fe->bytes_out += s->logs.bytes_out; - } - if (s->be && (s->be != s->fe)) { - s->be->bytes_in += s->logs.bytes_in; - s->be->bytes_out += s->logs.bytes_out; - } - if (s->srv) { - s->srv->bytes_in += s->logs.bytes_in; - s->srv->bytes_out += s->logs.bytes_out; - }
+ session_process_counters(s);
/* let's do a final log if we need it */ if (s->logs.logwait && diff -Nur haproxy-1.3.13-orig/src/session.c haproxy-1.3.13-contiguous-cunters/src/session.c --- haproxy-1.3.13-orig/src/session.c 2007-10-18 22:38:22.000000000 +0200
+++ haproxy-1.3.13-contiguous-cunters/src/session.c 2007-11-05 01:01:04.000000000 +0100
@@ -102,6 +102,38 @@ return pool2_session != NULL;
+void session_process_counters(struct session *s) {
+
+ unsigned long long bytes;
+
+ if (s->req && s->req->total != s->logs.bytes_in) {
+ bytes = s->req->total - s->logs.bytes_in;
+
+ s->fe->bytes_in += bytes;
+
+ if (s->be != s->fe)
+ s->be->bytes_in += bytes;
+
+ if (s->srv)
+ s->srv->bytes_in += bytes;
+
+ s->logs.bytes_in = s->req->total;
+ }
+
+ if (s->rep && s->rep->total != s->logs.bytes_out) {
+ bytes = s->rep->total - s->logs.bytes_out;
+
+ s->fe->bytes_out += bytes;
+
+ if (s->be != s->fe)
+ s->be->bytes_out += bytes;
+
+ if (s->srv)
+ s->srv->bytes_out += bytes;
+
+ s->logs.bytes_out = s->rep->total;
+ }
+}
/*
Best regards,
Krzysztof Olędzki Received on 2007/11/05 01:07
This archive was generated by hypermail 2.2.0 : 2007/11/05 01:45 CET