1151 |
1151 |
1152 timer, fm = gettimer(ui, opts) |
1152 timer, fm = gettimer(ui, opts) |
1153 timer(format) |
1153 timer(format) |
1154 fm.end() |
1154 fm.end() |
1155 |
1155 |
|
1156 @command(b'perfhelper-tracecopies', formatteropts + |
|
1157 [ |
|
1158 (b'r', b'revs', [], b'restrict search to these revisions'), |
|
1159 ]) |
|
1160 def perfhelpertracecopies(ui, repo, revs=[], **opts): |
|
1161 """find statistic about potential parameters for the `perftracecopies` |
|
1162 |
|
1163 This command find source-destination pair relevant for copytracing testing. |
|
1164 It report value for some of the parameters that impact copy tracing time. |
|
1165 """ |
|
1166 opts = _byteskwargs(opts) |
|
1167 fm = ui.formatter(b'perf', opts) |
|
1168 header = '%12s %12s %12s %12s\n' |
|
1169 output = ("%(source)12s %(destination)12s " |
|
1170 "%(nbrevs)12d %(nbmissingfiles)12d\n") |
|
1171 fm.plain(header % ("source", "destination", "nb-revs", "nb-files")) |
|
1172 |
|
1173 if not revs: |
|
1174 revs = ['all()'] |
|
1175 revs = scmutil.revrange(repo, revs) |
|
1176 |
|
1177 roi = repo.revs('merge() and %ld', revs) |
|
1178 for r in roi: |
|
1179 ctx = repo[r] |
|
1180 p1 = ctx.p1().rev() |
|
1181 p2 = ctx.p2().rev() |
|
1182 bases = repo.changelog._commonancestorsheads(p1, p2) |
|
1183 for p in (p1, p2): |
|
1184 for b in bases: |
|
1185 base = repo[b] |
|
1186 parent = repo[p] |
|
1187 missing = copies._computeforwardmissing(base, parent) |
|
1188 if not missing: |
|
1189 continue |
|
1190 fm.startitem() |
|
1191 data = { |
|
1192 b'source': base.hex(), |
|
1193 b'destination': parent.hex(), |
|
1194 b'nbrevs': len(repo.revs('%d::%d', b, p)), |
|
1195 b'nbmissingfiles': len(missing), |
|
1196 } |
|
1197 fm.data(**data) |
|
1198 out = data.copy() |
|
1199 out['source'] = fm.hexfunc(base.node()) |
|
1200 out['destination'] = fm.hexfunc(parent.node()) |
|
1201 fm.plain(output % out) |
|
1202 fm.end() |
|
1203 |
1156 @command(b'perfcca', formatteropts) |
1204 @command(b'perfcca', formatteropts) |
1157 def perfcca(ui, repo, **opts): |
1205 def perfcca(ui, repo, **opts): |
1158 opts = _byteskwargs(opts) |
1206 opts = _byteskwargs(opts) |
1159 timer, fm = gettimer(ui, opts) |
1207 timer, fm = gettimer(ui, opts) |
1160 timer(lambda: scmutil.casecollisionauditor(ui, False, repo.dirstate)) |
1208 timer(lambda: scmutil.casecollisionauditor(ui, False, repo.dirstate)) |