Append received percentage after received/dropped counts.
authorcmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 26 May 2011 20:05:11 +0000 (20:05 +0000)
committercmaynard <cmaynard@f5534014-38df-0310-8fa8-9805f1628bb7>
Thu, 26 May 2011 20:05:11 +0000 (20:05 +0000)
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@37415 f5534014-38df-0310-8fa8-9805f1628bb7

dumpcap.c

index d8e359ebef3e58b454f4d5458f800bc596f40f60..4deb4f1a49f42acdd1a863fde08250309642fc25 100644 (file)
--- 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);
     }