From patchwork Thu Sep 8 02:09:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yan, Zhirun" X-Patchwork-Id: 116062 X-Patchwork-Delegate: thomas@monjalon.net 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 BB1DAA0548; Thu, 8 Sep 2022 04:10:50 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1DE3042847; Thu, 8 Sep 2022 04:10:30 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mails.dpdk.org (Postfix) with ESMTP id 16C6C42847 for ; Thu, 8 Sep 2022 04:10:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1662603028; x=1694139028; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=JCFWpn9aZmQy6hR4Zwa8Ak82mjnuryELi4jEQFlHSEY=; b=YqFzDt2LK+BnAZjxk5crpju5kkcbyKhzRVzBAkd73rWt/eCTxkITJRx7 v/Y3svd3M+yon/NK/P0e5aKWCxQfSB6eTaku06AtFaQ0POzE3DgL6pU+3 099vUcPYrRxeYY63ri32AShyCJ9ZFItMSXH++8VMSNkP8MO6HZe3CMQ5k IXl8pWIkl/zZQL1AIFRjJwDdRIcWnw2eDoLIW6cNN+T//M2VZShsywe54 lkpZTtOwfysMII3H0ugcycQc8qB8xlHtAy/JCi8FY3IKGthUyphzd02dV j2A3IFPPC/3/KGVC5PpwWXWI+5lQxjCIhAk3XQjCdn+V7Li9E+XPRJiHk Q==; X-IronPort-AV: E=McAfee;i="6500,9779,10463"; a="383336899" X-IronPort-AV: E=Sophos;i="5.93,298,1654585200"; d="scan'208";a="383336899" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Sep 2022 19:10:27 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,298,1654585200"; d="scan'208";a="565755865" Received: from dpdk-zhirun-lmm.sh.intel.com ([10.67.118.241]) by orsmga003.jf.intel.com with ESMTP; 07 Sep 2022 19:10:25 -0700 From: Zhirun Yan To: dev@dpdk.org, jerinj@marvell.com, kirankumark@marvell.com Cc: cunming.liang@intel.com, haiyue.wang@intel.com, Zhirun Yan Subject: [RFC, v1 5/6] graph: add stats for corss-core dispatching Date: Thu, 8 Sep 2022 10:09:58 +0800 Message-Id: <20220908020959.1675953-6-zhirun.yan@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220908020959.1675953-1-zhirun.yan@intel.com> References: <20220908020959.1675953-1-zhirun.yan@intel.com> MIME-Version: 1.0 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 Add stats for cross-core dispatching scheduler if stats collection is enabled. Signed-off-by: Haiyue Wang Signed-off-by: Cunming Liang Signed-off-by: Zhirun Yan --- lib/graph/graph_debug.c | 4 ++++ lib/graph/graph_stats.c | 19 +++++++++++++++---- lib/graph/rte_graph.h | 3 +++ lib/graph/rte_graph_worker.h | 3 +++ 4 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lib/graph/graph_debug.c b/lib/graph/graph_debug.c index b84412f5dd..168299259b 100644 --- a/lib/graph/graph_debug.c +++ b/lib/graph/graph_debug.c @@ -74,6 +74,10 @@ rte_graph_obj_dump(FILE *f, struct rte_graph *g, bool all) fprintf(f, " size=%d\n", n->size); fprintf(f, " idx=%d\n", n->idx); fprintf(f, " total_objs=%" PRId64 "\n", n->total_objs); + fprintf(f, " total_sched_objs=%" PRId64 "\n", + n->total_sched_objs); + fprintf(f, " total_sched_fail=%" PRId64 "\n", + n->total_sched_fail); fprintf(f, " total_calls=%" PRId64 "\n", n->total_calls); for (i = 0; i < n->nb_edges; i++) fprintf(f, " edge[%d] <%s>\n", i, diff --git a/lib/graph/graph_stats.c b/lib/graph/graph_stats.c index 65e12d46a3..c123ac4087 100644 --- a/lib/graph/graph_stats.c +++ b/lib/graph/graph_stats.c @@ -41,15 +41,18 @@ struct rte_graph_cluster_stats { #define boarder() \ fprintf(f, "+-------------------------------+---------------+--------" \ - "-------+---------------+---------------+---------------+-" \ + "-------+---------------+---------------+---------------+"\ + "---------------+---------------+-" \ "----------+\n") static inline void print_banner(FILE *f) { boarder(); - fprintf(f, "%-32s%-16s%-16s%-16s%-16s%-16s%-16s\n", "|Node", "|calls", - "|objs", "|realloc_count", "|objs/call", "|objs/sec(10E6)", + fprintf(f, "%-32s%-16s%-16s%-16s%-16s%-16s%-16s%-16s%-16s\n", + "|Node", "|calls", + "|objs", "|sched objs", "|sched fail", + "|realloc_count", "|objs/call", "|objs/sec(10E6)", "|cycles/call|"); boarder(); } @@ -77,8 +80,10 @@ print_node(FILE *f, const struct rte_graph_cluster_node_stats *stat) fprintf(f, "|%-31s|%-15" PRIu64 "|%-15" PRIu64 "|%-15" PRIu64 + "|%-15" PRIu64 "|%-15" PRIu64 "|%-15.3f|%-15.6f|%-11.4f|\n", - stat->name, calls, objs, stat->realloc_count, objs_per_call, + stat->name, calls, objs, stat->sched_objs, + stat->sched_fail, stat->realloc_count, objs_per_call, objs_per_sec, cycles_per_call); } @@ -331,6 +336,7 @@ static inline void cluster_node_arregate_stats(struct cluster_node *cluster) { uint64_t calls = 0, cycles = 0, objs = 0, realloc_count = 0; + uint64_t sched_objs = 0, sched_fail = 0; struct rte_graph_cluster_node_stats *stat = &cluster->stat; struct rte_node *node; rte_node_t count; @@ -338,6 +344,9 @@ cluster_node_arregate_stats(struct cluster_node *cluster) for (count = 0; count < cluster->nb_nodes; count++) { node = cluster->nodes[count]; + sched_objs += node->total_sched_objs; + sched_fail += node->total_sched_fail; + calls += node->total_calls; objs += node->total_objs; cycles += node->total_cycles; @@ -347,6 +356,8 @@ cluster_node_arregate_stats(struct cluster_node *cluster) stat->calls = calls; stat->objs = objs; stat->cycles = cycles; + stat->sched_objs = sched_objs; + stat->sched_fail = sched_fail; stat->ts = rte_get_timer_cycles(); stat->realloc_count = realloc_count; } diff --git a/lib/graph/rte_graph.h b/lib/graph/rte_graph.h index 27fd1e6cd0..1c929d741a 100644 --- a/lib/graph/rte_graph.h +++ b/lib/graph/rte_graph.h @@ -208,6 +208,9 @@ struct rte_graph_cluster_node_stats { uint64_t objs; /**< Current number of objs processed. */ uint64_t cycles; /**< Current number of cycles. */ + uint64_t sched_objs; + uint64_t sched_fail; + uint64_t prev_ts; /**< Previous call timestamp. */ uint64_t prev_calls; /**< Previous number of calls. */ uint64_t prev_objs; /**< Previous number of processed objs. */ diff --git a/lib/graph/rte_graph_worker.h b/lib/graph/rte_graph_worker.h index e98697d880..51f174c5c1 100644 --- a/lib/graph/rte_graph_worker.h +++ b/lib/graph/rte_graph_worker.h @@ -80,6 +80,9 @@ struct rte_node { /* Fast schedule area */ unsigned int lcore_id __rte_cache_aligned; /**< Node running Lcore. */ + uint64_t total_sched_objs; /**< Number of objects scheduled. */ + uint64_t total_sched_fail; /**< Number of scheduled failure. */ + /* Fast path area */ #define RTE_NODE_CTX_SZ 16 uint8_t ctx[RTE_NODE_CTX_SZ] __rte_cache_aligned; /**< Node Context. */