Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
69 lines
2.5 KiB
Python
69 lines
2.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Summarize opt-in Release FrameTiming JSONL and optional UTC phase markers.
|
|
|
|
Build/raster budget misses are reported separately. Total pipeline latency is
|
|
not a dropped-frame count. Engine timestamps are not display-present evidence.
|
|
"""
|
|
|
|
import argparse
|
|
import datetime
|
|
import json
|
|
|
|
|
|
def read_jsonl(path):
|
|
with open(path, encoding="utf-8-sig") as source:
|
|
return [json.loads(line) for line in source if line.strip()]
|
|
|
|
|
|
def seconds(timestamp):
|
|
return datetime.datetime.fromisoformat(timestamp.replace("Z", "+00:00")).timestamp()
|
|
|
|
|
|
def summarize(name, frames):
|
|
if not frames:
|
|
return {"name": name, "frames": 0}
|
|
result = {"name": name, "frames": len(frames)}
|
|
for column, stage in [(1, "build"), (2, "raster"), (3, "total")]:
|
|
values = sorted(frame[column] / 1000 for frame in frames)
|
|
result[stage] = {
|
|
f"p{int(percentile * 100)}Ms": round(
|
|
values[int((len(values) - 1) * percentile)], 3
|
|
)
|
|
for percentile in [0.5, 0.95, 0.99]
|
|
}
|
|
result[stage].update(
|
|
maxMs=max(values),
|
|
over60Hz=sum(value > 1000 / 60 for value in values),
|
|
over120Hz=sum(value > 1000 / 120 for value in values),
|
|
)
|
|
return result
|
|
|
|
|
|
def main():
|
|
parser = argparse.ArgumentParser(description=__doc__)
|
|
parser.add_argument("frames", help="CUTDEX_FRAME_TIMINGS output file")
|
|
parser.add_argument("phases", nargs="?", help="Optional UTC scenario marker JSONL")
|
|
args = parser.parse_args()
|
|
batches = read_jsonl(args.frames)
|
|
overall = summarize("all", [frame for batch in batches for frame in batch["frames"]])
|
|
overall["droppedDiagnosticSamples"] = sum(batch.get("dropped", 0) for batch in batches)
|
|
print(json.dumps(overall))
|
|
if args.phases:
|
|
phases = {entry["phase"]: seconds(entry["at"]) for entry in read_jsonl(args.phases)}
|
|
for name in ["scrub", "zoom", "drag", "clip", "trim", "pan", "play"]:
|
|
start, end = phases.get(f"{name}-start"), phases.get(f"{name}-end")
|
|
if start is None or end is None:
|
|
continue
|
|
# Allow for the two-second asynchronous reporting batch boundary.
|
|
frames = [
|
|
frame
|
|
for batch in batches
|
|
if start + 2.2 < seconds(batch["at"]) < end
|
|
for frame in batch["frames"]
|
|
]
|
|
print(json.dumps(summarize(name, frames)))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|