diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-02-08 13:16:39 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-02-08 17:05:13 +0200 |
commit | c9f6dc168ead762e02db1e27c5bc7c42282c9e50 (patch) | |
tree | 8e7cf6487f8c0ee1efada0b592bbff880e438b3d | |
parent | ef009c2202de0721f6a56d3b879de66246cf27fd (diff) | |
download | vmod-tbf-c9f6dc168ead762e02db1e27c5bc7c42282c9e50.tar.gz vmod-tbf-c9f6dc168ead762e02db1e27c5bc7c42282c9e50.tar.bz2 |
Update the docs.
-rw-r--r-- | src/tbf.c | 4 | ||||
-rw-r--r-- | src/vmod-tbf.3 | 78 |
2 files changed, 59 insertions, 23 deletions
@@ -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 08ffb43..39a60b9 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. .\" |