[OPTIM] stats: check free space before trying to print

This alone makes a typical HTML stats dump consume 10% CPU less,
because we avoid doing complex printf calls to drop them later.
Only a few common cases have been checked, those which are very
likely to run for nothing.
diff --git a/include/proto/buffers.h b/include/proto/buffers.h
index 801ea1a..6f10553 100644
--- a/include/proto/buffers.h
+++ b/include/proto/buffers.h
@@ -288,6 +288,14 @@
 	return ret;
 }
 
+/* Return 1 if the buffer has less than 1/4 of its capacity free, otherwise 0 */
+static inline int buffer_almost_full(struct buffer *buf)
+{
+	if (buffer_contig_space(buf) < buf->size / 4)
+		return 1;
+	return 0;
+}
+
 /*
  * Return the max amount of bytes that can be read from the buffer at once.
  * Note that this may be lower than the actual buffer length when the data