Skip to content

Commit 1b5b5f1

Browse files
Wes Castrofacebook-github-bot
authored andcommitted
[TorchCodec] Add --output-results option to benchmark utility
Summary: Output the benchmarking results to a JSON file. Differential Revision: D82155925
1 parent 67b4381 commit 1b5b5f1

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

benchmarks/decoders/benchmark_decoders.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import os
1010
import platform
1111
from pathlib import Path
12+
import json
1213

1314
import torch
1415

@@ -106,6 +107,13 @@ def main() -> None:
106107
default=False,
107108
action=argparse.BooleanOptionalAction,
108109
)
110+
parser.add_argument(
111+
"--output-results",
112+
help="Output the results to a JSON file",
113+
type=str,
114+
default="",
115+
116+
)
109117

110118
args = parser.parse_args()
111119
specified_decoders = set(args.decoders.split(","))
@@ -146,6 +154,10 @@ def main() -> None:
146154
min_runtime_seconds=args.min_run_seconds,
147155
benchmark_video_creation=args.bm_video_creation,
148156
)
157+
if args.output_results:
158+
with open(args.output_results, "w") as f:
159+
json.dump(results, f, indent=2)
160+
149161
data = {
150162
"experiments": results,
151163
"system_metadata": {

0 commit comments

Comments
 (0)