scripts/trace: improve line formatting when printing
Changed the way a line is formatted to avoid unnecessary operations. This slightly (~5-10%) decreases the runtime when the script is executed on large trace files. Signed-off-by: Konrad Sztyber <konrad.sztyber@intel.com> Change-Id: I5549462d56f866bea99609f746aa53890b98d622 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/9442 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Community-CI: Broadcom CI <spdk-ci.pdl@broadcom.com> Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com> Reviewed-by: Tomasz Zawadzki <tomasz.zawadzki@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com> Reviewed-by: Krzysztof Karas <krzysztof.karas@intel.com>
This commit is contained in:
parent
364dbc8f48
commit
e89224d1b7
@ -446,18 +446,13 @@ class Trace:
|
||||
timestamp = get_us(e.tsc, offset)
|
||||
diff = get_us(e.time, 0) if e.time is not None else None
|
||||
args = ', '.join(self._format_args(e))
|
||||
fields = [
|
||||
f'{e.lcore:3}',
|
||||
f'{timestamp:16.3f}',
|
||||
f'{e.poller:3}' if e.poller is not None else ' ' * 3,
|
||||
f'{e.tpoint.name:24}',
|
||||
f'size: {e.size:6}' if e.size else ' ' * (len('size: ') + 6),
|
||||
f'id: {e.object_id:8}' if e.object_id is not None else None,
|
||||
f'time: {diff:<8.3f}' if diff is not None else None,
|
||||
args
|
||||
]
|
||||
|
||||
print(' '.join([*filter(lambda f: f is not None, fields)]).rstrip())
|
||||
print(('{:3} {:16.3f} {:3} {:24} {:12}'.format(
|
||||
e.lcore, timestamp, e.poller if e.poller is not None else '',
|
||||
e.tpoint.name, f'size: {e.size}' if e.size else '') +
|
||||
(f'id: {e.object_id:8} ' if e.object_id is not None else '') +
|
||||
(f'time: {diff:<8.3f} ' if diff is not None else '') +
|
||||
args).rstrip())
|
||||
|
||||
|
||||
class SPDKObject:
|
||||
|
Loading…
Reference in New Issue
Block a user