Hierarchical latency graph, bugfixes, renamed types.py to not interfere with other python packages.

This commit is contained in:
Maximilian Schmeller 2022-08-09 18:36:40 +02:00
parent 5885be5974
commit 0261b8200f
10 changed files with 1022 additions and 170 deletions

View file

@ -50,10 +50,22 @@ def cached(name, function, file_deps: List[str]):
dep_time = 0.0
for file in file_deps:
# Get modified time of the current dependency
m_time = os.path.getmtime(file) if os.path.exists(file) else 0.
# Update dependency time to be the newest modified time of any dependency
if m_time > dep_time:
dep_time = m_time
# Check directories recursively to get the newest modified time
for root, dirs, files in os.walk(file):
for f in files + dirs:
filename = os.path.join(root, f)
m_time = os.path.getmtime(filename)
if m_time > dep_time:
dep_time = m_time
deps_hash = stable_hash(sorted(file_deps))
pkl_filename = f"cache/{name}_{deps_hash}.pkl"