tools/zep_dispatch: don't graph links with weight 0

This commit is contained in:
Benjamin Valentin 2021-09-24 15:30:57 +02:00
parent 004b93edca
commit 3e7999387c
2 changed files with 9 additions and 5 deletions

View File

@ -105,7 +105,7 @@ static void dispatch_loop(int sock, dispatch_cb_t dispatch, void *ctx)
}
static topology_t topology;
static const char *graphviz_file;
static const char *graphviz_file = "example.gv";
static void _info_handler(int signal)
{
if (signal != SIGUSR1) {

View File

@ -151,10 +151,14 @@ int topology_print(const char *file, const topology_t *t)
for (list_node_t *edge = t->edges.next; edge; edge = edge->next) {
struct edge *super = container_of(edge, struct edge, next);
fprintf(out, "\t%s -> %s [ label = \"%.2f\" ]\n",
super->a->name, super->b->name, super->weight_a_b);
fprintf(out, "\t%s -> %s [ label = \"%.2f\" ]\n",
super->b->name, super->a->name, super->weight_b_a);
if (super->weight_a_b) {
fprintf(out, "\t%s -> %s [ label = \"%.2f\" ]\n",
super->a->name, super->b->name, super->weight_a_b);
}
if (super->weight_b_a) {
fprintf(out, "\t%s -> %s [ label = \"%.2f\" ]\n",
super->b->name, super->a->name, super->weight_b_a);
}
}
fprintf(out, "}\n");