Skip to content

Commit

Permalink
Measure timing of ovn-controller flow creation.
Browse files Browse the repository at this point in the history
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

Signed-off-by: Mark Michelson <[email protected]>
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
putnopvut authored and blp committed Apr 3, 2018
1 parent aed45be commit 3d0e6f6
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ovn/controller/ovn-controller.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@
#include "stream.h"
#include "unixctl.h"
#include "util.h"
#include "timeval.h"
#include "timer.h"
#include "stopwatch.h"

VLOG_DEFINE_THIS_MODULE(main);

Expand All @@ -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[]);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand All @@ -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));

Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 3d0e6f6

Please sign in to comment.