From bf1e8ff9835871eb4927d5a0dbc7af19901d37ce Mon Sep 17 00:00:00 2001 From: Ethan Jackson Date: Sat, 23 Mar 2013 15:11:21 -0700 Subject: [PATCH] ofproto-dpif: Push statistics in rule_get_stats(). As time goes on, and flow tables become more complicated, the tradeoff between keeping up to date statistics, and the CPU resources needed to maintain them, will become more important. Commit 5c0243a (ofproto-dpif: xlate actions once with subfacets.) delayed the reporting of some statistics in an effort to achieve higher flow setup performance. Future commits will continue in the same direction. This patch helps to alleviate the issue, by pushing statistics rule_get_stats(), when users actually want them. Presumably, this happens rarely, and thus will not have a negative impact on ovs-vswitchd performance. Signed-off-by: Ethan Jackson --- ofproto/ofproto-dpif.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ofproto/ofproto-dpif.c b/ofproto/ofproto-dpif.c index 18c5b7dea..b8db91dfd 100644 --- a/ofproto/ofproto-dpif.c +++ b/ofproto/ofproto-dpif.c @@ -5425,9 +5425,14 @@ rule_destruct(struct rule *rule_) static void rule_get_stats(struct rule *rule_, uint64_t *packets, uint64_t *bytes) { + struct ofproto_dpif *ofproto = ofproto_dpif_cast(rule_->ofproto); struct rule_dpif *rule = rule_dpif_cast(rule_); struct facet *facet; + HMAP_FOR_EACH (facet, hmap_node, &ofproto->facets) { + facet_push_stats(facet); + } + /* Start from historical data for 'rule' itself that are no longer tracked * in facets. This counts, for example, facets that have expired. */ *packets = rule->packet_count; -- 2.43.0