mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 09:17:30 +03:00
2f33513a19
Summary: Use wrappers around ui functions to exclude interactive and log the results to scuba. Test Plan: USE_DIST_HG= FB_HG_DIAGS= CHGDISABLE= hg --config 'extensions.profiling=~/facebook-hg-rpms/fb-hgext/hgext3rd/profiling.py' --pager=off --config profiling.enabled=False amend --edit chg: disabled by CHGDISABLE internal stats file: /tmp/scm-internal-statsx9EXSw hg profiling mode: SKIPPED stats: { "int": { "builddate": 1471281577, "cachehitratio": 75, "consumed": 425, "diffcachehitratio": -1, "elapsed": 1921, "errorcode": 0, "filesnotincachehitratio": -1, "interactive_time": 1534, "internal_time": 1701, "time": 1473459054 }, Tested both with and without chg to make sure both modes work, otherwise there are some subtle bugs that can come up under hg (timer becomes persistent if invoked too early in uisetup). Check out scuba table, new columns are showing up. I still need to clean up the table as I accidentally added data as string first. Reviewers: #sourcecontrol, ttung, quark, durham Reviewed By: durham Subscribers: giorgioc, mjpieters, akushner Differential Revision: https://phabricator.intern.facebook.com/D3844697 Tasks: 12879683 Signature: t1:3844697:1475250469:a46aff22781e0e07596e2880d6477a62754f1397
27 lines
797 B
Perl
27 lines
797 B
Perl
$ extpath=`dirname $TESTDIR`
|
|
$ cp $extpath/hgext3rd/profiling.py $TESTTMP # use $TESTTMP substitution in message
|
|
$ cat >> $TESTTMP/logui.py << EOF
|
|
> def uisetup(ui):
|
|
> class uilogger(ui.__class__):
|
|
> def log(self, event, *msg, **opts):
|
|
> self.write(event + str(sorted(opts.keys())) + '\n')
|
|
> super(uilogger, self).log(event, *msg, **opts)
|
|
> ui.__class__ = uilogger
|
|
> EOF
|
|
$ cat >> $HGRCPATH << EOF
|
|
> [extensions]
|
|
> profiling=$TESTTMP/profiling.py
|
|
> logui=$TESTTMP/logui.py
|
|
> EOF
|
|
|
|
Test any command produces profiling output
|
|
$ hg init repo
|
|
command[]
|
|
profiletime['interactive_time', 'internal_time']
|
|
commandfinish[]
|
|
$ cd repo
|
|
$ hg status
|
|
command[]
|
|
profiletime['interactive_time', 'internal_time']
|
|
commandfinish[]
|