paycheck: Small improvements to the block tracer utility.
This prepends the current block number to the output, simplifies some
logic, and tightens argument validation in the command-line parser.
BUG=None
TEST=paycheck -B/-b works.
Change-Id: I90d5cdf721612cdd12e49f4e4181849fc699807f
Reviewed-on: https://chromium-review.googlesource.com/286547
Tested-by: Gilad Arnold <garnold@chromium.org>
Commit-Queue: Gilad Arnold <garnold@chromium.org>
Reviewed-by: Don Garrett <dgarrett@chromium.org>
diff --git a/scripts/update_payload/block_tracer.py b/scripts/update_payload/block_tracer.py
index e7a9d27..f222b21 100644
--- a/scripts/update_payload/block_tracer.py
+++ b/scripts/update_payload/block_tracer.py
@@ -14,6 +14,8 @@
"""
+from __future__ import print_function
+
import common
@@ -50,7 +52,6 @@
trace_out_file: a file object to dump the trace to
operations: the sequence of operations
base_name: name of the operation sequence
-
"""
# Traverse operations backwards.
for op, op_name in common.OperationIter(operations, base_name,
@@ -68,8 +69,9 @@
else:
total_block_offset += block - dst_ex.start_block
trace_out_file.write(
- '%s: found %s (total block offset: %d)\n' %
- (dst_ex_name, common.FormatExtent(dst_ex), total_block_offset))
+ '%d: %s: found %s (total block offset: %d)\n' %
+ (block, dst_ex_name, common.FormatExtent(dst_ex),
+ total_block_offset))
found = True
break
@@ -100,13 +102,12 @@
skip: the number of first origin mappings to skip
trace_out_file: file object to dump the trace to
is_kernel: trace through kernel (True) or rootfs (False) operations
-
"""
if is_kernel:
- self._TraceBlock(block, skip, trace_out_file,
- self.payload.manifest.kernel_install_operations,
- 'kernel_install_operations')
+ operations = self.payload.manifest.kernel_install_operations
+ base_name = 'kernel_install_operations'
else:
- self._TraceBlock(block, skip, trace_out_file,
- self.payload.manifest.install_operations,
- 'install_operations')
+ operations = self.payload.manifest.install_operations
+ base_name = 'install_operations'
+
+ self._TraceBlock(block, skip, trace_out_file, operations, base_name)