Show More
@@ -882,23 +882,72 b' def perfheads(ui, repo, **opts):' | |||
|
882 | 882 | fm.end() |
|
883 | 883 | |
|
884 | 884 | |
|
885 | def _default_clear_on_disk_tags_cache(repo): | |
|
886 | from mercurial import tags | |
|
887 | ||
|
888 | repo.cachevfs.tryunlink(tags._filename(repo)) | |
|
889 | ||
|
890 | ||
|
891 | def _default_clear_on_disk_tags_fnodes_cache(repo): | |
|
892 | from mercurial import tags | |
|
893 | ||
|
894 | repo.cachevfs.tryunlink(tags._fnodescachefile) | |
|
895 | ||
|
896 | ||
|
885 | 897 | @command( |
|
886 | 898 | b'perf::tags|perftags', |
|
887 | 899 | formatteropts |
|
888 | 900 | + [ |
|
889 | 901 | (b'', b'clear-revlogs', False, b'refresh changelog and manifest'), |
|
902 | ( | |
|
903 | b'', | |
|
904 | b'clear-on-disk-cache', | |
|
905 | False, | |
|
906 | b'clear on disk tags cache (DESTRUCTIVE)', | |
|
907 | ), | |
|
908 | ( | |
|
909 | b'', | |
|
910 | b'clear-fnode-cache', | |
|
911 | False, | |
|
912 | b'clear on disk file node cache (DESTRUCTIVE),', | |
|
913 | ), | |
|
890 | 914 | ], |
|
891 | 915 | ) |
|
892 | 916 | def perftags(ui, repo, **opts): |
|
917 | """Benchmark tags retrieval in various situation | |
|
918 | ||
|
919 | The option marked as (DESTRUCTIVE) will alter the on-disk cache, possibly | |
|
920 | altering performance after the command was run. However, it does not | |
|
921 | destroy any stored data. | |
|
922 | """ | |
|
923 | from mercurial import tags | |
|
924 | ||
|
893 | 925 | opts = _byteskwargs(opts) |
|
894 | 926 | timer, fm = gettimer(ui, opts) |
|
895 | 927 | repocleartagscache = repocleartagscachefunc(repo) |
|
896 | 928 | clearrevlogs = opts[b'clear_revlogs'] |
|
929 | clear_disk = opts[b'clear_on_disk_cache'] | |
|
930 | clear_fnode = opts[b'clear_fnode_cache'] | |
|
931 | ||
|
932 | clear_disk_fn = getattr( | |
|
933 | tags, | |
|
934 | "clear_cache_on_disk", | |
|
935 | _default_clear_on_disk_tags_cache, | |
|
936 | ) | |
|
937 | clear_fnodes_fn = getattr( | |
|
938 | tags, | |
|
939 | "clear_cache_fnodes", | |
|
940 | _default_clear_on_disk_tags_fnodes_cache, | |
|
941 | ) | |
|
897 | 942 | |
|
898 | 943 | def s(): |
|
899 | 944 | if clearrevlogs: |
|
900 | 945 | clearchangelog(repo) |
|
901 | 946 | clearfilecache(repo.unfiltered(), 'manifest') |
|
947 | if clear_disk: | |
|
948 | clear_disk_fn(repo) | |
|
949 | if clear_fnode: | |
|
950 | clear_fnodes_fn(repo) | |
|
902 | 951 | repocleartagscache() |
|
903 | 952 | |
|
904 | 953 | def t(): |
@@ -910,3 +910,13 b' class hgtagsfnodescache:' | |||
|
910 | 910 | ) |
|
911 | 911 | finally: |
|
912 | 912 | lock.release() |
|
913 | ||
|
914 | ||
|
915 | def clear_cache_on_disk(repo): | |
|
916 | """function used by the perf extension to "tags" cache""" | |
|
917 | repo.cachevfs.tryunlink(_filename(repo)) | |
|
918 | ||
|
919 | ||
|
920 | def clear_cache_fnodes(repo): | |
|
921 | """function used by the perf extension to clear "file node cache""" | |
|
922 | repo.cachevfs.tryunlink(_filename(repo)) |
@@ -194,7 +194,7 b' perfstatus' | |||
|
194 | 194 | benchmark the full generation of a stream clone |
|
195 | 195 | perf::stream-locked-section |
|
196 | 196 | benchmark the initial, repo-locked, section of a stream-clone |
|
197 | perf::tags (no help text available) | |
|
197 | perf::tags Benchmark tags retrieval in various situation | |
|
198 | 198 | perf::templating |
|
199 | 199 | test the rendering time of a given template |
|
200 | 200 | perf::unbundle |
General Comments 0
You need to be logged in to leave comments.
Login now