Message ID | 20220624074824.638157-1-dceara@redhat.com |
---|---|
State | Accepted |
Commit | c558f9f1e131e8d97cbf46bfd69aa2880ec4893d |
Headers | show |
Series | [ovs-dev,v2] ovsdb-idl: Get per-database memory usage statistics. | expand |
Context | Check | Description |
---|---|---|
ovsrobot/apply-robot | success | apply and check: success |
ovsrobot/github-robot-_Build_and_Test | success | github build: passed |
ovsrobot/intel-ovs-compilation | success | test: success |
On 6/24/22 09:48, Dumitru Ceara wrote: > Clients might be connected to multiple databases (e.g., ovn-controller > is connected to OVN_Southbound and Open_vSwitch databases) and the IDL > memory statistics are more useful if they're not aggregated. > > Signed-off-by: Dumitru Ceara <dceara@redhat.com> > --- > V2: > - Addressed Ilya's comment and swapped database name and counter name. > --- > lib/ovsdb-idl.c | 17 ++++++++++++++--- > 1 file changed, 14 insertions(+), 3 deletions(-) Applied. Thanks! Best regards, Ilya Maximets.
diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index 6fbc109cda3a..3b874140874c 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -498,9 +498,20 @@ ovsdb_idl_get_memory_usage(struct ovsdb_idl *idl, struct simap *usage) cells += n_rows * n_columns; } - simap_increase(usage, "idl-cells", cells); - simap_increase(usage, "idl-outstanding-txns", - hmap_count(&idl->outstanding_txns)); + struct { + const char *name; + unsigned int val; + } idl_mem_stats[] = { + {"idl-outstanding-txns", hmap_count(&idl->outstanding_txns)}, + {"idl-cells", cells}, + }; + + for (size_t i = 0; i < ARRAY_SIZE(idl_mem_stats); i++) { + char *stat_name = xasprintf("%s-%s", idl_mem_stats[i].name, + idl->class_->database); + simap_increase(usage, stat_name, idl_mem_stats[i].val); + free(stat_name); + } } /* Returns a "sequence number" that represents the state of 'idl'. When
Clients might be connected to multiple databases (e.g., ovn-controller is connected to OVN_Southbound and Open_vSwitch databases) and the IDL memory statistics are more useful if they're not aggregated. Signed-off-by: Dumitru Ceara <dceara@redhat.com> --- V2: - Addressed Ilya's comment and swapped database name and counter name. --- lib/ovsdb-idl.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)