]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: tools: improve the DOT dump of the ebtree
authorWilly Tarreau <w@1wt.eu>
Wed, 15 Nov 2017 16:49:54 +0000 (17:49 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 15 Nov 2017 18:43:05 +0000 (19:43 +0100)
Use a smaller and cleaner fixed font, use upper case to indicate sides on
branches, remove the useless node/leaf markers on branches since the colors
already indicate them, and show the node's key as it helps spot the matching
leaf.

src/standard.c

index ff6cb945a0143d202b06735c121c5a4888f5d5fe..a0f3d65d4bece3bdc16d0ceeb037ce70bb7f8d4d 100644 (file)
@@ -2236,49 +2236,46 @@ void eb32sc_to_file(FILE *file, struct eb_root *root)
 
        fprintf(file,
                "digraph ebtree {\n"
-               "  node [fontname=\"courier-bold\" shape=\"box\" style=\"filled\" color=\"black\" fillcolor=\"white\"];\n"
-               "  edge [fontname=\"arial\" style=\"solid\" color=\"magenta\" dir=\"forward\"];\n"
+               "  node [fontname=\"fixed\" fontsize=8 shape=\"box\" style=\"filled\" color=\"black\" fillcolor=\"white\"];\n"
+               "  edge [fontname=\"fixed\" fontsize=8 style=\"solid\" color=\"magenta\" dir=\"forward\"];\n"
                "  \"%lx_n\" [label=\"root\\n%lx\"]\n", (long)eb_root_to_node(root), (long)root
                );
 
-       fprintf(file, "  \"%lx_n\" -> \"%lx_%c\" [taillabel=\"l:%c\"];\n",
+       fprintf(file, "  \"%lx_n\" -> \"%lx_%c\" [taillabel=\"L\"];\n",
                (long)eb_root_to_node(root),
                (long)eb_root_to_node(eb_clrtag(root->b[0])),
-               eb_gettag(root->b[0]) == EB_LEAF ? 'l' : 'n',
                eb_gettag(root->b[0]) == EB_LEAF ? 'l' : 'n');
 
        node = eb32sc_first(root, scope);
        while (node) {
                if (node->node.node_p) {
                        /* node part is used */
-                       fprintf(file, "  \"%lx_n\" [label=\"%lx\\nbit=%d\\nscope=%lx\" fillcolor=\"lightskyblue1\"];\n",
-                               (long)node, (long)node, node->node.bit, node->node_s);
+                       fprintf(file, "  \"%lx_n\" [label=\"%lx\\nkey=%u\\nscope=%lx\\nbit=%d\" fillcolor=\"lightskyblue1\"];\n",
+                               (long)node, (long)node, node->key, node->node_s, node->node.bit);
 
-                       fprintf(file, "  \"%lx_n\" -> \"%lx_n\" [taillabel=\"np:%c\"];\n",
+                       fprintf(file, "  \"%lx_n\" -> \"%lx_n\" [taillabel=\"%c\"];\n",
                                (long)node,
                                (long)eb_root_to_node(eb_clrtag(node->node.node_p)),
-                               eb_gettag(node->node.node_p) ? 'r' : 'l');
+                               eb_gettag(node->node.node_p) ? 'R' : 'L');
 
-                       fprintf(file, "  \"%lx_n\" -> \"%lx_%c\" [taillabel=\"l:%c\"];\n",
+                       fprintf(file, "  \"%lx_n\" -> \"%lx_%c\" [taillabel=\"L\"];\n",
                                (long)node,
                                (long)eb_root_to_node(eb_clrtag(node->node.branches.b[0])),
-                               eb_gettag(node->node.branches.b[0]) == EB_LEAF ? 'l' : 'n',
                                eb_gettag(node->node.branches.b[0]) == EB_LEAF ? 'l' : 'n');
 
-                       fprintf(file, "  \"%lx_n\" -> \"%lx_%c\" [taillabel=\"r:%c\"];\n",
+                       fprintf(file, "  \"%lx_n\" -> \"%lx_%c\" [taillabel=\"R\"];\n",
                                (long)node,
                                (long)eb_root_to_node(eb_clrtag(node->node.branches.b[1])),
-                               eb_gettag(node->node.branches.b[1]) == EB_LEAF ? 'l' : 'n',
                                eb_gettag(node->node.branches.b[1]) == EB_LEAF ? 'l' : 'n');
                }
 
                fprintf(file, "  \"%lx_l\" [label=\"%lx\\nkey=%u\\nscope=%lx\\npfx=%u\" fillcolor=\"yellow\"];\n",
                        (long)node, (long)node, node->key, node->leaf_s, node->node.pfx);
 
-               fprintf(file, "  \"%lx_l\" -> \"%lx_n\" [taillabel=\"lp:%c\"];\n",
+               fprintf(file, "  \"%lx_l\" -> \"%lx_n\" [taillabel=\"%c\"];\n",
                        (long)node,
                        (long)eb_root_to_node(eb_clrtag(node->node.leaf_p)),
-                       eb_gettag(node->node.leaf_p) ? 'r' : 'l');
+                       eb_gettag(node->node.leaf_p) ? 'R' : 'L');
                node = eb32sc_next(node, scope);
        }
        fprintf(file, "}\n");