mirror of
https://github.com/powerline/powerline.git
synced 2025-07-25 14:54:54 +02:00
Merge remote-tracking branch 'kovidgoyal/fix-417' into develop
This commit is contained in:
commit
669327df0d
@ -711,7 +711,7 @@ class NetworkLoadSegment(KwThreadedSegment):
|
|||||||
self.interfaces[interface] = idata
|
self.interfaces[interface] = idata
|
||||||
|
|
||||||
idata['last'] = (monotonic(), _get_bytes(interface))
|
idata['last'] = (monotonic(), _get_bytes(interface))
|
||||||
return idata
|
return idata.copy()
|
||||||
|
|
||||||
def render_one(self, idata, recv_format='⬇ {value:>8}', sent_format='⬆ {value:>8}', suffix='B/s', si_prefix=False, **kwargs):
|
def render_one(self, idata, recv_format='⬇ {value:>8}', sent_format='⬆ {value:>8}', suffix='B/s', si_prefix=False, **kwargs):
|
||||||
if not idata or 'prev' not in idata:
|
if not idata or 'prev' not in idata:
|
||||||
@ -723,14 +723,15 @@ class NetworkLoadSegment(KwThreadedSegment):
|
|||||||
|
|
||||||
if None in (b1, b2):
|
if None in (b1, b2):
|
||||||
return None
|
return None
|
||||||
if measure_interval == 0:
|
|
||||||
self.error('Measure interval is zero. This should not happen')
|
|
||||||
return None
|
|
||||||
|
|
||||||
r = []
|
r = []
|
||||||
for i, key in zip((0, 1), ('recv', 'sent')):
|
for i, key in zip((0, 1), ('recv', 'sent')):
|
||||||
format = locals()[key + '_format']
|
format = locals()[key + '_format']
|
||||||
value = (b2[i] - b1[i]) / measure_interval
|
try:
|
||||||
|
value = (b2[i] - b1[i]) / measure_interval
|
||||||
|
except ZeroDivisionError:
|
||||||
|
self.warn('Measure interval zero.')
|
||||||
|
value = 0
|
||||||
max_key = key + '_max'
|
max_key = key + '_max'
|
||||||
is_gradient = max_key in kwargs
|
is_gradient = max_key in kwargs
|
||||||
hl_groups = ['network_load_' + key, 'network_load']
|
hl_groups = ['network_load_' + key, 'network_load']
|
||||||
|
Loading…
x
Reference in New Issue
Block a user