Merge commit '3dfa794fab62dca7c0499791d37298a49630d5ee' into develop

This commit is contained in:
assistant-librarian[bot]
2025-12-16 17:15:31 +00:00
parent ad434f0976
commit cd533b2f79
3 changed files with 62 additions and 17 deletions

View File

@@ -99,7 +99,7 @@ class EnhancedNinjaDependencyParser:
print("No object files found - skipping dependency extraction")
return
max_workers = min(16, len(object_files)) # Limit concurrent processes
max_workers = min(128, len(object_files)) # Limit concurrent processes
with ThreadPoolExecutor(max_workers=max_workers) as executor:
# Submit all object files for processing

43
script/parse_ninja_trace.py Executable file
View File

@@ -0,0 +1,43 @@
# Copyright (c) Advanced Micro Devices, Inc., or its affiliates.
# SPDX-License-Identifier: MIT
import json
import os
import sys
def read_json_file(file_path):
if not os.path.isfile(file_path):
raise FileNotFoundError(f"File not found: {file_path}")
with open(file_path, "r", encoding="utf-8") as file:
try:
data = json.load(file)
except json.JSONDecodeError as e:
raise json.JSONDecodeError(f"Invalid JSON format: {e}", e.doc, e.pos)
return data
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python parse_json.py <path_to_json_file>")
sys.exit(1)
json_file_path = sys.argv[1]
try:
parsed_data = read_json_file(json_file_path)
print("JSON parsed successfully!")
threshold = 15 # max number of minutes for compilation
for i in range(len(parsed_data)):
if parsed_data[i]["dur"] > threshold * 60000000:
print(
f"build duration of {parsed_data[i]['name']} exceeds {threshold} minutes! actual build time: {parsed_data[i]['dur'] / 60000000:.2f} minutes!"
)
except FileNotFoundError as fnf_err:
print(f"Error: {fnf_err}")
except json.JSONDecodeError as json_err:
print(f"Error: {json_err}")
except Exception as e:
print(f"Unexpected error: {e}")