]> git.tue.mpg.de Git - paraslash.git/commitdiff
Add btr_bytes_pending().
authorAndre Noll <maan@systemlinux.org>
Mon, 28 Dec 2009 21:51:23 +0000 (22:51 +0100)
committerAndre Noll <maan@systemlinux.org>
Mon, 28 Dec 2009 21:51:23 +0000 (22:51 +0100)
buffer_tree.c
buffer_tree.h

index 084827e3d34c0952588f1a751a20ffe32eb28467..941d58dba07521dc773721b93262b56ea2466f4f 100644 (file)
@@ -196,3 +196,20 @@ size_t btr_get_input_queue_size(struct btr_node *btrn)
                size += br_available_bytes(br);
        return size;
 }
+
+/**
+ * Return the size of the largest input queue.
+ *
+ * Iterates over all children of the given node.
+ */
+size_t btr_bytes_pending(struct btr_node *btrn)
+{
+       size_t max_size = 0;
+       struct btr_node *ch;
+
+       FOR_EACH_CHILD(ch, btrn) {
+               size_t size = btr_get_input_queue_size(ch);
+               max_size = PARA_MAX(max_size, size);
+       }
+       return max_size;
+}
index 8a7a33b8316c8aee5b6156cb4dd64f7749999d6e..b066ad9e3862c5006dd6ecf73cf40b8dfa657aa1 100644 (file)
@@ -5,3 +5,4 @@ struct btr_node *btr_new_node(char *name, struct btr_node *parent);
 void btr_del_node(struct btr_node *btrn);
 void btr_add_output(char *buf, size_t size, struct btr_node *btrn);
 bool btr_is_leaf_node(struct btr_node *btrn);
+size_t btr_bytes_pending(struct btr_node *btrn);