Message ID | 20221122034935.1973847-1-numans@ovn.org |
---|---|
State | Accepted |
Headers | show |
Series | northd IP for address sets | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | warning | apply and check: warning |
ovsrobot/github-robot-_Build_and_Test | fail | github build: failed |
ovsrobot/github-robot-_ovn-kubernetes | fail | github build: failed |
Bleep bloop. Greetings Numan Siddique, I am a robot and I have tried out your patch. Thanks for your contribution. I encountered some error that I wasn't expecting. See the details below. checkpatch: WARNING: Line is 101 characters long (recommended limit is 79) #26 FILE: controller/ovn-controller.8.xml:719: <dt><code>inc-engine/show-stats <var>engine_node_name</var> <var>counter_name</var></code></dt> WARNING: Line is 101 characters long (recommended limit is 79) #140 FILE: northd/ovn-northd.8.xml:226: <dt><code>inc-engine/show-stats <var>engine_node_name</var> <var>counter_name</var></code></dt> Lines checked: 161, Warnings: 2, Errors: 0 Please check this out. If you feel there has been an error, please email aconole@redhat.com Thanks, 0-day Robot
On Mon, Nov 21, 2022 at 7:50 PM <numans@ovn.org> wrote: > > From: Numan Siddique <numans@ovn.org> > > 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 <numans@ovn.org> > --- > 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 @@ > </ul> > </dd> > > + <dt><code>inc-engine/show-stats <var>engine_node_name</var> <var>counter_name</var></code></dt> > + <dd> > + <p> > + Display the <code>ovn-controller</code> engine counter(s) for the > + specified <var>engine_node_name</var>. <var>counter_name</var> is > + optional and can be one of <code>recompute</code>, > + <code>compute</code> or <code>abort</code>. > + </p> > + </dd> > + > <dt><code>inc-engine/clear-stats</code></dt> > <dd> > Reset <code>ovn-controller</code> 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 @@ > </p> > </dd> > > + <dt><code>inc-engine/show-stats</code></dt> > + <dd> > + <p> > + Display <code>ovn-northd</code> engine counters. For each engine > + node the following counters have been added: > + <ul> > + <li> > + <code>recompute</code> > + </li> > + <li> > + <code>compute</code> > + </li> > + <li> > + <code>abort</code> > + </li> > + </ul> > + </p> > + </dd> > + > + <dt><code>inc-engine/show-stats <var>engine_node_name</var> <var>counter_name</var></code></dt> > + <dd> > + <p> > + Display the <code>ovn-northd</code> engine counter(s) for the specified > + <var>engine_node_name</var>. <var>counter_name</var> is optional and > + can be one of <code>recompute</code>, <code>compute</code> or > + <code>abort</code>. > + </p> > + </dd> > + > + <dt><code>inc-engine/clear-stats</code></dt> > + <dd> > + <p> Reset <code>ovn-northd</code> engine counters. </p> > + </dd> > + > </dl> > </p> > > -- > 2.38.1 > > _______________________________________________ > dev mailing list > dev@openvswitch.org > https://mail.openvswitch.org/mailman/listinfo/ovs-dev Acked-by: Han Zhou <hzhou@ovn.org>
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 @@ </ul> </dd> + <dt><code>inc-engine/show-stats <var>engine_node_name</var> <var>counter_name</var></code></dt> + <dd> + <p> + Display the <code>ovn-controller</code> engine counter(s) for the + specified <var>engine_node_name</var>. <var>counter_name</var> is + optional and can be one of <code>recompute</code>, + <code>compute</code> or <code>abort</code>. + </p> + </dd> + <dt><code>inc-engine/clear-stats</code></dt> <dd> Reset <code>ovn-controller</code> 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 @@ </p> </dd> + <dt><code>inc-engine/show-stats</code></dt> + <dd> + <p> + Display <code>ovn-northd</code> engine counters. For each engine + node the following counters have been added: + <ul> + <li> + <code>recompute</code> + </li> + <li> + <code>compute</code> + </li> + <li> + <code>abort</code> + </li> + </ul> + </p> + </dd> + + <dt><code>inc-engine/show-stats <var>engine_node_name</var> <var>counter_name</var></code></dt> + <dd> + <p> + Display the <code>ovn-northd</code> engine counter(s) for the specified + <var>engine_node_name</var>. <var>counter_name</var> is optional and + can be one of <code>recompute</code>, <code>compute</code> or + <code>abort</code>. + </p> + </dd> + + <dt><code>inc-engine/clear-stats</code></dt> + <dd> + <p> Reset <code>ovn-northd</code> engine counters. </p> + </dd> + </dl> </p>