Mercurial > evolve
changeset 4834:9a52930f6781
stablesort: introduce a small debugstablesortcache command
This give a small insight on the cache content.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Sun, 08 Sep 2019 13:31:28 +0200 |
parents | 72cebe6642d7 |
children | 7c38a4353bb3 |
files | hgext3rd/evolve/stablesort.py |
diffstat | 1 files changed, 40 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/stablesort.py Sun Sep 08 11:56:11 2019 +0200 +++ b/hgext3rd/evolve/stablesort.py Sun Sep 08 13:31:28 2019 +0200 @@ -156,6 +156,46 @@ displayer.flush(ctx) displayer.close() +@eh.command( + b'debugstablesortcache', + [] + commands.formatteropts, + _(b'')) +def debugstablesortcache(ui, repo, **opts): + """display data about the stable sort cache of a repository + """ + unfi = repo.unfiltered() + revs = unfi.revs('all()') + nbrevs = len(revs) + ui.write('number of revisions: %12d\n' % nbrevs) + merge = unfi.revs('merge()') + nbmerge = len(merge) + cache = unfi.stablesort + ui.write('number of merge: %12d\n' % nbmerge) + alljumps = [] + alljumpssize = [] + for r in merge: + jumps = cache.getjumps(unfi, r) + if jumps is None: + continue # not a merge + jumps = list(jumps) + alljumps.append(jumps) + alljumpssize.append(len(jumps)) + nbjumps = sum(alljumpssize) + ui.write('number of jumps: %12d\n' % nbjumps) + if not nbjumps: + return 0 + avgjumps = nbjumps / float(len(alljumpssize)) + ui.write('average jumps: %6.3f\n' % avgjumps) + alljumpssize.sort() + medianjumps = alljumpssize[len(alljumpssize) // 2] + ui.write('median jumps: %12d\n' % medianjumps) + tensjumps = alljumpssize[len(alljumpssize) * 9 // 10] + ui.write('90%% jumps: %12d\n' % tensjumps) + centsjumps = alljumpssize[len(alljumpssize) * 99 // 100] + ui.write('99%% jumps: %12d\n' % centsjumps) + ui.write('max jumps: %12d\n' % max(alljumpssize)) + ui.write('jump cache size: %12d bytes\n' % (nbjumps * 12)) + def stablesort_branchpoint(repo, revs, mergecallback=None): """return '::revs' topologically sorted in "stable" order