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
.replay
import frame_times
30 from framework
.replay
import options
31 from framework
.programs
import parsers
as piglit_parsers
38 options
.OPTIONS
.device_name
= args
.device_name
39 options
.OPTIONS
.download
['force'] = args
.force_download
40 options
.OPTIONS
.download
['minio_host'] = args
.download_minio_host
41 options
.OPTIONS
.download
['minio_bucket'] = args
.download_minio_bucket
42 options
.OPTIONS
.download
['role_session_name'] = args
.download_role_session_name
43 options
.OPTIONS
.download
['jwt'] = args
.download_jwt
44 options
.OPTIONS
.db_path
= args
.db_path
45 options
.OPTIONS
.results_path
= args
.output
47 return frame_times
.from_yaml(args
.yaml_file
)
51 options
.OPTIONS
.device_name
= args
.device_name
52 options
.OPTIONS
.set_download_url(args
.download_url
)
53 options
.OPTIONS
.download
['force'] = args
.force_download
54 options
.OPTIONS
.download
['minio_host'] = args
.download_minio_host
55 options
.OPTIONS
.download
['minio_bucket'] = args
.download_minio_bucket
56 options
.OPTIONS
.download
['role_session_name'] = args
.download_role_session_name
57 options
.OPTIONS
.download
['jwt'] = args
.download_jwt
58 options
.OPTIONS
.db_path
= args
.db_path
59 options
.OPTIONS
.results_path
= args
.output
61 return frame_times
.trace(args
.file_path
)
66 """ Parser for replayer compare command """
67 unparsed
= piglit_parsers
.parse_config(input_
)[1]
70 # Set the parent of the config to add the -f/--config message
71 parser
= argparse
.ArgumentParser(parents
=[piglit_parsers
.CONFIG
])
72 # The "required" keyword is only available since python >= 3.7
73 subparsers
= parser
.add_subparsers(dest
='command', required
=True)
75 parser
= argparse
.ArgumentParser(parents
=[piglit_parsers
.CONFIG
])
76 # Add a destination due to
77 # https://github.com/python/cpython/pull/3027#issuecomment-330910633
78 subparsers
= parser
.add_subparsers(dest
='command')
80 parser_trace
= subparsers
.add_parser(
82 parents
=[parsers
.DEVICE
,
84 parsers
.DOWNLOAD_FORCE
,
85 parsers
.DOWNLOAD_MINIO_HOST
,
86 parsers
.DOWNLOAD_MINIO_BUCKET
,
87 parsers
.DOWNLOAD_ROLE_SESSION_NAME
,
90 parsers
.RESULTS_PATH
],
91 help=('Profiles specific trace given a device.'))
92 parser_trace
.add_argument(
94 help=('the relative path to the trace file inside the db path. '
95 'If not present and given that an URL has been provided '
96 'for its download, the relative path to the file in such URL.'))
97 parser_trace
.set_defaults(func
=_trace
)
99 parser_yaml
= subparsers
.add_parser(
101 parents
=[parsers
.DEVICE
,
103 parsers
.DOWNLOAD_FORCE
,
104 parsers
.DOWNLOAD_MINIO_HOST
,
105 parsers
.DOWNLOAD_MINIO_BUCKET
,
106 parsers
.DOWNLOAD_ROLE_SESSION_NAME
,
107 parsers
.DOWNLOAD_JWT
,
109 parsers
.RESULTS_PATH
],
110 help=('Profiles from a traces description file listing traces.'))
111 parser_yaml
.set_defaults(func
=_from_yaml
)
113 args
= parser
.parse_args(unparsed
)
115 return args
.func(args
)