From patchwork Wed Aug 28 13:42:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robin Jarry X-Patchwork-Id: 143422 X-Patchwork-Delegate: david.marchand@redhat.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 823D345888; Wed, 28 Aug 2024 15:42:45 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 07741402CA; Wed, 28 Aug 2024 15:42:45 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 7D50E40150 for ; Wed, 28 Aug 2024 15:42:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724852562; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=UxSWIiP2+JFOhnqNq5TK9n9fOW81jB3H6eznZsdhhag=; b=AiBy5zheiFYwL/5QNgfKju7Ecuc40odM/5+d52CndT+/oooRgu5miAMNq6E+cTF2ul3mSN 5WpCLMcsCF/NWmhYtMXrNa+hsHh7rFfLD0FcbMPKHqX3EPqrfAyYLkcbgs2/5+HLip70P4 WCO6thYBTriryG5IxvfcmPSbrl++kFU= Received: from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-247-gmKfIZXGOXKgfj4CHWeVRA-1; Wed, 28 Aug 2024 09:42:36 -0400 X-MC-Unique: gmKfIZXGOXKgfj4CHWeVRA-1 Received: from mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.40]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 6DFBF1955D59; Wed, 28 Aug 2024 13:42:35 +0000 (UTC) Received: from ringo.redhat.com (unknown [10.39.208.36]) by mx-prod-int-04.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 737E119560A3; Wed, 28 Aug 2024 13:42:33 +0000 (UTC) From: Robin Jarry To: dev@dpdk.org, Jerin Jacob , Kiran Kumar K , Nithin Dabilpuram , Zhirun Yan Subject: [PATCH dpdk] graph: make graphviz export more readable Date: Wed, 28 Aug 2024 15:42:27 +0200 Message-ID: <20240828134226.866655-2-rjarry@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.40 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Change the color of arrows leading to sink nodes to dark orange. Remove the node oval shape around the sink nodes and make their text dark orange. This results in a much more readable output for large graphs. See the link below for an example. Link: https://f.jarry.cc/rte-graph-dot/ipv6.svg Signed-off-by: Robin Jarry Acked-by: Kiran Kumar Kokkilagadda --- lib/graph/graph.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/graph/graph.c b/lib/graph/graph.c index d5b8c9f918cf..dff8e690a80d 100644 --- a/lib/graph/graph.c +++ b/lib/graph/graph.c @@ -745,7 +745,7 @@ graph_to_dot(FILE *f, struct graph *graph) if (rc < 0) goto end; } else if (graph_node->node->nb_edges == 0) { - rc = fprintf(f, " [color=darkorange]"); + rc = fprintf(f, " [fontcolor=darkorange shape=plain]"); if (rc < 0) goto end; } @@ -753,9 +753,12 @@ graph_to_dot(FILE *f, struct graph *graph) if (rc < 0) goto end; for (i = 0; i < graph_node->node->nb_edges; i++) { + const char *node_attrs = attrs; + if (graph_node->adjacency_list[i]->node->nb_edges == 0) + node_attrs = " [color=darkorange]"; rc = fprintf(f, "\t\"%s\" -> \"%s\"%s;\n", node_name, graph_node->adjacency_list[i]->node->name, - attrs); + node_attrs); if (rc < 0) goto end; }