comparison contrib/perf-utils/compare-discovery-case @ 49461:ebbaf6a77807

compare-disco: add an option to skip the case If we already know the context, we can save a lot of display space by skipping the case. This also open the way to speedup to the way we specify the subsets. (the code is hacky, but this is a quicky and dirty debug script)
author Pierre-Yves DAVID <pierre-yves.david@octobus.net>
date Sat, 04 Jun 2022 19:04:01 +0200
parents 3c026138f234
children ef0b0f94d2e5
comparison
equal deleted inserted replaced
49460:3c026138f234 49461:ebbaf6a77807
116 def compare( 116 def compare(
117 repo, 117 repo,
118 local_case, 118 local_case,
119 remote_case, 119 remote_case,
120 display_header=True, 120 display_header=True,
121 display_case=True,
121 ): 122 ):
122 case = (repo, local_case, remote_case) 123 case = (repo, local_case, remote_case)
123 if display_header: 124 if display_header:
124 print( 125 pieces = ['#']
125 "#", 126 if display_case:
126 "repo", 127 pieces += [
127 "local-subset", 128 "repo",
128 "remote-subset", 129 "local-subset",
130 "remote-subset",
131 ]
132
133 pieces += [
129 "discovery-variant", 134 "discovery-variant",
130 "roundtrips", 135 "roundtrips",
131 "queries", 136 "queries",
132 "revs", 137 "revs",
133 "local-heads", 138 "local-heads",
134 "common-heads", 139 "common-heads",
135 "undecided-initial", 140 "undecided-initial",
136 "undecided-common", 141 "undecided-common",
137 "undecided-missing", 142 "undecided-missing",
138 ) 143 ]
144 print(*pieces)
139 for variant in VARIANTS_KEYS: 145 for variant in VARIANTS_KEYS:
140 res = process(case, VARIANTS[variant]) 146 res = process(case, VARIANTS[variant])
141 revs = res["nb-revs"] 147 revs = res["nb-revs"]
142 local_heads = res["nb-head-local"] 148 local_heads = res["nb-head-local"]
143 common_heads = res["nb-common-heads"] 149 common_heads = res["nb-common-heads"]
144 roundtrips = res["total-roundtrips"] 150 roundtrips = res["total-roundtrips"]
145 queries = res["total-queries"] 151 queries = res["total-queries"]
146 if 'tree-discovery' in variant: 152 pieces = []
147 print( 153 if display_case:
154 pieces += [
148 repo, 155 repo,
149 format_case(local_case), 156 format_case(local_case),
150 format_case(remote_case), 157 format_case(remote_case),
151 variant, 158 ]
152 roundtrips, 159 pieces += [
153 queries, 160 variant,
154 revs, 161 roundtrips,
155 local_heads, 162 queries,
156 common_heads, 163 revs,
157 ) 164 local_heads,
158 else: 165 common_heads,
166 ]
167 if 'tree-discovery' not in variant:
159 undecided_common = res["nb-ini_und-common"] 168 undecided_common = res["nb-ini_und-common"]
160 undecided_missing = res["nb-ini_und-missing"] 169 undecided_missing = res["nb-ini_und-missing"]
161 undecided = undecided_common + undecided_missing 170 undecided = undecided_common + undecided_missing
162 print( 171 pieces += [
163 repo,
164 format_case(local_case),
165 format_case(remote_case),
166 variant,
167 roundtrips,
168 queries,
169 revs,
170 local_heads,
171 common_heads,
172 undecided, 172 undecided,
173 undecided_common, 173 undecided_common,
174 undecided_missing, 174 undecided_missing,
175 ) 175 ]
176 print(*pieces)
176 return 0 177 return 0
177 178
178 179
179 def process(case, variant): 180 def process(case, variant):
180 (repo, left, right) = case 181 (repo, left, right) = case
198 kwargs = {} 199 kwargs = {}
199 # primitive arg parsing 200 # primitive arg parsing
200 if '--no-header' in argv: 201 if '--no-header' in argv:
201 kwargs['display_header'] = False 202 kwargs['display_header'] = False
202 argv = [a for a in argv if a != '--no-header'] 203 argv = [a for a in argv if a != '--no-header']
204 if '--no-case' in argv:
205 kwargs['display_case'] = False
206 argv = [a for a in argv if a != '--no-case']
203 207
204 if len(argv) != 4: 208 if len(argv) != 4:
205 usage = f'USAGE: {script_name} REPO LOCAL_CASE REMOTE_CASE' 209 usage = f'USAGE: {script_name} REPO LOCAL_CASE REMOTE_CASE'
206 print(usage, file=sys.stderr) 210 print(usage, file=sys.stderr)
207 sys.exit(128) 211 sys.exit(128)