summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org.ua>2016-02-08 11:16:39 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2016-02-08 11:16:39 (GMT)
commit067d63d298a15810171555f7f0acf96fb1946667 (patch) (side-by-side diff)
tree45590d2a8f795ffd426e840c1fc6f1937d78887f
parentf490124e04a9dda412d1979ca9e3e7a51f7ab8d3 (diff)
downloadvmod-tbf-067d63d298a15810171555f7f0acf96fb1946667.tar.gz
vmod-tbf-067d63d298a15810171555f7f0acf96fb1946667.tar.bz2
Update the docs.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--src/tbf.c4
-rw-r--r--src/vmod-tbf.378
2 files changed, 59 insertions, 23 deletions
diff --git a/src/tbf.c b/src/tbf.c
index 8fe3870..85dd608 100644
--- a/src/tbf.c
+++ b/src/tbf.c
@@ -198,3 +198,3 @@ tree_delete_node_unlocked(struct tree *tree, struct node *node)
/* Node has both subtrees. Find the largest value in the
- right subtree */
+ left subtree */
struct node *p;
@@ -838,3 +838,3 @@ tbf_release_tree(struct tree **t)
static void
-tbf_exit()
+tbf_exit(void)
{
diff --git a/src/vmod-tbf.3 b/src/vmod-tbf.3
index 8af8b65..626341c 100644
--- a/src/vmod-tbf.3
+++ b/src/vmod-tbf.3
@@ -15,3 +15,3 @@
.\" along with vmod-tbf. If not, see <http://www.gnu.org/licenses/>.
-.TH VMOD-TBF 1 "January 26, 2016" "VMOD-TBF" "User Reference"
+.TH VMOD-TBF 1 "February 8, 2016" "VMOD-TBF" "User Reference"
.SH NAME
@@ -25,6 +25,8 @@ vmod-tbf \- token bucket filtering for Varnish
-.BI "VOID tbf.debug(INT " level ");"
-
.BI "VOID tbf.dump(STRING " file ");"
+.BI "VOID tbf.dump_at_exit(STRING " file ");"
+
+.BI "VOID tbf.load(STRING " file ");"
+
.BI "VOID tbf.gc(DURATION " interval ");"
@@ -33,2 +35,8 @@ vmod-tbf \- token bucket filtering for Varnish
+.BI "VOID tbf.debug(INT " level ");"
+
+.BI "VOID tbf.log_tree(INT " prio ");"
+
+.BI "VOID tbf.log_stats(INT " prio ");"
+
.BI "REAL tbf.getla(INT " sample ");"
@@ -140,7 +148,33 @@ The function
.B tbf.dump
-dumps entire tree to the disk file.
+dumps entire tree to the disk file. The function
+.B tbf.load
+loads the named dump file into the tree.
.PP
The function
-.B tbf.debug
-sets the debug level.
+.B tbf.dump_at_exit
+configures the module to dump the tree before
+.B varnishd
+terminates. Use this to keep the \fBtbf\fR state across
+\fBvarnishd\fR restarts. For example:
+.PP
+.EX
+sub vcl_init {
+ tbf.load("/var/run/tbf.dump");
+ tbf.dump_at_exit("/var/run/tbf.dump");
+}
+.EE
+.SS Debugging
+.TP
+.BI "VOID tbf.debug(INT " level ");"
+Sets the debug verbosity level. Meaningful argument values are
+\fB0\fR (no debugging info) to \fB2\fR (maximum verbosity).
+.TP
+.BI "VOID tbf.log_tree(INT " prio ");"
+Logs the content of the \fBtbf\fR tree to \fBsyslog\fR priority
+\fIprio\fR. Note that this can produce extremely big amounts of info.
+.TP
+.BI "VOID tbf.log_stats(INT " prio ");"
+Logs the tree statistics to \fBsyslog\fR priority \fIprio\fR. The
+following information is logged: total number of nodes in tree, number
+of leaves, shortest, longest and average paths.
.SS Other functions
@@ -150,16 +184,18 @@ TBF algorithm, but which may come useful when implementing rate
control.
-.PP
-The \fBtbf.getla\fR function returns the system load average. Its
-argument identifies the interval for which to compute it: 1, 5 or
-15 minutes.
-.PP
-The \fBtbf.systime\fR function returns the current time of day as the
-number of seconds since the Epoch (1970-01-01 00:00:00 UTC).
-.PP
-The \fBtbf.strftime\fR function formats the \fBtimestamp\fR according
-to the specification in \fBformat\fR. See
+.TP
+.BI "REAL tbf.getla(INT " sample ");"
+Returns the system load average. The argument identifies interval
+for which to compute it: 1, 5 or 15 minutes.
+.TP
+.BI "INT tbf.systime();"
+Returns the current time of day as the number of seconds since the
+Epoch (1970-01-01 00:00:00 UTC).
+.TP
+.BI "STRING tbf.strftime(STRING " format ", INT " timestamp ");"
+Function formats the \fItimestamp\fR according to the specification in
+\fIformat\fR. See
.BR strftime (3),
for a description of available formats. For example, the following
-statements assigns the current year to the \f(CWX\-Year\fR header:
-.PP
+statement assigns the current year to the \f(CWX\-Year\fR header:
+
.EX
@@ -167,5 +203,5 @@ set req.http.X-Year = tbf.strftime("%Y", systime());
.EE
-.PP
-The \fBtbf.sleep\fR function suspends execution for a specified amount
-of time.
+.TP
+.BI "VOID tbf.sleep(DURATION " time ");"
+Suspends execution for a specified amount of time.
.\"

Return to:

Send suggestions and report system problems to the System administrator.