Skip to content

Commit

Permalink
render time check
Browse files Browse the repository at this point in the history
  • Loading branch information
Pullusb committed Apr 9, 2024
1 parent 76bb20c commit 4d24b44
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions snippets/dev/sequence_render_time_infos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
## Print infos on render times from a sequence folder (check creation time from frames)
## minimum, maximum, average and total time
## Use current working directory, a path can be specified as argument
## nice to use as CLI shortcut: alias sequnecetime = 'python3 path/to/script'

import sys
import os
import datetime
import numpy as np
from pathlib import Path

def check_render_time():
folder = Path(os.getcwd())
if len(sys.argv) > 1:
folder = Path(sys.argv[1])

files = [f for f in folder.iterdir() if f.is_file()]
files.sort(key=lambda x: x.name)

deltas = []
for i in range(len(files)-1):
f = files[i]
next_f = files[i + 1]

delta = next_f.stat().st_ctime - f.stat().st_ctime
deltas.append(delta)

print(f'Sequence evaluated render times in {folder.name} ({len(files)} files):')
average = np.mean(deltas)
print(f'Min time: {datetime.timedelta(seconds=min(deltas))}')
print(f'Max time: {datetime.timedelta(seconds=max(deltas))}')
print(f'Average : {datetime.timedelta(seconds=average)}')
print()
# Add 1 average as first frame time
print(f'Total : ~{datetime.timedelta(seconds=files[-1].stat().st_ctime - files[0].stat().st_ctime + average)}')

check_render_time()

0 comments on commit 4d24b44

Please sign in to comment.