tool/CommandMaster.cpp
changeset 1858 4d4aa4c0fc1e
parent 1857 ed8b490b5bc3
child 1869 14f634f5b613
equal deleted inserted replaced
1857:ed8b490b5bc3 1858:4d4aa4c0fc1e
   110                     && data.devices[i].address[3] == 0x00
   110                     && data.devices[i].address[3] == 0x00
   111                     && data.devices[i].address[4] == 0x00
   111                     && data.devices[i].address[4] == 0x00
   112                     && data.devices[i].address[5] == 0x00) {
   112                     && data.devices[i].address[5] == 0x00) {
   113                 cout << "None.";
   113                 cout << "None.";
   114             } else {
   114             } else {
       
   115                 unsigned int lost =
       
   116                     data.devices[i].tx_count - data.devices[i].rx_count;
       
   117                 if (lost == 1) {
       
   118                     // allow one frame travelling
       
   119                     lost = 0;
       
   120                 }
   115                 cout << hex << setfill('0')
   121                 cout << hex << setfill('0')
   116                     << setw(2) << (unsigned int) data.devices[i].address[0]
   122                     << setw(2) << (unsigned int) data.devices[i].address[0]
   117                     << ":"
   123                     << ":"
   118                     << setw(2) << (unsigned int) data.devices[i].address[1]
   124                     << setw(2) << (unsigned int) data.devices[i].address[1]
   119                     << ":"
   125                     << ":"
   127                     << " ("
   133                     << " ("
   128                     << (data.devices[i].attached ? "attached" : "waiting...")
   134                     << (data.devices[i].attached ? "attached" : "waiting...")
   129                     << ")" << endl << dec
   135                     << ")" << endl << dec
   130                     << "      Link: "
   136                     << "      Link: "
   131                     << (data.devices[i].link_state ? "UP" : "DOWN") << endl
   137                     << (data.devices[i].link_state ? "UP" : "DOWN") << endl
   132                     << "      Tx count: " << data.devices[i].tx_count << endl
   138                     << "      Tx frames:   "
   133                     << "      Rx count: " << data.devices[i].rx_count << endl
   139                     << data.devices[i].tx_count << endl
   134                     << "      Tx bytes: " << data.devices[i].tx_bytes << endl
   140                     << "      Rx frames:   "
   135                     << "      Tx errors: " << data.devices[i].tx_errors << endl
   141                     << data.devices[i].rx_count << endl
       
   142                     << "      Lost frames: " << lost << endl
       
   143                     << "      Tx bytes:    "
       
   144                     << data.devices[i].tx_bytes << endl
       
   145                     << "      Tx errors:   "
       
   146                     << data.devices[i].tx_errors << endl
   136                     << "      Tx frame rate [1/s]: "
   147                     << "      Tx frame rate [1/s]: "
   137                     << setfill(' ') << setprecision(0) << fixed;
   148                     << setfill(' ') << setprecision(0) << fixed;
   138                 for (j = 0; j < EC_RATE_COUNT; j++) {
   149                 for (j = 0; j < EC_RATE_COUNT; j++) {
   139                     cout <<
   150                     cout <<
   140                         setw(5) << data.devices[i].tx_frame_rates[j] / 1000.0;
   151                         setw(5) << data.devices[i].tx_frame_rates[j] / 1000.0;
   142                         cout << " ";
   153                         cout << " ";
   143                     }
   154                     }
   144                 }
   155                 }
   145                 cout << endl
   156                 cout << endl
   146                     << "      Tx rate [KByte/s]:   "
   157                     << "      Tx rate [KByte/s]:   "
   147                     << setprecision(0) << fixed;
   158                     << setprecision(1) << fixed;
   148                 for (j = 0; j < EC_RATE_COUNT; j++) {
   159                 for (j = 0; j < EC_RATE_COUNT; j++) {
   149                     cout <<
   160                     cout << setw(5)
   150                         setw(5) << data.devices[i].tx_byte_rates[j] / 1000.0;
   161                         << data.devices[i].tx_byte_rates[j] / 1024000.0;
   151                     if (j < EC_RATE_COUNT - 1) {
   162                     if (j < EC_RATE_COUNT - 1) {
   152                         cout << " ";
   163                         cout << " ";
   153                     }
   164                     }
   154                 }
   165                 }
   155                 cout << endl
   166                 cout << endl