mirror of
https://gitea.osmocom.org/cellular-infrastructure/osmo-mgw.git
synced 2025-10-23 08:12:01 +00:00
stat+vty: fix printing of rate counter values
When creating the mgcp statistics (DLCX) and also when printing values in the VTY. The printf placeholder %lu is used. However, this is not portable when the same code is compiled on a machine with different integer size (e.g. armv7). - Use PRIu64 when printing ->current value of the rate counters Change-Id: Ifb8944cec83868845f74ad84551eb090f812daf8
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <osmocom/mgcp/mgcp_stat.h>
|
||||
#include <osmocom/mgcp/mgcp_endp.h>
|
||||
#include <limits.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
/* Helper function for mgcp_format_stats_rtp() to calculate packet loss */
|
||||
void calc_loss(struct mgcp_conn_rtp *conn, uint32_t *expected, int *loss)
|
||||
@@ -80,7 +81,7 @@ static void mgcp_format_stats_rtp(char *str, size_t str_len,
|
||||
jitter = calc_jitter(&conn->state);
|
||||
|
||||
nchars = snprintf(str, str_len,
|
||||
"\r\nP: PS=%lu, OS=%lu, PR=%lu, OR=%lu, PL=%d, JI=%u",
|
||||
"\r\nP: PS=%" PRIu64 ", OS=%" PRIu64 ", PR=%" PRIu64 ", OR=%" PRIu64 ", PL=%d, JI=%u",
|
||||
packets_tx->current, octets_tx->current,
|
||||
packets_rx->current, octets_rx->current,
|
||||
ploss, jitter);
|
||||
@@ -93,7 +94,7 @@ static void mgcp_format_stats_rtp(char *str, size_t str_len,
|
||||
if (conn->conn->endp->cfg->osmux != OSMUX_USAGE_OFF) {
|
||||
/* Error Counter */
|
||||
nchars = snprintf(str, str_len,
|
||||
"\r\nX-Osmo-CP: EC TI=%lu, TO=%lu",
|
||||
"\r\nX-Osmo-CP: EC TI=%" PRIu64 ", TO=%" PRIu64,
|
||||
conn->state.in_stream.err_ts_ctr->current,
|
||||
conn->state.out_stream.err_ts_ctr->current);
|
||||
if (nchars < 0 || nchars >= str_len)
|
||||
|
@@ -30,6 +30,7 @@
|
||||
#include <osmocom/mgcp/mgcp_endp.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <inttypes.h>
|
||||
|
||||
#define RTCP_OMIT_STR "Drop RTCP packets in both directions\n"
|
||||
#define RTP_PATCH_STR "Modify RTP packet header in both directions\n"
|
||||
@@ -164,8 +165,8 @@ static void dump_rtp_end(struct vty *vty, struct mgcp_conn_rtp *conn)
|
||||
dropped_packets = &conn->rate_ctr_group->ctr[RTP_DROPPED_PACKETS_CTR];
|
||||
|
||||
vty_out(vty,
|
||||
" Timestamp Errs: %lu->%lu%s"
|
||||
" Dropped Packets: %lu%s"
|
||||
" Timestamp Errs: %" PRIu64 "->%" PRIu64 "%s"
|
||||
" Dropped Packets: %" PRIu64 "%s"
|
||||
" Payload Type: %d Rate: %u Channels: %d %s"
|
||||
" Frame Duration: %u Frame Denominator: %u%s"
|
||||
" FPP: %d Packet Duration: %u%s"
|
||||
|
Reference in New Issue
Block a user