ovsdb-server: Add Json cache count to memory/show
authorAndy Zhou <azhou@ovn.org>
Tue, 8 Mar 2016 19:54:45 +0000 (11:54 -0800)
committerAndy Zhou <azhou@ovn.org>
Fri, 11 Mar 2016 03:07:31 +0000 (19:07 -0800)
Add the size of json cache to the data reported by ovsdb-server appctl
"memory/show" command.

Signed-off-by: Andy Zhou <azhou@ovn.org>
Acked-by: Ben Pfaff <blp@ovn.org>
ovsdb/monitor.c

index 6b0d13d..f9cd965 100644 (file)
@@ -1170,7 +1170,12 @@ ovsdb_monitor_destroy_callback(struct ovsdb_replica *replica)
 void
 ovsdb_monitor_get_memory_usage(struct simap *usage)
 {
+    struct ovsdb_monitor *dbmon;
     simap_put(usage, "monitors", hmap_count(&ovsdb_monitors));
+
+    HMAP_FOR_EACH(dbmon, hmap_node,  &ovsdb_monitors) {
+        simap_increase(usage, "json-caches", hmap_count(&dbmon->json_cache));
+    }
 }
 
 static const struct ovsdb_replica_class ovsdb_jsonrpc_replica_class = {