Skip to content

Commit 3f3f336

Browse files
authored
Add --output-results option to benchmark utility
Differential Revision: D82155925 Pull Request resolved: #892
1 parent 6f906f4 commit 3f3f336

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

benchmarks/decoders/benchmark_decoders.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
import argparse
88
import importlib.resources
9+
import json
910
import os
1011
import platform
1112
from pathlib import Path
@@ -106,6 +107,12 @@ def main() -> None:
106107
default=False,
107108
action=argparse.BooleanOptionalAction,
108109
)
110+
parser.add_argument(
111+
"--output-json",
112+
help="Output the results to a JSON file",
113+
type=str,
114+
default="",
115+
)
109116

110117
args = parser.parse_args()
111118
specified_decoders = set(args.decoders.split(","))
@@ -146,6 +153,10 @@ def main() -> None:
146153
min_runtime_seconds=args.min_run_seconds,
147154
benchmark_video_creation=args.bm_video_creation,
148155
)
156+
if args.output_json:
157+
with open(args.output_json, "w") as f:
158+
json.dump(results, f, indent=2)
159+
149160
data = {
150161
"experiments": results,
151162
"system_metadata": {

0 commit comments

Comments
 (0)