mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
perftweaks: start logging active sparse profiles
Summary: Log active profiles for any command that uses the repository. Test Plan: arc unit Reviewers: #sourcecontrol, mitrandir Reviewed By: mitrandir Subscribers: andrasbelo, mitrandir, mjpieters Differential Revision: https://phabricator.intern.facebook.com/D4346795 Signature: t1:4346795:1482251224:a9b3568eeb7e57c61273ce0dc9f4d41abcd2888e
This commit is contained in:
parent
5c73644ae8
commit
1c54b7f189
@ -32,6 +32,7 @@ def extsetup(ui):
|
||||
wrapfunction(branchmap.branchcache, 'write', _branchmapwrite)
|
||||
wrapfunction(branchmap, 'read', _branchmapread)
|
||||
wrapfunction(dispatch, 'runcommand', _trackdirstatesizes)
|
||||
wrapfunction(dispatch, 'runcommand', _tracksparseprofiles)
|
||||
|
||||
def _readtagcache(orig, ui, repo):
|
||||
"""Disables reading tags if the repo is known to not contain any."""
|
||||
@ -191,3 +192,12 @@ def _trackdirstatesizes(runcommand, lui, repo, *args):
|
||||
if logsize:
|
||||
lui.log('dirstate_size', '', dirstate_size=len(dirstate._map))
|
||||
return res
|
||||
|
||||
def _tracksparseprofiles(runcommand, lui, repo, *args):
|
||||
res = runcommand(lui, repo, *args)
|
||||
if repo is not None and repo.local():
|
||||
if util.safehasattr(repo, 'getactiveprofiles'):
|
||||
profiles = repo.getactiveprofiles()
|
||||
lui.log('sparse_profiles', '',
|
||||
active_profiles=sorted(profiles))
|
||||
return res
|
||||
|
@ -121,7 +121,7 @@ Test file permissions
|
||||
drwxrw[sx]r-x.? [0-9]+ .* \.\. (re)
|
||||
-rw-rw-r--.? 1 .* branchheads-served (re)
|
||||
|
||||
Test logging the dirsize
|
||||
Test logging the dirsize and sparse profiles
|
||||
|
||||
Set up the sampling extension and set a log file, then do a repo status.
|
||||
We need to disable the SCM_SAMPLING_FILEPATH env var because arcanist may set it!
|
||||
@ -131,6 +131,7 @@ We need to disable the SCM_SAMPLING_FILEPATH env var because arcanist may set it
|
||||
$ cat >> $HGRCPATH << EOF
|
||||
> [sampling]
|
||||
> key.dirstate_size=dirstate_size
|
||||
> key.sparse_profiles=sparse_profiles
|
||||
> filepath = $LOGDIR/samplingpath.txt
|
||||
> [extensions]
|
||||
> sampling=
|
||||
@ -147,3 +148,27 @@ We need to disable the SCM_SAMPLING_FILEPATH env var because arcanist may set it
|
||||
... print '{0}: {1}'.format(parsedrecord['category'],
|
||||
... parsedrecord['data']['dirstate_size'])
|
||||
dirstate_size: 1
|
||||
$ cat >> $HGRCPATH << EOF
|
||||
> [extensions]
|
||||
> sparse=
|
||||
> EOF
|
||||
$ cat >> profile_base << EOF
|
||||
> [include]
|
||||
> a
|
||||
> EOF
|
||||
$ cat >> profile_extended << EOF
|
||||
> %include profile_base
|
||||
> EOF
|
||||
$ hg add profile_base profile_extended
|
||||
$ hg ci -m 'adding sparse profiles'
|
||||
$ hg sparse --enable-profile profile_extended
|
||||
>>> import json
|
||||
>>> with open("$LOGDIR/samplingpath.txt") as f:
|
||||
... data = f.read()
|
||||
>>> for record in data.strip("\0").split("\0"):
|
||||
... parsedrecord = json.loads(record)
|
||||
... if parsedrecord['category'] == 'sparse_profiles':
|
||||
... print 'active_profiles:', ', '.join(parsedrecord['data']['active_profiles'])
|
||||
active_profiles:
|
||||
active_profiles:
|
||||
active_profiles: profile_base, profile_extended
|
||||
|
Loading…
Reference in New Issue
Block a user