Improved frame statistics output again.
authorFlorian Pose <fp@igh-essen.com>
Tue, 09 Mar 2010 11:43:43 +0100
changeset 1858 4d4aa4c0fc1e
parent 1857 ed8b490b5bc3
child 1859 ef4b7cc5c6f8
Improved frame statistics output again.
tool/CommandMaster.cpp
--- a/tool/CommandMaster.cpp	Tue Mar 09 10:22:32 2010 +0100
+++ b/tool/CommandMaster.cpp	Tue Mar 09 11:43:43 2010 +0100
@@ -112,6 +112,12 @@
                     && 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 @@
                     << ")" << 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 @@
                 }
                 cout << endl
                     << "      Tx rate [KByte/s]:   "
-                    << setprecision(0) << fixed;
-                for (j = 0; j < EC_RATE_COUNT; j++) {
-                    cout <<
-                        setw(5) << data.devices[i].tx_byte_rates[j] / 1000.0;
+                    << setprecision(1) << fixed;
+                for (j = 0; j < EC_RATE_COUNT; j++) {
+                    cout << setw(5)
+                        << data.devices[i].tx_byte_rates[j] / 1024000.0;
                     if (j < EC_RATE_COUNT - 1) {
                         cout << " ";
                     }