aboutsummaryrefslogtreecommitdiff
path: root/cli/mmcli-bearer.c
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2015-11-27 14:30:00 +0100
committerAleksander Morgado <aleksander@aleksander.es>2015-12-07 14:20:54 +0100
commit810e52c6dbdc876c43899f4dfdf7c753a285536f (patch)
treed2dc449fe0d93d00837765ddf91d7d82bbce1f91 /cli/mmcli-bearer.c
parent730123598a22fd176986bb0da455f762be1bcba8 (diff)
cli: print stats if bearer reports them
Diffstat (limited to 'cli/mmcli-bearer.c')
-rw-r--r--cli/mmcli-bearer.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/cli/mmcli-bearer.c b/cli/mmcli-bearer.c
index 96179dad..cd9ecca0 100644
--- a/cli/mmcli-bearer.c
+++ b/cli/mmcli-bearer.c
@@ -135,10 +135,12 @@ print_bearer_info (MMBearer *bearer)
MMBearerIpConfig *ipv4_config;
MMBearerIpConfig *ipv6_config;
MMBearerProperties *properties;
+ MMBearerStats *stats;
ipv4_config = mm_bearer_get_ipv4_config (bearer);
ipv6_config = mm_bearer_get_ipv6_config (bearer);
properties = mm_bearer_get_properties (bearer);
+ stats = mm_bearer_get_stats (bearer);
/* Not the best thing to do, as we may be doing _get() calls twice, but
* easiest to maintain */
@@ -253,6 +255,26 @@ print_bearer_info (MMBearer *bearer)
g_print (" | MTU: '%u'\n", mtu);
}
+ if (stats) {
+ guint64 val;
+
+ g_print (" -------------------------\n"
+ " Stats | Duration: '%u'\n", mm_bearer_stats_get_duration (stats));
+
+ val = mm_bearer_stats_get_rx_bytes (stats);
+ if (val > 0)
+ g_print (" | Bytes received: '%" G_GUINT64_FORMAT "'\n", val);
+ else
+ g_print (" | Bytes received: 'N/A'\n");
+
+ val = mm_bearer_stats_get_tx_bytes (stats);
+ if (val > 0)
+ g_print (" | Bytes transmitted: '%" G_GUINT64_FORMAT "'\n", val);
+ else
+ g_print (" | Bytes transmitted: 'N/A'\n");
+ }
+
+ g_clear_object (&stats);
g_clear_object (&properties);
g_clear_object (&ipv4_config);
g_clear_object (&ipv6_config);