Multiply port data XMIT/RCV metrics by 4 (#579)

According to Mellanox, it is standard practice that the port_xmit_data and port_rcv_data
files are split into 4 lanes. To get the actual transmit and receive values for each
port, the metric needs to be multiplied by 4.

Signed-Off-By: Robert Clark <robert.d.clark@hpe.com>
This commit is contained in:
Robert Clark 2017-05-12 00:28:53 -05:00 committed by Ben Kochie
commit 58f50b31f2
2 changed files with 15 additions and 6 deletions

View file

@ -148,6 +148,15 @@ func readMetric(directory, metricFile string) (uint64, error) {
return 0, err
}
// According to Mellanox, the following metrics "are divided by 4 unconditionally"
// as they represent the amount of data being transmitted and received per lane.
// Mellanox cards have 4 lanes per port, so all values must be multiplied by 4
// to get the expected value.
switch metricFile {
case "port_rcv_data", "port_xmit_data", "port_rcv_data_64", "port_xmit_data_64":
metric *= 4
}
return metric, nil
}