##// END OF EJS Templates
debug-revlog: details about non-ancestors delta-bases...
marmoute -
r50556:511106bc default
parent child Browse files
Show More
@@ -302,13 +302,19 b' def debug_revlog(ui, revlog):'
302 numsemi = 0
302 numsemi = 0
303 # snapshot count per depth
303 # snapshot count per depth
304 numsnapdepth = collections.defaultdict(lambda: 0)
304 numsnapdepth = collections.defaultdict(lambda: 0)
305 # number of snapshots with a non-ancestor delta
306 numsnapdepth_nad = collections.defaultdict(lambda: 0)
305 # delta against previous revision
307 # delta against previous revision
306 numprev = 0
308 numprev = 0
309 # delta against prev, where prev is a non-ancestor
310 numprev_nad = 0
307 # delta against first or second parent (not prev)
311 # delta against first or second parent (not prev)
308 nump1 = 0
312 nump1 = 0
309 nump2 = 0
313 nump2 = 0
310 # delta against neither prev nor parents
314 # delta against neither prev nor parents
311 numother = 0
315 numother = 0
316 # delta against other that is a non-ancestor
317 numother_nad = 0
312 # delta against prev that are also first or second parent
318 # delta against prev that are also first or second parent
313 # (details of `numprev`)
319 # (details of `numprev`)
314 nump1prev = 0
320 nump1prev = 0
@@ -358,6 +364,9 b' def debug_revlog(ui, revlog):'
358 addsize(size, fullsize)
364 addsize(size, fullsize)
359 addsize(size, snapsizedepth[0])
365 addsize(size, snapsizedepth[0])
360 else:
366 else:
367 nad = (
368 delta != p1 and delta != p2 and not r.isancestorrev(delta, rev)
369 )
361 chainlengths.append(chainlengths[delta] + 1)
370 chainlengths.append(chainlengths[delta] + 1)
362 baseaddr = chainbases[delta]
371 baseaddr = chainbases[delta]
363 revaddr = r.start(rev)
372 revaddr = r.start(rev)
@@ -371,6 +380,8 b' def debug_revlog(ui, revlog):'
371 numsemi += 1
380 numsemi += 1
372 depth = r.snapshotdepth(rev)
381 depth = r.snapshotdepth(rev)
373 numsnapdepth[depth] += 1
382 numsnapdepth[depth] += 1
383 if nad:
384 numsnapdepth_nad[depth] += 1
374 addsize(size, snapsizedepth[depth])
385 addsize(size, snapsizedepth[depth])
375 else:
386 else:
376 addsize(size, deltasize)
387 addsize(size, deltasize)
@@ -380,12 +391,15 b' def debug_revlog(ui, revlog):'
380 nump1prev += 1
391 nump1prev += 1
381 elif delta == p2:
392 elif delta == p2:
382 nump2prev += 1
393 nump2prev += 1
394 elif nad:
395 numprev_nad += 1
383 elif delta == p1:
396 elif delta == p1:
384 nump1 += 1
397 nump1 += 1
385 elif delta == p2:
398 elif delta == p2:
386 nump2 += 1
399 nump2 += 1
387 elif delta != nodemod.nullrev:
400 elif delta != nodemod.nullrev:
388 numother += 1
401 numother += 1
402 numother_nad += 1
389
403
390 # Obtain data on the raw chunks in the revlog.
404 # Obtain data on the raw chunks in the revlog.
391 if util.safehasattr(r, '_getsegmentforrevs'):
405 if util.safehasattr(r, '_getsegmentforrevs'):
@@ -410,7 +424,8 b' def debug_revlog(ui, revlog):'
410 size[0] = 0
424 size[0] = 0
411
425
412 numdeltas = numrevs - numfull - numempty - numsemi
426 numdeltas = numrevs - numfull - numempty - numsemi
413 numoprev = numprev - nump1prev - nump2prev
427 numoprev = numprev - nump1prev - nump2prev - numprev_nad
428 num_other_ancestors = numother - numother_nad
414 totalrawsize = datasize[2]
429 totalrawsize = datasize[2]
415 datasize[2] /= numrevs
430 datasize[2] /= numrevs
416 fulltotal = fullsize[2]
431 fulltotal = fullsize[2]
@@ -477,10 +492,17 b' def debug_revlog(ui, revlog):'
477 b' snapshot : ' + fmt % pcfmt(numfull + numsemi, numrevs)
492 b' snapshot : ' + fmt % pcfmt(numfull + numsemi, numrevs)
478 )
493 )
479 for depth in sorted(numsnapdepth):
494 for depth in sorted(numsnapdepth):
480 ui.write(
495 base = b' lvl-%-3d : ' % depth
481 (b' lvl-%-3d : ' % depth)
496 count = fmt % pcfmt(numsnapdepth[depth], numrevs)
482 + fmt % pcfmt(numsnapdepth[depth], numrevs)
497 pieces = [base, count]
483 )
498 if numsnapdepth_nad[depth]:
499 pieces[-1] = count = count[:-1] # drop the final '\n'
500 more = b' non-ancestor-bases: '
501 anc_count = fmt
502 anc_count %= pcfmt(numsnapdepth_nad[depth], numsnapdepth[depth])
503 pieces.append(more)
504 pieces.append(anc_count)
505 ui.write(b''.join(pieces))
484 ui.writenoi18n(b' deltas : ' + fmt % pcfmt(numdeltas, numrevs))
506 ui.writenoi18n(b' deltas : ' + fmt % pcfmt(numdeltas, numrevs))
485 ui.writenoi18n(b'revision size : ' + fmt2 % totalsize)
507 ui.writenoi18n(b'revision size : ' + fmt2 % totalsize)
486 ui.writenoi18n(
508 ui.writenoi18n(
@@ -561,7 +583,10 b' def debug_revlog(ui, revlog):'
561 b' where prev = p2 : ' + fmt2 % pcfmt(nump2prev, numprev)
583 b' where prev = p2 : ' + fmt2 % pcfmt(nump2prev, numprev)
562 )
584 )
563 ui.writenoi18n(
585 ui.writenoi18n(
564 b' other : ' + fmt2 % pcfmt(numoprev, numprev)
586 b' other-ancestor : ' + fmt2 % pcfmt(numoprev, numprev)
587 )
588 ui.writenoi18n(
589 b' unrelated : ' + fmt2 % pcfmt(numoprev, numprev)
565 )
590 )
566 if gdelta:
591 if gdelta:
567 ui.writenoi18n(
592 ui.writenoi18n(
@@ -571,5 +596,10 b' def debug_revlog(ui, revlog):'
571 b'deltas against p2 : ' + fmt % pcfmt(nump2, numdeltas)
596 b'deltas against p2 : ' + fmt % pcfmt(nump2, numdeltas)
572 )
597 )
573 ui.writenoi18n(
598 ui.writenoi18n(
574 b'deltas against other : ' + fmt % pcfmt(numother, numdeltas)
599 b'deltas against ancs : '
600 + fmt % pcfmt(num_other_ancestors, numdeltas)
575 )
601 )
602 ui.writenoi18n(
603 b'deltas against other : '
604 + fmt % pcfmt(numother_nad, numdeltas)
605 )
@@ -105,11 +105,11 b' repeatedly while some of it changes rare'
105 delta : 0 (100.00%)
105 delta : 0 (100.00%)
106 snapshot : 383 ( 7.66%)
106 snapshot : 383 ( 7.66%)
107 lvl-0 : 3 ( 0.06%)
107 lvl-0 : 3 ( 0.06%)
108 lvl-1 : 18 ( 0.36%)
108 lvl-1 : 18 ( 0.36%) non-ancestor-bases: 9 (50.00%)
109 lvl-2 : 62 ( 1.24%)
109 lvl-2 : 62 ( 1.24%) non-ancestor-bases: 58 (93.55%)
110 lvl-3 : 108 ( 2.16%)
110 lvl-3 : 108 ( 2.16%) non-ancestor-bases: 108 (100.00%)
111 lvl-4 : 191 ( 3.82%)
111 lvl-4 : 191 ( 3.82%) non-ancestor-bases: 180 (94.24%)
112 lvl-5 : 1 ( 0.02%)
112 lvl-5 : 1 ( 0.02%) non-ancestor-bases: 1 (100.00%)
113 deltas : 4618 (92.34%)
113 deltas : 4618 (92.34%)
114 revision size : 58616973
114 revision size : 58616973
115 snapshot : 9247844 (15.78%)
115 snapshot : 9247844 (15.78%)
@@ -144,9 +144,11 b' repeatedly while some of it changes rare'
144 deltas against prev : 3906 (84.58%)
144 deltas against prev : 3906 (84.58%)
145 where prev = p1 : 3906 (100.00%)
145 where prev = p1 : 3906 (100.00%)
146 where prev = p2 : 0 ( 0.00%)
146 where prev = p2 : 0 ( 0.00%)
147 other : 0 ( 0.00%)
147 other-ancestor : 0 ( 0.00%)
148 unrelated : 0 ( 0.00%)
148 deltas against p1 : 649 (14.05%)
149 deltas against p1 : 649 (14.05%)
149 deltas against p2 : 63 ( 1.36%)
150 deltas against p2 : 63 ( 1.36%)
151 deltas against ancs : 0 ( 0.00%)
150 deltas against other : 0 ( 0.00%)
152 deltas against other : 0 ( 0.00%)
151
153
152
154
General Comments 0
You need to be logged in to leave comments. Login now