diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-02-08 13:21:21 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-02-08 17:05:22 +0200 |
commit | 32a55b403a2bbd774aed5b714d25ddad4e062d4f (patch) | |
tree | ccdf5eecef4f32a6a32c5b68115a49d78603734a | |
parent | c9f6dc168ead762e02db1e27c5bc7c42282c9e50 (diff) | |
download | vmod-tbf-32a55b403a2bbd774aed5b714d25ddad4e062d4f.tar.gz vmod-tbf-32a55b403a2bbd774aed5b714d25ddad4e062d4f.tar.bz2 |
Fix debug levels. Document data structures.
-rw-r--r-- | src/tbf.c | 9 | ||||
-rw-r--r-- | src/tbf.h | 19 |
2 files changed, 15 insertions, 13 deletions
@@ -47,3 +47,3 @@ lru_link_node(struct tree *tree, struct node *node, struct node *ref) struct node *x; - //debug(0, ("LINK %p %p %p", node, ref, ref->next)); + node->prev = ref; @@ -667,3 +667,3 @@ tree_load_nodes(struct tree *tree, struct dump_header *hdr, - debug(0,("Load record %lu/%lu %lu", i, hdr->count, incomplete)); + debug(3,("Load record %lu/%lu %lu", i, hdr->count, incomplete)); @@ -726,3 +726,3 @@ tree_load_nodes(struct tree *tree, struct dump_header *hdr, np->keystr = node.keystr; - debug(0, ("loaded %p: %s %1x (%lu,%lu): time: %"PRIu64" us, tokens: %lu", + debug(3, ("loaded %p: %s %1x (%lu,%lu): time: %"PRIu64" us, tokens: %lu", np, @@ -770,3 +770,2 @@ tree_load_nodes(struct tree *tree, struct dump_header *hdr, tree->root = nodes[hdr->root]; -// debug(0,("Loaded nodes")); return 0; @@ -794,3 +793,3 @@ tree_load(char const *filename) - debug(0,("elements: %"PRIu32", size: %"PRIu32", root: %"PRIu32, + debug(3,("elements: %"PRIu32", size: %"PRIu32", root: %"PRIu32, header.count, header.size, header.root)); @@ -63,3 +63,3 @@ enum { CHILD_LEFT, CHILD_RIGHT }; -enum { NST_INCOMPLETE, NST_INIT }; +enum node_status { NST_INCOMPLETE, NST_INIT }; @@ -70,9 +70,12 @@ struct node { #endif - struct node *parent; - struct node *child[2]; - struct node *prev, *next; - pthread_cond_t notbusy; - int busy:1; - int status; - uint32_t ord; + struct node *parent; /* Parent node */ + struct node *child[2]; /* Left and right child nodes */ + struct node *prev, *next; /* More (prev) and less (next) recently + updated nodes. */ + pthread_cond_t notbusy; /* Prevent simultaneous updates */ + int busy:1; /* Node is in use if 1 */ + enum node_status status; /* Node status */ + uint32_t ord; /* Used when dumping nodes and computing tree + stats */ + /* Actual TBF payload: */ uint64_t timestamp; /* microseconds since epoch */ |