3 # Copyright © 2020 Valve Corporation.
4 # Copyright © 2021 Collabora Ltd.
6 # Permission is hereby granted, free of charge, to any person obtaining a
7 # copy of this software and associated documentation files (the "Software"),
8 # to deal in the Software without restriction, including without limitation
9 # the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 # and/or sell copies of the Software, and to permit persons to whom the
11 # Software is furnished to do so, subject to the following conditions:
13 # The above copyright notice and this permission notice shall be included
14 # in all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
17 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 # THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
20 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
21 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
22 # OTHER DEALINGS IN THE SOFTWARE.
24 # SPDX-License-Identifier: MIT
28 from framework
import exceptions
29 from framework
.programs
import parsers
as piglit_parsers
30 from framework
.replay
import frame_times
, options
38 options
.OPTIONS
.device_name
= args
.device_name
39 options
.OPTIONS
.set_download_caching_proxy_url(args
.download_caching_proxy_url
)
40 options
.OPTIONS
.download
['force'] = args
.force_download
41 options
.OPTIONS
.download
['minio_host'] = args
.download_minio_host
42 options
.OPTIONS
.download
['minio_bucket'] = args
.download_minio_bucket
43 options
.OPTIONS
.download
['role_session_name'] = args
.download_role_session_name
44 options
.OPTIONS
.download
['jwt'] = args
.download_jwt
45 options
.OPTIONS
.db_path
= args
.db_path
46 options
.OPTIONS
.results_path
= args
.output
48 return frame_times
.from_yaml(args
.yaml_file
)
52 options
.OPTIONS
.device_name
= args
.device_name
53 options
.OPTIONS
.set_download_url(args
.download_url
)
54 options
.OPTIONS
.set_download_caching_proxy_url(args
.download_caching_proxy_url
)
55 options
.OPTIONS
.download
['force'] = args
.force_download
56 options
.OPTIONS
.download
['minio_host'] = args
.download_minio_host
57 options
.OPTIONS
.download
['minio_bucket'] = args
.download_minio_bucket
58 options
.OPTIONS
.download
['role_session_name'] = args
.download_role_session_name
59 options
.OPTIONS
.download
['jwt'] = args
.download_jwt
60 options
.OPTIONS
.db_path
= args
.db_path
61 options
.OPTIONS
.results_path
= args
.output
63 return frame_times
.trace(args
.file_path
)
68 """ Parser for replayer compare command """
69 unparsed
= piglit_parsers
.parse_config(input_
)[1]
72 # Set the parent of the config to add the -f/--config message
73 parser
= argparse
.ArgumentParser(parents
=[piglit_parsers
.CONFIG
])
74 # The "required" keyword is only available since python >= 3.7
75 subparsers
= parser
.add_subparsers(dest
='command', required
=True)
77 parser
= argparse
.ArgumentParser(parents
=[piglit_parsers
.CONFIG
])
78 # Add a destination due to
79 # https://github.com/python/cpython/pull/3027#issuecomment-330910633
80 subparsers
= parser
.add_subparsers(dest
='command')
82 parser_trace
= subparsers
.add_parser(
84 parents
=[parsers
.DEVICE
,
86 parsers
.DOWNLOAD_CACHING_PROXY_URL
,
87 parsers
.DOWNLOAD_FORCE
,
88 parsers
.DOWNLOAD_MINIO_HOST
,
89 parsers
.DOWNLOAD_MINIO_BUCKET
,
90 parsers
.DOWNLOAD_ROLE_SESSION_NAME
,
93 parsers
.RESULTS_PATH
],
94 help=('Profiles specific trace given a device.'))
95 parser_trace
.add_argument(
97 help=('the relative path to the trace file inside the db path. '
98 'If not present and given that an URL has been provided '
99 'for its download, the relative path to the file in such URL.'))
100 parser_trace
.set_defaults(func
=_trace
)
102 parser_yaml
= subparsers
.add_parser(
104 parents
=[parsers
.DEVICE
,
106 parsers
.DOWNLOAD_CACHING_PROXY_URL
,
107 parsers
.DOWNLOAD_FORCE
,
108 parsers
.DOWNLOAD_MINIO_HOST
,
109 parsers
.DOWNLOAD_MINIO_BUCKET
,
110 parsers
.DOWNLOAD_ROLE_SESSION_NAME
,
111 parsers
.DOWNLOAD_JWT
,
113 parsers
.RESULTS_PATH
],
114 help=('Profiles from a traces description file listing traces.'))
115 parser_yaml
.set_defaults(func
=_from_yaml
)
117 args
= parser
.parse_args(unparsed
)
119 return args
.func(args
)