summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Kozlov <xeb@mail.ru>2015-11-30 14:06:07 +0300
committerDmitry Kozlov <xeb@mail.ru>2015-11-30 14:06:07 +0300
commit504e7b995913956f71fe76c93e439df63701c0b3 (patch)
tree1689d8b05dcc60a36180174c930877f802e8b53a
parentadcaecd1b4d27ad30d35fd0cff4999029f3acffb (diff)
downloadaccel-ppp-504e7b995913956f71fe76c93e439df63701c0b3.tar.gz
accel-ppp-504e7b995913956f71fe76c93e439df63701c0b3.zip
cli: show sesisons: introduced rx-bytes-raw,tx-bytes-raw fields
-rw-r--r--accel-pppd/cli/show_sessions.c28
1 files changed, 24 insertions, 4 deletions
diff --git a/accel-pppd/cli/show_sessions.c b/accel-pppd/cli/show_sessions.c
index d64a6b56..fd2f2b43 100644
--- a/accel-pppd/cli/show_sessions.c
+++ b/accel-pppd/cli/show_sessions.c
@@ -476,7 +476,7 @@ static void format_bytes(char *buf, unsigned long long bytes)
double d;
if (bytes < 1024) {
- sprintf(buf, "%u (%u B)", (unsigned)bytes, (unsigned)bytes);
+ sprintf(buf, "%u B", (unsigned)bytes);
return;
}
@@ -492,7 +492,7 @@ static void format_bytes(char *buf, unsigned long long bytes)
}
d = (double)bytes/m;
- sprintf(buf, "%llu (%.1f %s)", bytes, d, suffix);
+ sprintf(buf, "%.1f %s", d, suffix);
}
static void print_rx_bytes(struct ap_session *ses, char *buf)
@@ -513,6 +513,24 @@ static void print_tx_bytes(struct ap_session *ses, char *buf)
format_bytes(buf, 4294967296ll*ses->acct_output_gigawords + stats.tx_bytes);
}
+static void print_rx_bytes_raw(struct ap_session *ses, char *buf)
+{
+ if (!stats_set) {
+ ap_session_read_stats(ses, &stats);
+ stats_set = 1;
+ }
+ sprintf(buf, "%llu", 4294967296ll*ses->acct_input_gigawords + stats.rx_bytes);
+}
+
+static void print_tx_bytes_raw(struct ap_session *ses, char *buf)
+{
+ if (!stats_set) {
+ ap_session_read_stats(ses, &stats);
+ stats_set = 1;
+ }
+ sprintf(buf, "%llu", 4294967296ll*ses->acct_output_gigawords + stats.tx_bytes);
+}
+
static void print_rx_pkts(struct ap_session *ses, char *buf)
{
if (!stats_set) {
@@ -568,8 +586,10 @@ static void init(void)
cli_show_ses_register("called-sid", "called station id", print_called_sid);
cli_show_ses_register("sid", "session id", print_sid);
cli_show_ses_register("comp", "compression/ecnryption method", print_comp);
- cli_show_ses_register("rx-bytes", "received bytes", print_rx_bytes);
- cli_show_ses_register("tx-bytes", "transmitted bytes", print_tx_bytes);
+ cli_show_ses_register("rx-bytes", "received bytes (human readable)", print_rx_bytes);
+ cli_show_ses_register("tx-bytes", "transmitted bytes (human readable)", print_tx_bytes);
+ cli_show_ses_register("rx-bytes-raw", "received bytes", print_rx_bytes_raw);
+ cli_show_ses_register("tx-bytes-raw", "transmitted bytes", print_tx_bytes_raw);
cli_show_ses_register("rx-pkts", "received packets", print_rx_pkts);
cli_show_ses_register("tx-pkts", "transmitted packets", print_tx_pkts);