##// END OF EJS Templates
debug-delta-chain: actually skip unrequested computation...
marmoute -
r51967:5b5cb6b8 default
parent child Browse files
Show More
@@ -721,7 +721,7 b' class DeltaChainAuditor:'
721 # security to avoid crash on corrupted revlogs
721 # security to avoid crash on corrupted revlogs
722 self._total_revs = len(self._index)
722 self._total_revs = len(self._index)
723
723
724 def revinfo(self, rev):
724 def revinfo(self, rev, size_info=True, dist_info=True, sparse_info=True):
725 e = self._index[rev]
725 e = self._index[rev]
726 compsize = e[constants.ENTRY_DATA_COMPRESSED_LENGTH]
726 compsize = e[constants.ENTRY_DATA_COMPRESSED_LENGTH]
727 uncompsize = e[constants.ENTRY_DATA_UNCOMPRESSED_LENGTH]
727 uncompsize = e[constants.ENTRY_DATA_UNCOMPRESSED_LENGTH]
@@ -788,26 +788,30 b' class DeltaChainAuditor:'
788 deltatype = b'prev'
788 deltatype = b'prev'
789
789
790 chain = self._revlog._deltachain(rev)[0]
790 chain = self._revlog._deltachain(rev)[0]
791 chain_size = 0
792 for iter_rev in reversed(chain):
793 cached = self._chain_size_cache.get(iter_rev)
794 if cached is not None:
795 chain_size += cached
796 break
797 e = self._index[iter_rev]
798 chain_size += e[constants.ENTRY_DATA_COMPRESSED_LENGTH]
799 self._chain_size_cache[rev] = chain_size
800
791
801 return {
792 data = {
802 'p1': p1,
793 'p1': p1,
803 'p2': p2,
794 'p2': p2,
804 'compressed_size': compsize,
795 'compressed_size': compsize,
805 'uncompressed_size': uncompsize,
796 'uncompressed_size': uncompsize,
806 'deltatype': deltatype,
797 'deltatype': deltatype,
807 'chain': chain,
798 'chain': chain,
808 'chain_size': chain_size,
809 }
799 }
810
800
801 if size_info or dist_info or sparse_info:
802 chain_size = 0
803 for iter_rev in reversed(chain):
804 cached = self._chain_size_cache.get(iter_rev)
805 if cached is not None:
806 chain_size += cached
807 break
808 e = self._index[iter_rev]
809 chain_size += e[constants.ENTRY_DATA_COMPRESSED_LENGTH]
810 self._chain_size_cache[rev] = chain_size
811 data['chain_size'] = chain_size
812
813 return data
814
811
815
812 def debug_delta_chain(
816 def debug_delta_chain(
813 revlog,
817 revlog,
@@ -848,31 +852,39 b' def debug_delta_chain('
848
852
849 chainbases = {}
853 chainbases = {}
850 for rev in all_revs:
854 for rev in all_revs:
851 info = auditor.revinfo(rev)
855 info = auditor.revinfo(
856 rev,
857 size_info=size_info,
858 dist_info=dist_info,
859 sparse_info=sparse_info,
860 )
852 comp = info['compressed_size']
861 comp = info['compressed_size']
853 uncomp = info['uncompressed_size']
862 uncomp = info['uncompressed_size']
854 chain = info['chain']
863 chain = info['chain']
855 chainbase = chain[0]
864 chainbase = chain[0]
856 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
865 chainid = chainbases.setdefault(chainbase, len(chainbases) + 1)
857 basestart = start(chainbase)
866 if dist_info:
858 revstart = start(rev)
867 basestart = start(chainbase)
859 lineardist = revstart + comp - basestart
868 revstart = start(rev)
860 chainsize = info['chain_size']
869 lineardist = revstart + comp - basestart
861 extradist = lineardist - chainsize
870 extradist = lineardist - info['chain_size']
862 try:
871 try:
863 prevrev = chain[-2]
872 prevrev = chain[-2]
864 except IndexError:
873 except IndexError:
865 prevrev = -1
874 prevrev = -1
866
875
867 if uncomp != 0:
876 if size_info:
868 chainratio = float(chainsize) / float(uncomp)
877 chainsize = info['chain_size']
869 else:
878 if uncomp != 0:
870 chainratio = chainsize
879 chainratio = float(chainsize) / float(uncomp)
880 else:
881 chainratio = chainsize
871
882
872 if chainsize != 0:
883 if dist_info:
873 extraratio = float(extradist) / float(chainsize)
884 if chainsize != 0:
874 else:
885 extraratio = float(extradist) / float(chainsize)
875 extraratio = extradist
886 else:
887 extraratio = extradist
876
888
877 # label, display-format, data-key, value
889 # label, display-format, data-key, value
878 entry = [
890 entry = [
@@ -902,6 +914,7 b' def debug_delta_chain('
902 ]
914 ]
903 )
915 )
904 if withsparseread and sparse_info:
916 if withsparseread and sparse_info:
917 chainsize = info['chain_size']
905 readsize = 0
918 readsize = 0
906 largestblock = 0
919 largestblock = 0
907 srchunks = 0
920 srchunks = 0
General Comments 0
You need to be logged in to leave comments. Login now