Measure timing of ovn-controller flow creation.
This modifies ovn-controller to measure the amount of time it takes to
generate flows.
The statistics can be queried using:
ovs-appctl -t ovn-controller stopwatch/show
ovn-controller-flow-generation
The statistics can be reset using:
ovs-appctl -t ovn-controller stopwatch/reset
ovn-controller-flow-generation
#include "stream.h"
#include "unixctl.h"
#include "util.h"
+#include "timeval.h"
+#include "timer.h"
+#include "stopwatch.h"
VLOG_DEFINE_THIS_MODULE(main);
@@ -67,6 +70,8 @@ static unixctl_cb_func inject_pkt;
#define DEFAULT_BRIDGE_NAME "br-int"
#define DEFAULT_PROBE_INTERVAL_MSEC 5000
+#define CONTROLLER_LOOP_STOPWATCH_NAME "ovn-controller-flow-generation"
+
static void update_probe_interval(struct controller_ctx *,
const char *ovnsb_remote);
static void parse_options(int argc, char *argv[]);
@@ -640,6 +645,7 @@ main(int argc, char *argv[])
unixctl_command_register("inject-pkt", "MICROFLOW", 1, 1, inject_pkt,
&pending_pkt);
+ stopwatch_create(CONTROLLER_LOOP_STOPWATCH_NAME, SW_MS);
/* Main loop. */
exiting = false;
while (!exiting) {
@@ -709,6 +715,9 @@ main(int argc, char *argv[])
ct_zone_bitmap, &pending_ct_zones);
if (ctx.ovs_idl_txn) {
if (ofctrl_can_put()) {
+ stopwatch_start(CONTROLLER_LOOP_STOPWATCH_NAME,
+ time_msec());
+
commit_ct_zones(br_int, &pending_ct_zones);
struct hmap flow_table = HMAP_INITIALIZER(&flow_table);
@@ -726,6 +735,9 @@ main(int argc, char *argv[])
&flow_table, &local_datapaths, &local_lports,
&chassis_index, &active_tunnels);
+ stopwatch_stop(CONTROLLER_LOOP_STOPWATCH_NAME,
+ time_msec());
+
ofctrl_put(&flow_table, &pending_ct_zones,
get_nb_cfg(ctx.ovnsb_idl));
@@ -793,6 +805,7 @@ main(int argc, char *argv[])
ofctrl_wait();
pinctrl_wait(&ctx);
}
+
ovsdb_idl_loop_commit_and_wait(&ovnsb_idl_loop);
if (ovsdb_idl_loop_commit_and_wait(&ovs_idl_loop) == 1) {
