diff --git a/cpp/scripts/sort_ninja_log.py b/cpp/scripts/sort_ninja_log.py index 3fe503f749e..42f84e4d0c7 100755 --- a/cpp/scripts/sort_ninja_log.py +++ b/cpp/scripts/sort_ninja_log.py @@ -1,5 +1,5 @@ # -# Copyright (c) 2021-2023, NVIDIA CORPORATION. +# Copyright (c) 2021-2024, NVIDIA CORPORATION. # import argparse import os @@ -9,14 +9,12 @@ from xml.dom import minidom parser = argparse.ArgumentParser() -parser.add_argument( - "log_file", type=str, default=".ninja_log", help=".ninja_log file" -) +parser.add_argument("log_file", type=str, default=".ninja_log", help=".ninja_log file") parser.add_argument( "--fmt", type=str, default="csv", - choices=["csv", "xml", "html"], + choices=["csv", "html"], help="output format (to stdout)", ) parser.add_argument( @@ -37,6 +35,7 @@ output_fmt = args.fmt cmp_file = args.cmp_log + # build a map of the log entries def build_log_map(log_file): entries = {} @@ -68,37 +67,6 @@ def build_log_map(log_file): return entries -# output results in XML format -def output_xml(entries, sorted_list, args): - root = ET.Element("testsuites") - testsuite = ET.Element( - "testsuite", - attrib={ - "name": "build-time", - "tests": str(len(sorted_list)), - "failures": str(0), - "errors": str(0), - }, - ) - root.append(testsuite) - for name in sorted_list: - entry = entries[name] - build_time = float(entry[1] - entry[0]) / 1000 - item = ET.Element( - "testcase", - attrib={ - "classname": "BuildTime", - "name": name, - "time": str(build_time), - }, - ) - testsuite.append(item) - - tree = ET.ElementTree(root) - xmlstr = minidom.parseString(ET.tostring(root)).toprettyxml(indent=" ") - print(xmlstr) - - # utility converts a millisecond value to a column width in pixels def time_to_width(value, end): # map a value from (0,end) to (0,1000) @@ -282,9 +250,7 @@ def output_html(entries, sorted_list, cmp_entries, args): # output detail table in build-time descending order print("
File | ", "Compile time | ", "Size | ", sep="" - ) + print("|
---|---|---|---|
File | ", "Compile time | ", "Size | ", sep="") if cmp_entries: print("t-cmp | ", sep="") print("", build_time_str, " | ", sep="", end="") print("", file_size_str, " | ", sep="", end="") # output diff column - cmp_entry = ( - cmp_entries[name] if cmp_entries and name in cmp_entries else None - ) + cmp_entry = cmp_entries[name] if cmp_entries and name in cmp_entries else None if cmp_entry: diff_time = build_time - (cmp_entry[1] - cmp_entry[0]) diff_time_str = format_build_time(diff_time) @@ -353,7 +317,7 @@ def output_html(entries, sorted_list, cmp_entries, args): print( "
time change < 20%% or build time < 1 minute |