|
@@ -33,7 +33,7 @@ func HandleGetNetworkInterfaceStats(w http.ResponseWriter, r *http.Request) {
|
|
|
common.SendJSONResponse(w, string(js))
|
|
|
}
|
|
|
|
|
|
-//Get network interface stats, return rx_byte, tx_byte and error if any
|
|
|
+//Get network interface stats, return accumulated rx bits, tx bits and error if any
|
|
|
func GetNetworkInterfaceStats() (int64, int64, error) {
|
|
|
if runtime.GOOS == "windows" {
|
|
|
cmd := exec.Command("wmic", "path", "Win32_PerfRawData_Tcpip_NetworkInterface", "Get", "BytesReceivedPersec,BytesSentPersec,BytesTotalPersec")
|
|
@@ -106,11 +106,11 @@ func GetNetworkInterfaceStats() (int64, int64, error) {
|
|
|
txSum += int64(txBytesInt)
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
|
|
|
- return rxSum, txSum, nil
|
|
|
+ //Return value as bits
|
|
|
+ return rxSum * 8, txSum * 8, nil
|
|
|
}
|
|
|
|
|
|
return 0, 0, errors.New("Platform not supported")
|