diff --git a/cpp/scripts/sort_ninja_log.py b/cpp/scripts/sort_ninja_log.py index 42f84e4d0c7..e111367d191 100755 --- a/cpp/scripts/sort_ninja_log.py +++ b/cpp/scripts/sort_ninja_log.py @@ -1,8 +1,9 @@ # -# Copyright (c) 2021-2024, NVIDIA CORPORATION. +# Copyright (c) 2021-2025, NVIDIA CORPORATION. # import argparse import os +import re import sys import xml.etree.ElementTree as ET from pathlib import Path @@ -144,6 +145,16 @@ def format_file_size(input_size): return file_size_str +def replace_placeholder_patterns(input_string: str) -> str: + pattern = r'(_h_env_placehold)[_placehold]+' + return re.sub(pattern, r'\1...', input_string) + + +# adjust name for display +def format_file_name(name: str) -> str: + return replace_placeholder_patterns(name) + + # Output chart results in HTML format # Builds a standalone html file with no javascript or styles def output_html(entries, sorted_list, cmp_entries, args): @@ -223,7 +234,8 @@ def output_html(entries, sorted_list, cmp_entries, args): print("", end="") # use a slightly smaller, fixed-width font @@ -265,7 +277,8 @@ def output_html(entries, sorted_list, cmp_entries, args): file_size_str = format_file_size(file_size) # output entry row - print("", name, "", sep="", end="") + display_name = format_file_name(name) + print("", display_name, "", sep="", end="") print("", build_time_str, "", sep="", end="") print("", file_size_str, "", sep="", end="") # output diff column