tool/CommandMaster.cpp
branchredundancy
changeset 2158 69f2b2702336
parent 2156 71425e6120d8
child 2421 bc2d4bf9cbe5
--- a/tool/CommandMaster.cpp	Wed Nov 09 12:58:09 2011 +0100
+++ b/tool/CommandMaster.cpp	Wed Nov 09 14:53:33 2011 +0100
@@ -114,12 +114,6 @@
                     && 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]
                     << ":"
@@ -139,11 +133,12 @@
                     << (data.devices[i].link_state ? "UP" : "DOWN") << endl
                     << "      Tx frames:   "
                     << data.devices[i].tx_count << endl
+                    << "      Tx bytes:    "
+                    << data.devices[i].tx_bytes << endl
                     << "      Rx frames:   "
                     << data.devices[i].rx_count << endl
-                    << "      Lost frames: " << lost << endl
-                    << "      Tx bytes:    "
-                    << data.devices[i].tx_bytes << endl
+                    << "      Rx bytes:    "
+                    << data.devices[i].rx_bytes << endl
                     << "      Tx errors:   "
                     << data.devices[i].tx_errors << endl
                     << "      Tx frame rate [1/s]: "
@@ -166,33 +161,106 @@
                     }
                 }
                 cout << endl
-                    << "      Loss rate [1/s]:     "
-                    << setprecision(0) << fixed;
-                for (j = 0; j < EC_RATE_COUNT; j++) {
-                    cout << setw(ColWidth)
-                        << data.devices[i].loss_rates[j] / 1000.0;
+                    << "      Rx frame rate [1/s]: "
+                    << setfill(' ') << setprecision(0) << fixed;
+                for (j = 0; j < EC_RATE_COUNT; j++) {
+                    cout << setw(ColWidth)
+                        << data.devices[i].rx_frame_rates[j] / 1000.0;
                     if (j < EC_RATE_COUNT - 1) {
                         cout << " ";
                     }
                 }
                 cout << endl
-                    << "      Frame loss [%]:      "
+                    << "      Rx rate [KByte/s]:   "
                     << setprecision(1) << fixed;
                 for (j = 0; j < EC_RATE_COUNT; j++) {
-                    double perc = 0.0;
-                    if (data.devices[i].tx_frame_rates[j]) {
-                        perc = 100.0 * data.devices[i].loss_rates[j] /
-                            data.devices[i].tx_frame_rates[j];
-                    }
-                    cout << setw(ColWidth) << perc;
+                    cout << setw(ColWidth)
+                        << data.devices[i].rx_byte_rates[j] / 1024.0;
                     if (j < EC_RATE_COUNT - 1) {
                         cout << " ";
                     }
                 }
                 cout << setprecision(0) << endl;
             }
-            cout << endl;
-        }
+        }
+        unsigned int lost = data.tx_count - data.rx_count;
+        if (lost == 1) {
+            // allow one frame travelling
+            lost = 0;
+        }
+        cout << "    Common:" << endl
+            << "      Tx frames:   "
+            << data.tx_count << endl
+            << "      Tx bytes:    "
+            << data.tx_bytes << endl
+            << "      Rx frames:   "
+            << data.rx_count << endl
+            << "      Rx bytes:    "
+            << data.rx_bytes << endl
+            << "      Lost frames: " << lost << endl
+            << "      Tx frame rate [1/s]: "
+            << setfill(' ') << setprecision(0) << fixed;
+        for (j = 0; j < EC_RATE_COUNT; j++) {
+            cout << setw(ColWidth)
+                << data.tx_frame_rates[j] / 1000.0;
+            if (j < EC_RATE_COUNT - 1) {
+                cout << " ";
+            }
+        }
+        cout << endl
+            << "      Tx rate [KByte/s]:   "
+            << setprecision(1) << fixed;
+        for (j = 0; j < EC_RATE_COUNT; j++) {
+            cout << setw(ColWidth)
+                << data.tx_byte_rates[j] / 1024.0;
+            if (j < EC_RATE_COUNT - 1) {
+                cout << " ";
+            }
+        }
+        cout << endl
+            << "      Rx frame rate [1/s]: "
+            << setfill(' ') << setprecision(0) << fixed;
+        for (j = 0; j < EC_RATE_COUNT; j++) {
+            cout << setw(ColWidth)
+                << data.rx_frame_rates[j] / 1000.0;
+            if (j < EC_RATE_COUNT - 1) {
+                cout << " ";
+            }
+        }
+        cout << endl
+            << "      Rx rate [KByte/s]:   "
+            << setprecision(1) << fixed;
+        for (j = 0; j < EC_RATE_COUNT; j++) {
+            cout << setw(ColWidth)
+                << data.rx_byte_rates[j] / 1024.0;
+            if (j < EC_RATE_COUNT - 1) {
+                cout << " ";
+            }
+        }
+        cout << endl
+            << "      Loss rate [1/s]:     "
+            << setprecision(0) << fixed;
+        for (j = 0; j < EC_RATE_COUNT; j++) {
+            cout << setw(ColWidth)
+                << data.loss_rates[j] / 1000.0;
+            if (j < EC_RATE_COUNT - 1) {
+                cout << " ";
+            }
+        }
+        cout << endl
+            << "      Frame loss [%]:      "
+            << setprecision(1) << fixed;
+        for (j = 0; j < EC_RATE_COUNT; j++) {
+            double perc = 0.0;
+            if (data.tx_frame_rates[j]) {
+                perc = 100.0 * data.loss_rates[j] / data.tx_frame_rates[j];
+            }
+            cout << setw(ColWidth) << perc;
+            if (j < EC_RATE_COUNT - 1) {
+                cout << " ";
+            }
+        }
+        cout << setprecision(0) << endl;
 
         cout << "  Distributed clocks:" << endl
             << "    Reference clock: ";