Skip to content

Commit

Permalink
Changed: default unit is megabit/s for link-rate.
Browse files Browse the repository at this point in the history
  • Loading branch information
strizhechenko committed Jun 1, 2017
1 parent bd1db66 commit b307faf
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions netutils_linux_monitoring/link_rate.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ def __init__(self):
Option('--rx', '--rx-only', dest='rx_only', default=False, action='store_true',
help='Hides tx-counters'),
Option('--bits', default=False, action='store_true'),
Option('--bytes', default=False, action='store_true'),
Option('--kbits', default=False, action='store_true'),
Option('--mbits', default=False, action='store_true'),
Option('--mbits', default=True, action='store_true'),
]
self.specific_options.extend(specific_options)

Expand Down Expand Up @@ -98,13 +99,13 @@ def __parse_dev_stat__(self, dev, stat):
return file_value

def __repr_bytes(self, value):
if self.options.bytes:
return value
if self.options.bits:
return value * 8
elif self.options.kbits:
return value * 8 / 1024
elif self.options.mbits:
return value * 8 / 1024 / 1024
return value
return value * 8 / 1024 / 1024

@staticmethod
def __indent__(column, value, maxvalue=0):
Expand Down

0 comments on commit b307faf

Please sign in to comment.