##// END OF EJS Templates
revlog: subclass the new `repository.iverifyproblem` Protocol class...
revlog: subclass the new `repository.iverifyproblem` Protocol class This is the same transformation as 3a90a6fd710d did for dirstate, but the CamelCase naming was already cleaned up here. We shouldn't have to explicitly subclass, but I'm doing so to test the interplay of regular attributes and the `attrs` class. Also, PyCharm has a nifty feature that puts a jump point in the gutter to navigate back and forth between the base class and subclasses (and override functions and base class functions) when there's an explicit subclassing. Additionally, PyCharm will immediately flag signature mismatches without a 40m pytype run.

File last commit:

r52734:102770bb stable
r53365:4ef6dbc2 default
Show More
test-profile.t
194 lines | 5.0 KiB | text/troff | Tads3Lexer
Matt Mackall
tests: unify test-profile
r12478 test --time
Martin Geisler
dispatch: lowercase --time message
r16933 $ hg --time help -q help 2>&1 | grep time > /dev/null
Matt Mackall
tests: unify test-profile
r12478 $ hg init a
$ cd a
Martin von Zweigbergk
tests: make test-profile.t pass if statprof didn't collect samples...
r33611 Function to check that statprof ran
$ statprofran () {
Mads Kiilerich
tests: use grep -E instead of obsolescent egrep...
r51618 > grep -E 'Sample count:|No samples recorded' > /dev/null
Martin von Zweigbergk
tests: make test-profile.t pass if statprof didn't collect samples...
r33611 > }
Mads Kiilerich
tests: change odd uses of 'if hghave' to #if
r16898
Matt Mackall
tests: unify test-profile
r12478 test --profile
Martin von Zweigbergk
tests: make test-profile.t pass if statprof didn't collect samples...
r33611 $ hg st --profile 2>&1 | statprofran
profile: support --profile in alias and abbreviated version (--prof)...
r32787
Abreviated version
Martin von Zweigbergk
tests: make test-profile.t pass if statprof didn't collect samples...
r33611 $ hg st --prof 2>&1 | statprofran
profile: support --profile in alias and abbreviated version (--prof)...
r32787
In alias
Martin von Zweigbergk
tests: make test-profile.t pass if statprof didn't collect samples...
r33611 $ hg --config "alias.profst=status --profile" profst 2>&1 | statprofran
profile: support --profile in alias and abbreviated version (--prof)...
r32787
#if lsprof
Raphaël Gomès
windows: use shell function instead of variable substitution...
r48362 $ prof () {
> hg --config profiling.type=ls --profile $@
> }
Gregory Szorc
tests: explicitly use ls profiler...
r30259
Raphaël Gomès
windows: use shell function instead of variable substitution...
r48362 $ prof st 2>../out
Mads Kiilerich
tests: change odd uses of 'if hghave' to #if
r16898 $ grep CallCount ../out > /dev/null || cat ../out
Raphaël Gomès
windows: use shell function instead of variable substitution...
r48362 $ prof --config profiling.output=../out st
Mads Kiilerich
tests: change odd uses of 'if hghave' to #if
r16898 $ grep CallCount ../out > /dev/null || cat ../out
Raphaël Gomès
windows: use shell function instead of variable substitution...
r48362 $ prof --config profiling.output=blackbox --config extensions.blackbox= st
Durham Goode
profiling: allow logging profile to the blackbox...
r26191 $ grep CallCount .hg/blackbox.log > /dev/null || cat .hg/blackbox.log
Raphaël Gomès
windows: use shell function instead of variable substitution...
r48362 $ prof --config profiling.format=text st 2>../out
Mads Kiilerich
tests: change odd uses of 'if hghave' to #if
r16898 $ grep CallCount ../out > /dev/null || cat ../out
$ echo "[profiling]" >> $HGRCPATH
$ echo "format=kcachegrind" >> $HGRCPATH
Raphaël Gomès
windows: use shell function instead of variable substitution...
r48362 $ prof st 2>../out
Mads Kiilerich
tests: change odd uses of 'if hghave' to #if
r16898 $ grep 'events: Ticks' ../out > /dev/null || cat ../out
Raphaël Gomès
windows: use shell function instead of variable substitution...
r48362 $ prof --config profiling.output=../out st
Mads Kiilerich
tests: change odd uses of 'if hghave' to #if
r16898 $ grep 'events: Ticks' ../out > /dev/null || cat ../out
#endif
Mads Kiilerich
tests: add missing trailing 'cd ..'...
r16913
profiling: use "stat" profiler to profile individual request...
r52734 #if serve
Gregory Szorc
hgweb: profile HTTP requests...
r29787
Profiling of HTTP requests works
profiling: use "stat" profiler to profile individual request...
r52734 $ stats_prof () {
> hg --config profiling.type=stat --profile $@
> }
$ stats_prof \
test: display server error log in test-profile.t...
r52732 > --config profiling.format=text \
> --config profiling.output=../profile.log \
> serve -d \
> -p $HGPORT \
> --pid-file ../hg.pid \
> -A ../access.log \
> --errorlog ../error.log
Gregory Szorc
hgweb: profile HTTP requests...
r29787 $ cat ../hg.pid >> $DAEMON_PIDS
$ hg -q clone -U http://localhost:$HGPORT ../clone
test: display server error log in test-profile.t...
r52732 $ cat ../error.log
Gregory Szorc
hgweb: profile HTTP requests...
r29787
A single profile is logged because file logging doesn't append
profiling: use "stat" profiler to profile individual request...
r52734 $ grep 'Sample count:' ../profile.log | wc -l
\s*1 (re)
$ grep 'Total time:' ../profile.log | wc -l
Gregory Szorc
hgweb: profile HTTP requests...
r29787 \s*1 (re)
#endif
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316 Install an extension that can sleep and guarantee a profiler has time to run
Kyle Lippincott
statprof: separate functions and "line", assume 4 digit line numbers...
r46639 $ cat >> sleepext_with_a_long_filename.py << EOF
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316 > import time
Matt Harbison
py3: fix module imports in tests, as flagged by test-check-module-imports.t...
r40405 > from mercurial import registrar
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316 > cmdtable = {}
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 > command = registrar.command(cmdtable)
Pulkit Goyal
py3: add b'' prefixes in tests/test-profile.t...
r38086 > @command(b'sleep', [], b'hg sleep')
Kyle Lippincott
statprof: separate functions and "line", assume 4 digit line numbers...
r46639 > def sleep_for_at_least_one_stat_cycle(ui, *args, **kwargs):
Raphaël Gomès
windows: use cpu-intensive task instead of real time in test...
r48363 > t = time.time() # don't use time.sleep because we need CPU time
> while time.time() - t < 0.5:
> pass
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316 > EOF
$ cat >> $HGRCPATH << EOF
> [extensions]
Kyle Lippincott
statprof: separate functions and "line", assume 4 digit line numbers...
r46639 > sleep = `pwd`/sleepext_with_a_long_filename.py
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316 > EOF
statistical profiler works
Gregory Szorc
profiling: make statprof the default profiler (BC)...
r30317 $ hg --profile sleep 2>../out
Martin von Zweigbergk
tests: make test-profile.t pass if statprof didn't collect samples...
r33611 $ cat ../out | statprofran
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316
Various statprof formatters work
Augie Fackler
tests: add some helpful `|| cat` bits to test-profile.t...
r40517 $ hg --profile --config profiling.statformat=byline sleep 2>../out || cat ../out
test: try to unflaky test-profile.t...
r46208 $ grep -v _path_stat ../out | head -n 3
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316 % cumulative self
Pulkit Goyal
statprof: update the name as the i increases (issue6003)...
r40417 time seconds seconds name
Kyle Lippincott
statprof: separate functions and "line", assume 4 digit line numbers...
r46639 * sleepext_with_a_long_filename.py:*:sleep_for_at_least_one_stat_cycle (glob)
Martin von Zweigbergk
tests: make test-profile.t pass if statprof didn't collect samples...
r33611 $ cat ../out | statprofran
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316
Augie Fackler
tests: add some helpful `|| cat` bits to test-profile.t...
r40517 $ hg --profile --config profiling.statformat=bymethod sleep 2>../out || cat ../out
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316 $ head -n 1 ../out
% cumulative self
Martin von Zweigbergk
tests: make test-profile.t pass if statprof didn't collect samples...
r33611 $ cat ../out | statprofran
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316
Raphaël Gomès
windows: use cpu-intensive task instead of real time in test...
r48363 Windows real time tracking is broken, only use CPU
#if no-windows
$ hg --profile --config profiling.time-track=real --config profiling.statformat=hotpath sleep 2>../out || cat ../out
Martin von Zweigbergk
tests: make test-profile.t pass if statprof didn't collect samples...
r33611 $ cat ../out | statprofran
Raphaël Gomès
windows: use cpu-intensive task instead of real time in test...
r48363 $ grep sleepext_with_a_long_filename.py ../out | head -n 1
.* [0-9.]+% [0-9.]+s sleepext_with_a_long_filename.py:\s*sleep_for_at_least_one_stat_cycle, line \d+:\s+(while|pass).* (re)
#endif
$ hg --profile --config profiling.time-track=cpu --config profiling.statformat=hotpath sleep 2>../out || cat ../out
$ cat ../out | statprofran
$ grep sleepext_with_a_long_filename.py ../out | head -n 1
.* [0-9.]+% [0-9.]+s sleepext_with_a_long_filename.py:\s*sleep_for_at_least_one_stat_cycle, line \d+:\s+(while|pass).* (re)
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316
Augie Fackler
tests: add some helpful `|| cat` bits to test-profile.t...
r40517 $ hg --profile --config profiling.statformat=json sleep 2>../out || cat ../out
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316 $ cat ../out
Yuya Nishihara
test-profile: allow negative time in JSON output (issue5542)...
r32060 \[\[-?\d+.* (re)
Gregory Szorc
profiling: use vendored statprof and upstream enhancements (BC)...
r30316
Gregory Szorc
statprof: require input file...
r30845 statprof can be used as a standalone module
Matt Harbison
tests: quote PYTHON usage...
r39743 $ "$PYTHON" -m mercurial.statprof hotpath
Gregory Szorc
statprof: require input file...
r30845 must specify --file to load
[1]
Mads Kiilerich
tests: add missing trailing 'cd ..'...
r16913 $ cd ..
Jun Wu
profiling: allow loading profiling extension before everything else...
r32417
Jun Wu
test-profile: gate chg-incompatible part with '#if chg'...
r34446 #if no-chg
Jun Wu
profiling: allow loading profiling extension before everything else...
r32417 profiler extension could be loaded before other extensions
$ cat > fooprof.py <<EOF
> import contextlib
Gregory Szorc
py3: flush stdout...
r40236 > import sys
Jun Wu
profiling: allow loading profiling extension before everything else...
r32417 > @contextlib.contextmanager
> def profile(ui, fp):
> print('fooprof: start profile')
Gregory Szorc
py3: flush stdout...
r40236 > sys.stdout.flush()
Jun Wu
profiling: allow loading profiling extension before everything else...
r32417 > yield
> print('fooprof: end profile')
Gregory Szorc
py3: flush stdout...
r40236 > sys.stdout.flush()
Jun Wu
profiling: allow loading profiling extension before everything else...
r32417 > def extsetup(ui):
Pulkit Goyal
py3: add b'' prefixes in tests/test-profile.t...
r38086 > ui.write(b'fooprof: loaded\n')
Jun Wu
profiling: allow loading profiling extension before everything else...
r32417 > EOF
$ cat > otherextension.py <<EOF
> def extsetup(ui):
Pulkit Goyal
py3: add b'' prefixes in tests/test-profile.t...
r38086 > ui.write(b'otherextension: loaded\n')
Jun Wu
profiling: allow loading profiling extension before everything else...
r32417 > EOF
$ hg init b
$ cd b
$ cat >> .hg/hgrc <<EOF
> [extensions]
> other = $TESTTMP/otherextension.py
> fooprof = $TESTTMP/fooprof.py
> EOF
$ hg root
otherextension: loaded
fooprof: loaded
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 $TESTTMP/b
Jun Wu
profiling: allow loading profiling extension before everything else...
r32417 $ HGPROF=fooprof hg root --profile
fooprof: loaded
fooprof: start profile
otherextension: loaded
Matt Harbison
tests: remove (glob) annotations that were only for '\' matches...
r35394 $TESTTMP/b
Jun Wu
profiling: allow loading profiling extension before everything else...
r32417 fooprof: end profile
$ HGPROF=other hg root --profile 2>&1 | head -n 2
otherextension: loaded
unrecognized profiler 'other' - ignored
$ HGPROF=unknown hg root --profile 2>&1 | head -n 1
unrecognized profiler 'unknown' - ignored
$ cd ..
Jun Wu
test-profile: gate chg-incompatible part with '#if chg'...
r34446 #endif