pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/29471 )


Change subject: vty: show per-connection Osmux VTY stats
......................................................................

vty: show per-connection Osmux VTY stats

Related: SYS#5987
Change-Id: Ieab6dcbd195c8e01a73a2a832bce78ee015ae1c3
---
M include/osmocom/mgcp/osmux.h
M src/libosmo-mgcp/mgcp_osmux.c
M src/libosmo-mgcp/mgcp_vty.c
3 files changed, 35 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/71/29471/1

diff --git a/include/osmocom/mgcp/osmux.h b/include/osmocom/mgcp/osmux.h
index 1a99e6d..58d9095 100644
--- a/include/osmocom/mgcp/osmux.h
+++ b/include/osmocom/mgcp/osmux.h
@@ -34,6 +34,10 @@
        OSMUX_STATE_ENABLED,      /* Osmux was initialized by \ref 
osmux_enable_endpoint and can process frames */
 };

+extern const struct value_string osmux_state_strs[];
+static inline const char *osmux_state_str(enum osmux_state val)
+{ return get_value_string(osmux_state_strs, val); }
+
 enum osmux_usage {
        OSMUX_USAGE_OFF = 0,
        OSMUX_USAGE_ON = 1,
diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index 6ae0d8e..65783f3 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -41,6 +41,13 @@
        int refcnt;
 };

+const struct value_string osmux_state_strs[] = {
+       { OSMUX_STATE_DISABLED,         "disabled" },
+       { OSMUX_STATE_ACTIVATING,       "activating" },
+       { OSMUX_STATE_ENABLED,          "enabled" },
+       { 0, NULL }
+};
+
 static const struct rate_ctr_group_desc rate_ctr_group_osmux_desc = {
        .group_name_prefix = "conn_osmux",
        .group_description = "Osmux connection statistics",
diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 34c2d4b..1bf8789 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -197,6 +197,30 @@
                VTY_NEWLINE, end->fmtp_extra, codec->audio_name,
                codec->subtype_name, VTY_NEWLINE, end->output_enabled,
                end->force_output_ptime, VTY_NEWLINE);
+       if (mgcp_conn_rtp_is_osmux(conn)) {
+               struct rate_ctr *rx_chunks, *rx_octets, *rtp_tx, 
*rtp_tx_dropped, *octets_tx;
+               rx_chunks = rate_ctr_group_get_ctr(conn->osmux.ctrg, 
OSMUX_CHUNKS_RX_CTR);
+               rx_octets = rate_ctr_group_get_ctr(conn->osmux.ctrg, 
OSMUX_OCTETS_RX_CTR);
+               rtp_tx = rate_ctr_group_get_ctr(conn->osmux.ctrg, 
OSMUX_RTP_PACKETS_TX_CTR);
+               rtp_tx_dropped =  rate_ctr_group_get_ctr(conn->osmux.ctrg, 
OSMUX_RTP_PACKETS_TX_DROPPED_CTR);
+               octets_tx = rate_ctr_group_get_ctr(conn->osmux.ctrg, 
OSMUX_AMR_OCTETS_TX_CTR);
+               vty_out(vty,
+               "   Osmux:%s"
+               "    State: %s%s"
+               "    Local CID: %d%s"
+               "    Remote CID: %d%s"
+               "    Chunks received: %" PRIu64 " (%" PRIu64 " bytes total)%s"
+               "    RTP Packets encoded (Tx): %" PRIu64 " (%" PRIu64 " AMR 
octets total)%s"
+               "    AMR payloads Dropped (Tx): %" PRIu64 "%s",
+               VTY_NEWLINE, osmux_state_str(conn->osmux.state), VTY_NEWLINE,
+               conn->osmux.local_cid_allocated ? conn->osmux.local_cid : -1, 
VTY_NEWLINE,
+               conn->osmux.remote_cid_present ? conn->osmux.remote_cid : -1, 
VTY_NEWLINE,
+               rx_chunks->current, rx_octets->current, VTY_NEWLINE,
+               rtp_tx->current, octets_tx->current, VTY_NEWLINE,
+               rtp_tx_dropped->current, VTY_NEWLINE
+               );
+
+       }
 }

 static void dump_endpoint(struct vty *vty, struct mgcp_endpoint *endp,

--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29471
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: Ieab6dcbd195c8e01a73a2a832bce78ee015ae1c3
Gerrit-Change-Number: 29471
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to