diff mbox

[ovs-dev] ovsdb-server: Add Json cache count to memory/show

Message ID 1457466885-15123-1-git-send-email-azhou@ovn.org
State Accepted
Headers show

Commit Message

Andy Zhou March 8, 2016, 7:54 p.m. UTC
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>
---
 ovsdb/monitor.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Ben Pfaff March 11, 2016, 1:50 a.m. UTC | #1
On Tue, Mar 08, 2016 at 11:54:45AM -0800, Andy Zhou wrote:
> 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>
Andy Zhou March 11, 2016, 3:38 a.m. UTC | #2
On Thu, Mar 10, 2016 at 5:50 PM, Ben Pfaff <blp@ovn.org> wrote:

> On Tue, Mar 08, 2016 at 11:54:45AM -0800, Andy Zhou wrote:
> > 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>
>
Thanks. Pushed to master.
diff mbox

Patch

diff --git a/ovsdb/monitor.c b/ovsdb/monitor.c
index 6b0d13d..f9cd965 100644
--- a/ovsdb/monitor.c
+++ b/ovsdb/monitor.c
@@ -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 = {