aboutsummaryrefslogtreecommitdiff
path: root/cli
diff options
context:
space:
mode:
authorAleksander Morgado <aleksander@aleksander.es>2020-03-27 18:01:36 +0100
committerAleksander Morgado <aleksander@aleksander.es>2020-04-10 11:45:03 +0000
commit79daa3099e1f8478b8e17d8065143bca3e38214b (patch)
treec18029edf3c1bef13fd7975041c9fb7146ec9db4 /cli
parentf325ef59020b0acc33b6d05e96c8df7b58373715 (diff)
api,bearer: add 'total-rx-bytes', 'total-tx-bytes' and 'total-duration' stats
Compiling the amount of bytes transferred and received during all tracked connection attempts, as well as the total duration of all the connections.
Diffstat (limited to 'cli')
-rw-r--r--cli/mmcli-bearer.c15
-rw-r--r--cli/mmcli-output.c3
-rw-r--r--cli/mmcli-output.h3
3 files changed, 21 insertions, 0 deletions
diff --git a/cli/mmcli-bearer.c b/cli/mmcli-bearer.c
index 2dfdab35..f3a45bf2 100644
--- a/cli/mmcli-bearer.c
+++ b/cli/mmcli-bearer.c
@@ -250,6 +250,9 @@ print_bearer_info (MMBearer *bearer)
gchar *bytes_tx = NULL;
gchar *attempts = NULL;
gchar *failed_attempts = NULL;
+ gchar *total_duration = NULL;
+ gchar *total_bytes_rx = NULL;
+ gchar *total_bytes_tx = NULL;
if (stats) {
guint64 val;
@@ -269,6 +272,15 @@ print_bearer_info (MMBearer *bearer)
val = mm_bearer_stats_get_failed_attempts (stats);
if (val)
failed_attempts = g_strdup_printf ("%" G_GUINT64_FORMAT, val);
+ val = mm_bearer_stats_get_total_duration (stats);
+ if (val)
+ total_duration = g_strdup_printf ("%" G_GUINT64_FORMAT, val);
+ val = mm_bearer_stats_get_total_rx_bytes (stats);
+ if (val)
+ total_bytes_rx = g_strdup_printf ("%" G_GUINT64_FORMAT, val);
+ val = mm_bearer_stats_get_total_tx_bytes (stats);
+ if (val)
+ total_bytes_tx = g_strdup_printf ("%" G_GUINT64_FORMAT, val);
}
mmcli_output_string_take (MMC_F_BEARER_STATS_DURATION, duration);
@@ -276,6 +288,9 @@ print_bearer_info (MMBearer *bearer)
mmcli_output_string_take (MMC_F_BEARER_STATS_BYTES_TX, bytes_tx);
mmcli_output_string_take (MMC_F_BEARER_STATS_ATTEMPTS, attempts);
mmcli_output_string_take (MMC_F_BEARER_STATS_FAILED_ATTEMPTS, failed_attempts);
+ mmcli_output_string_take (MMC_F_BEARER_STATS_TOTAL_DURATION, total_duration);
+ mmcli_output_string_take (MMC_F_BEARER_STATS_TOTAL_BYTES_RX, total_bytes_rx);
+ mmcli_output_string_take (MMC_F_BEARER_STATS_TOTAL_BYTES_TX, total_bytes_tx);
}
mmcli_output_dump ();
diff --git a/cli/mmcli-output.c b/cli/mmcli-output.c
index 7418fc18..49ebdcdc 100644
--- a/cli/mmcli-output.c
+++ b/cli/mmcli-output.c
@@ -228,6 +228,9 @@ static FieldInfo field_infos[] = {
[MMC_F_BEARER_STATS_BYTES_TX] = { "bearer.stats.bytes-tx", "bytes tx", MMC_S_BEARER_STATS, },
[MMC_F_BEARER_STATS_ATTEMPTS] = { "bearer.stats.attempts", "attempts", MMC_S_BEARER_STATS, },
[MMC_F_BEARER_STATS_FAILED_ATTEMPTS] = { "bearer.stats.failed-attempts", "attempts", MMC_S_BEARER_STATS, },
+ [MMC_F_BEARER_STATS_TOTAL_DURATION] = { "bearer.stats.total-duration", "total-duration", MMC_S_BEARER_STATS, },
+ [MMC_F_BEARER_STATS_TOTAL_BYTES_RX] = { "bearer.stats.total-bytes-rx", "total-bytes rx", MMC_S_BEARER_STATS, },
+ [MMC_F_BEARER_STATS_TOTAL_BYTES_TX] = { "bearer.stats.total-bytes-tx", "total-bytes tx", MMC_S_BEARER_STATS, },
[MMC_F_CALL_GENERAL_DBUS_PATH] = { "call.dbus-path", "dbus path", MMC_S_CALL_GENERAL, },
[MMC_F_CALL_PROPERTIES_NUMBER] = { "call.properties.number", "number", MMC_S_CALL_PROPERTIES, },
[MMC_F_CALL_PROPERTIES_DIRECTION] = { "call.properties.direction", "direction", MMC_S_CALL_PROPERTIES, },
diff --git a/cli/mmcli-output.h b/cli/mmcli-output.h
index 76ca2026..5b9cb5ef 100644
--- a/cli/mmcli-output.h
+++ b/cli/mmcli-output.h
@@ -245,6 +245,9 @@ typedef enum {
MMC_F_BEARER_STATS_BYTES_TX,
MMC_F_BEARER_STATS_ATTEMPTS,
MMC_F_BEARER_STATS_FAILED_ATTEMPTS,
+ MMC_F_BEARER_STATS_TOTAL_DURATION,
+ MMC_F_BEARER_STATS_TOTAL_BYTES_RX,
+ MMC_F_BEARER_STATS_TOTAL_BYTES_TX,
MMC_F_CALL_GENERAL_DBUS_PATH,
MMC_F_CALL_PROPERTIES_NUMBER,
MMC_F_CALL_PROPERTIES_DIRECTION,