aboutsummaryrefslogtreecommitdiffstats
path: root/dumpcap.c
diff options
context:
space:
mode:
authorcmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7>2011-05-26 20:05:11 +0000
committercmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7>2011-05-26 20:05:11 +0000
commit62756490f2e1df4e646971499c5f198b9dedd429 (patch)
tree7221f01899adaa1a16df7446a9ccd2b53ca0936b /dumpcap.c
parent63724c81869f8f3925a200f3cda23f82be6ae432 (diff)
Append received percentage after received/dropped counts.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37415 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'dumpcap.c')
-rw-r--r--dumpcap.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/dumpcap.c b/dumpcap.c
index d8e359ebef..4deb4f1a49 100644
--- a/dumpcap.c
+++ b/dumpcap.c
@@ -4436,18 +4436,21 @@ report_capture_error(const char *error_msg, const char *secondary_error_msg)
static void
report_packet_drops(guint32 received, guint32 drops, gchar *name)
{
- char tmp1[SP_DECISIZE+1+1];
- char tmp2[SP_DECISIZE+1+1];
+ char tmp[SP_DECISIZE+1+1];
- g_snprintf(tmp1, sizeof(tmp1), "%u", received);
- g_snprintf(tmp2, sizeof(tmp2), "%u", drops);
+ g_snprintf(tmp, sizeof(tmp), "%u", drops);
if(capture_child) {
- g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG, "Packets received/dropped on interface %s: %s/%s", name, tmp1, tmp2);
+ g_log(LOG_DOMAIN_CAPTURE_CHILD, G_LOG_LEVEL_DEBUG,
+ "Packets received/dropped on interface %s: %u/%u",
+ name, received, drops);
/* XXX: Need to provide interface id, changes to consumers required. */
- pipe_write_block(2, SP_DROPS, tmp2);
+ pipe_write_block(2, SP_DROPS, tmp);
} else {
- fprintf(stderr, "Packets received/dropped on interface %s: %s/%s\n", name, tmp1, tmp2);
+ fprintf(stderr,
+ "Packets received/dropped on interface %s: %u/%u (%.1f%%)\n",
+ name, received, drops,
+ received ? 100.0 * received / (received + drops) : 0.0);
/* stderr could be line buffered */
fflush(stderr);
}