From patchwork Tue Nov 22 03:49:35 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Numan Siddique X-Patchwork-Id: 1707638 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=2605:bc80:3010::133; helo=smtp2.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Received: from smtp2.osuosl.org (smtp2.osuosl.org [IPv6:2605:bc80:3010::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NGVdG4xWSz23nR for ; Tue, 22 Nov 2022 14:49:54 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by smtp2.osuosl.org (Postfix) with ESMTP id B3867405F8; Tue, 22 Nov 2022 03:49:52 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org B3867405F8 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp2.osuosl.org ([127.0.0.1]) by localhost (smtp2.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 3mvCdKsEuVVS; Tue, 22 Nov 2022 03:49:51 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp2.osuosl.org (Postfix) with ESMTPS id D80B3404F4; Tue, 22 Nov 2022 03:49:50 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp2.osuosl.org D80B3404F4 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id B13E7C0032; Tue, 22 Nov 2022 03:49:50 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by lists.linuxfoundation.org (Postfix) with ESMTP id 178E3C002D for ; Tue, 22 Nov 2022 03:49:50 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 68F0B81E11 for ; Tue, 22 Nov 2022 03:49:49 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 68F0B81E11 X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id SexcCO2STCKd for ; Tue, 22 Nov 2022 03:49:48 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 61F518187F Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [IPv6:2001:4b98:dc4:8::228]) by smtp1.osuosl.org (Postfix) with ESMTPS id 61F518187F for ; Tue, 22 Nov 2022 03:49:48 +0000 (UTC) Received: (Authenticated sender: numans@ovn.org) by mail.gandi.net (Postfix) with ESMTPSA id B79341BF204; Tue, 22 Nov 2022 03:49:45 +0000 (UTC) From: numans@ovn.org To: dev@openvswitch.org Date: Mon, 21 Nov 2022 22:49:35 -0500 Message-Id: <20221122034935.1973847-1-numans@ovn.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221122034908.1973726-1-numans@ovn.org> References: <20221122034908.1973726-1-numans@ovn.org> MIME-Version: 1.0 Subject: [ovs-dev] [PATCH ovn v4 1/3] Enhance the unixctl command inc-engine/show-stats X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" From: Numan Siddique Enhance the command to specify the engine node name and engine stat type - recompute, compute or abort. Also updates the documentation. Signed-off-by: Numan Siddique Acked-by: Han Zhou --- controller/ovn-controller.8.xml | 10 +++++++ lib/inc-proc-eng.c | 49 +++++++++++++++++++++++++-------- northd/ovn-northd.8.xml | 34 +++++++++++++++++++++++ 3 files changed, 82 insertions(+), 11 deletions(-) diff --git a/controller/ovn-controller.8.xml b/controller/ovn-controller.8.xml index eb2950723..af70f9e36 100644 --- a/controller/ovn-controller.8.xml +++ b/controller/ovn-controller.8.xml @@ -716,6 +716,16 @@ +
inc-engine/show-stats engine_node_name counter_name
+
+

+ Display the ovn-controller engine counter(s) for the + specified engine_node_name. counter_name is + optional and can be one of recompute, + compute or abort. +

+
+
inc-engine/clear-stats
Reset ovn-controller engine counters. diff --git a/lib/inc-proc-eng.c b/lib/inc-proc-eng.c index 2e2b31033..21afcf92b 100644 --- a/lib/inc-proc-eng.c +++ b/lib/inc-proc-eng.c @@ -124,23 +124,50 @@ engine_clear_stats(struct unixctl_conn *conn, int argc OVS_UNUSED, } static void -engine_dump_stats(struct unixctl_conn *conn, int argc OVS_UNUSED, - const char *argv[] OVS_UNUSED, void *arg OVS_UNUSED) +engine_dump_stats(struct unixctl_conn *conn, int argc, + const char *argv[], void *arg OVS_UNUSED) { struct ds dump = DS_EMPTY_INITIALIZER; + const char *dump_eng_node_name = (argc > 1 ? argv[1] : NULL); + const char *dump_stat_type = (argc > 2 ? argv[2] : NULL); + bool success = true; for (size_t i = 0; i < engine_n_nodes; i++) { struct engine_node *node = engine_nodes[i]; - ds_put_format(&dump, - "Node: %s\n" - "- recompute: %12"PRIu64"\n" - "- compute: %12"PRIu64"\n" - "- abort: %12"PRIu64"\n", - node->name, node->stats.recompute, - node->stats.compute, node->stats.abort); + if (dump_eng_node_name && strcmp(node->name, dump_eng_node_name)) { + continue; + } + + if (!dump_stat_type) { + ds_put_format(&dump, + "Node: %s\n" + "- recompute: %12"PRIu64"\n" + "- compute: %12"PRIu64"\n" + "- abort: %12"PRIu64"\n", + node->name, node->stats.recompute, + node->stats.compute, node->stats.abort); + } else { + if (!strcmp(dump_stat_type, "recompute")) { + ds_put_format(&dump, "%"PRIu64, node->stats.recompute); + } else if (!strcmp(dump_stat_type, "compute")) { + ds_put_format(&dump, "%"PRIu64, node->stats.compute); + } else if (!strcmp(dump_stat_type, "abort")) { + ds_put_format(&dump, "%"PRIu64, node->stats.abort); + } else { + ds_put_format(&dump, "Invalid stat type : %s", dump_stat_type); + } + } + + if (dump_eng_node_name) { + break; + } + } + if (success) { + unixctl_command_reply(conn, ds_cstr(&dump)); + } else { + unixctl_command_reply_error(conn, "Invalid stat type"); } - unixctl_command_reply(conn, ds_cstr(&dump)); ds_destroy(&dump); } @@ -182,7 +209,7 @@ engine_init(struct engine_node *node, struct engine_arg *arg) } } - unixctl_command_register("inc-engine/show-stats", "", 0, 0, + unixctl_command_register("inc-engine/show-stats", "", 0, 2, engine_dump_stats, NULL); unixctl_command_register("inc-engine/clear-stats", "", 0, 0, engine_clear_stats, NULL); diff --git a/northd/ovn-northd.8.xml b/northd/ovn-northd.8.xml index 4b712cec4..e25993bdb 100644 --- a/northd/ovn-northd.8.xml +++ b/northd/ovn-northd.8.xml @@ -204,6 +204,40 @@

+
inc-engine/show-stats
+
+

+ Display ovn-northd engine counters. For each engine + node the following counters have been added: +

    +
  • + recompute +
  • +
  • + compute +
  • +
  • + abort +
  • +
+

+
+ +
inc-engine/show-stats engine_node_name counter_name
+
+

+ Display the ovn-northd engine counter(s) for the specified + engine_node_name. counter_name is optional and + can be one of recompute, compute or + abort. +

+
+ +
inc-engine/clear-stats
+
+

Reset ovn-northd engine counters.

+
+