[PATCH damo] _damo_records: support address range in hex format

Akinobu Mita
2024-12-30T13:42:58Z

In preparation for changing the display format of address ranges in
tracepoints for DAMON, if the start and end addresses of an address range
have a "0x" prefix, convert them as hexadecimal numbers.

Cc: SeongJae Park <sj@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
src/_damo_records.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/_damo_records.py b/src/_damo_records.py
index 6e541a0..55d864c 100644
--- a/src/_damo_records.py
+++ b/src/_damo_records.py
@@ -251,7 +251,7 @@ def parse_damon_aggregated_perf_script_fields(fields):
target_id = int(fields[5].split('=')[1])
nr_regions = int(fields[6].split('=')[1])

- start_addr, end_addr = [int(x) for x in fields[7][:-1].split('-')]
+ start_addr, end_addr = [int(x, 0) for x in fields[7][:-1].split('-')]
nr_accesses = int(fields[8])
if len(fields) == 10:
age = int(fields[9])
@@ -288,7 +288,7 @@ def parse_damos_before_apply_perf_script_fields(fields):
target_id = int(fields[7].split('=')[1])
nr_regions = int(fields[8].split('=')[1])

- start_addr, end_addr = [int(x) for x in fields[9][:-1].split('-')]
+ start_addr, end_addr = [int(x, 0) for x in fields[9][:-1].split('-')]
nr_accesses = int(fields[10])
age = int(fields[11])
region = _damon.DamonRegion(start_addr, end_addr, nr_accesses,
--
2.34.1