From 3043718e84e28851f263139dac3b5bfb41ab5136 Mon Sep 17 00:00:00 2001
From: Florian Pose <fp@igh-essen.com>
Date: Tue, 9 Mar 2010 11:43:43 +0100
Subject: [PATCH] Improved frame statistics output again.

---
 tool/CommandMaster.cpp | 25 ++++++++++++++++++-------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/tool/CommandMaster.cpp b/tool/CommandMaster.cpp
index e18c313e..2a406e6b 100644
--- a/tool/CommandMaster.cpp
+++ b/tool/CommandMaster.cpp
@@ -112,6 +112,12 @@ void CommandMaster::execute(const StringVector &args)
                     && data.devices[i].address[5] == 0x00) {
                 cout << "None.";
             } else {
+                unsigned int lost =
+                    data.devices[i].tx_count - data.devices[i].rx_count;
+                if (lost == 1) {
+                    // allow one frame travelling
+                    lost = 0;
+                }
                 cout << hex << setfill('0')
                     << setw(2) << (unsigned int) data.devices[i].address[0]
                     << ":"
@@ -129,10 +135,15 @@ void CommandMaster::execute(const StringVector &args)
                     << ")" << endl << dec
                     << "      Link: "
                     << (data.devices[i].link_state ? "UP" : "DOWN") << endl
-                    << "      Tx count: " << data.devices[i].tx_count << endl
-                    << "      Rx count: " << data.devices[i].rx_count << endl
-                    << "      Tx bytes: " << data.devices[i].tx_bytes << endl
-                    << "      Tx errors: " << data.devices[i].tx_errors << endl
+                    << "      Tx frames:   "
+                    << data.devices[i].tx_count << endl
+                    << "      Rx frames:   "
+                    << data.devices[i].rx_count << endl
+                    << "      Lost frames: " << lost << endl
+                    << "      Tx bytes:    "
+                    << data.devices[i].tx_bytes << endl
+                    << "      Tx errors:   "
+                    << data.devices[i].tx_errors << endl
                     << "      Tx frame rate [1/s]: "
                     << setfill(' ') << setprecision(0) << fixed;
                 for (j = 0; j < EC_RATE_COUNT; j++) {
@@ -144,10 +155,10 @@ void CommandMaster::execute(const StringVector &args)
                 }
                 cout << endl
                     << "      Tx rate [KByte/s]:   "
-                    << setprecision(0) << fixed;
+                    << setprecision(1) << fixed;
                 for (j = 0; j < EC_RATE_COUNT; j++) {
-                    cout <<
-                        setw(5) << data.devices[i].tx_byte_rates[j] / 1000.0;
+                    cout << setw(5)
+                        << data.devices[i].tx_byte_rates[j] / 1024000.0;
                     if (j < EC_RATE_COUNT - 1) {
                         cout << " ";
                     }
-- 
GitLab