11from __future__ import annotations
22
33import ast
4+ import time
45from dataclasses import dataclass
56from itertools import chain
67from pathlib import Path
@@ -1138,6 +1139,7 @@ def find_specific_function_in_file(
11381139def get_fn_references_jedi (
11391140 source_code : str , file_path : Path , project_root : Path , target_function : str , target_class : str | None
11401141) -> list [Path ]:
1142+ start_time = time .perf_counter ()
11411143 function_position : CodePosition = find_specific_function_in_file (
11421144 source_code , file_path , target_function , target_class
11431145 )
@@ -1146,6 +1148,8 @@ def get_fn_references_jedi(
11461148 # Get references to the function
11471149 references = script .get_references (line = function_position .line_no , column = function_position .col_no )
11481150 # Collect unique file paths where references are found
1151+ end_time = time .perf_counter ()
1152+ logger .debug (f"Jedi for function references ran in { end_time - start_time :.2f} seconds" )
11491153 reference_files = set ()
11501154 for ref in references :
11511155 if ref .module_path :
@@ -1163,6 +1167,7 @@ def get_fn_references_jedi(
11631167def get_opt_review_metrics (
11641168 source_code : str , file_path : Path , qualified_name : str , project_root : Path , tests_root : Path
11651169) -> str :
1170+ start_time = time .perf_counter ()
11661171 try :
11671172 qualified_name_split = qualified_name .rsplit ("." , maxsplit = 1 )
11681173 if len (qualified_name_split ) == 1 :
@@ -1176,4 +1181,6 @@ def get_opt_review_metrics(
11761181 except Exception as e :
11771182 calling_fns_details = ""
11781183 logger .debug (f"Investigate { e } " )
1184+ end_time = time .perf_counter ()
1185+ logger .debug (f"Got function references in { end_time - start_time :.2f} seconds" )
11791186 return calling_fns_details
0 commit comments