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
+ Display the inc-engine/show-stats engine_node_name counter_name
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
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.