ovs-appctl: dpif/show display bug fix
authorAndy Zhou <azhou@nicira.com>
Thu, 4 Apr 2013 23:35:27 +0000 (16:35 -0700)
committerJustin Pettit <jpettit@nicira.com>
Fri, 29 Mar 2013 16:40:22 +0000 (09:40 -0700)
Fixes a bug where per ofproto moving average stats did not update
when there is no active dp flows.

Reported-by: Justin Pettit <jpettit@nicira.com>
Signed-off-by: Andy Zhou <azhou@nicira.com>
Signed-off-by: Justin Pettit <jpettit@nicira.com>
ofproto/ofproto-dpif.c
tests/ofproto-dpif.at

index 47830c1..8f00424 100644 (file)
@@ -4264,13 +4264,13 @@ update_stats(struct dpif_backer *backer)
     const struct dpif_flow_stats *stats;
     struct dpif_flow_dump dump;
     const struct nlattr *key;
+    struct ofproto_dpif *ofproto;
     size_t key_len;
 
     dpif_flow_dump_start(&dump, backer->dpif);
     while (dpif_flow_dump_next(&dump, &key, &key_len, NULL, NULL, &stats)) {
         struct flow flow;
         struct subfacet *subfacet;
-        struct ofproto_dpif *ofproto;
         struct ofport_dpif *ofport;
         uint32_t key_hash;
 
@@ -4281,7 +4281,6 @@ update_stats(struct dpif_backer *backer)
 
         ofproto->total_subfacet_count += hmap_count(&ofproto->subfacets);
         ofproto->n_update_stats++;
-        update_moving_averages(ofproto);
 
         ofport = get_ofp_port(ofproto, flow.in_port);
         if (ofport && ofport->tnl_port) {
@@ -4313,6 +4312,11 @@ update_stats(struct dpif_backer *backer)
         run_fast_rl();
     }
     dpif_flow_dump_done(&dump);
+
+    HMAP_FOR_EACH (ofproto, all_ofproto_dpifs_node, &all_ofproto_dpifs) {
+        update_moving_averages(ofproto);
+    }
+
 }
 
 /* Calculates and returns the number of milliseconds of idle time after which
index 06ebf23..b1d2f26 100644 (file)
@@ -1937,8 +1937,8 @@ AT_CHECK([ovs-appctl dpif/show | sed 's/ 10[[0-9]]\{3\}(ms)$/ 10000(ms)/'], [0],
 br0 (dummy@ovs-dummy):
        lookups: hit:0 missed:61
        flows: cur: 0, avg: 1.000, max: 1, life span: 10000(ms)
-               hourly avg: add rate: 0.641/min, del rate: 0.635/min
-               overall avg: add rate: 1.000/min, del rate: 0.984/min
+               hourly avg: add rate: 0.641/min, del rate: 0.641/min
+               overall avg: add rate: 1.000/min, del rate: 1.000/min
        br0 65534/100: (dummy)
        p1 1/1: (dummy)
        p2 2/2: (dummy)