in testslide/import_profiler.py [0:0]
def print_stats(self, threshold_ms: int = 0) -> None:
def print_imp_mod(imp_mod: ImportedModule, indent: int = 0) -> None:
own_ms = int(imp_mod.own_time * 1000)
if own_ms >= threshold_ms or any(
child
for child in imp_mod.all_children
if child.own_time * 1000 >= threshold_ms
):
print("{}{}: {}ms".format(" " * indent, imp_mod, own_ms))
for child_imp_mod in imp_mod.children:
print_imp_mod(child_imp_mod, indent + 1)
for imp_mod in self._top_imp_modules:
print_imp_mod(imp_mod)
print()
print("Total import time: {}ms".format(int(self.total_time * 1000)))