Add format keyword argument to network_load segment

This commit is contained in:
ZyX 2013-03-17 15:11:26 +04:00
parent f9e9b2cd22
commit a1b0b6239f

View File

@ -550,6 +550,8 @@ class NetworkLoadSegment(KwThreadedSegment):
string appended to each load string string appended to each load string
:param bool si_prefix: :param bool si_prefix:
use SI prefix, e.g. MB instead of MiB use SI prefix, e.g. MB instead of MiB
:param str format:
format string, receives ``recv`` and ``sent`` as arguments
''' '''
interfaces = {} interfaces = {}
@ -587,9 +589,9 @@ class NetworkLoadSegment(KwThreadedSegment):
return None return None
return [{ return [{
'contents': '{rx_diff}{tx_diff}'.format( 'contents': format.format(
rx_diff=humanize_bytes((b2[0] - b1[0]) / measure_interval, suffix, si_prefix).rjust(8), recv=humanize_bytes((b2[0] - b1[0]) / measure_interval, suffix, si_prefix),
tx_diff=humanize_bytes((b2[1] - b1[1]) / measure_interval, suffix, si_prefix).rjust(8), sent=humanize_bytes((b2[1] - b1[1]) / measure_interval, suffix, si_prefix),
), ),
'divider_highlight_group': 'background:divider', 'divider_highlight_group': 'background:divider',
}] }]