From 3bc77a72a3b0f6a05bb930c2c7cd4fa71b4f8021 Mon Sep 17 00:00:00 2001 From: zhaochenjie Date: Sat, 28 Jun 2025 15:07:32 +0800 Subject: [PATCH] fix jemalloc.so index usage In some cases, jemalloc.so shows up on both index 3 and 4 in one line. To fix this, search first so file that doesn't include jemalloc.so. --- parse_peak_so.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/parse_peak_so.py b/parse_peak_so.py index 1480644a..e3b92db2 100644 --- a/parse_peak_so.py +++ b/parse_peak_so.py @@ -21,6 +21,7 @@ RELEASE = "0" ROW_KEY = "row" TOTAL_MEM_KEY = "total_mem" PROGRESS_BAR_CHUNK = 50000 +LIBJEMALLOC = "libjemalloc.so" def time_cost(func): """A decorator that calculates the time cost of a function.""" @@ -95,7 +96,7 @@ def extract_line_info(line): op_type = frame_arr[0].strip() addr = frame_arr[1].strip().replace("\n", "") size = int(frame_arr[2].strip()) - frames = [frame_arr[4]] + frames = frame_arr[4:] return op_type, addr, size, frames @@ -205,9 +206,10 @@ def convert_frame_to_so(lines, library_map_path, worker_number): continue so_path = frame_to_library[mem_range] - frame_to_so[frame] = so_path - last_frame_row.append(so_path) - break + if so_path and LIBJEMALLOC not in so_path: + frame_to_so[frame] = so_path + last_frame_row.append(so_path) + break first_frame_rows.append(tuple(last_frame_row)) return first_frame_rows -- Gitee