ofproto: Report controller rate limiting statistics in database.
[cascardo/ovs.git] / ofproto / pinsched.c
index 5a59a50..351623d 100644 (file)
@@ -295,10 +295,17 @@ pinsched_set_limits(struct pinsched *ps, int rate_limit, int burst_limit)
     }
 }
 
-/* Returns the number of packets scheduled to be sent eventually by 'ps'.
- * Returns 0 if 'ps' is null. */
-unsigned int
-pinsched_count_txqlen(const struct pinsched *ps)
+/* Retrieves statistics for 'ps'.  The statistics will be all zero if 'ps' is
+ * null. */
+void
+pinsched_get_stats(const struct pinsched *ps, struct pinsched_stats *stats)
 {
-    return ps ? ps->n_queued : 0;
+    if (ps) {
+        stats->n_queued = ps->n_queued;
+        stats->n_normal = ps->n_normal;
+        stats->n_limited = ps->n_limited;
+        stats->n_queue_dropped = ps->n_queue_dropped;
+    } else {
+        memset(stats, 0, sizeof *stats);
+    }
 }