tests/test-profile.t
author Gregory Szorc <gregory.szorc@gmail.com>
Wed, 17 Aug 2016 08:52:15 -0700
changeset 30259 d06c049695e6
parent 29787 80df04266a16
child 30316 faf1b8923da2
permissions -rw-r--r--
tests: explicitly use ls profiler In preparation for making the statprof profiler the default.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
12478
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
     1
test --time
5099
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
     2
16933
30143c3dd102 dispatch: lowercase --time message
Martin Geisler <mg@aragost.com>
parents: 16913
diff changeset
     3
  $ hg --time help -q help 2>&1 | grep time > /dev/null
12478
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
     4
  $ hg init a
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
     5
  $ cd a
8022
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
     6
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
     7
#if lsprof
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
     8
12478
bb665db49e32 tests: unify test-profile
Matt Mackall <mpm@selenic.com>
parents: 8024
diff changeset
     9
test --profile
8022
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
    10
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
    11
  $ prof='hg --config profiling.type=ls --profile'
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
    12
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
    13
  $ $prof st 2>../out
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    14
  $ grep CallCount ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    15
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
    16
  $ $prof --config profiling.output=../out st
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    17
  $ grep CallCount ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    18
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
    19
  $ $prof --config profiling.output=blackbox --config extensions.blackbox= st
26191
39a0b11158d8 profiling: allow logging profile to the blackbox
Durham Goode <durham@fb.com>
parents: 18765
diff changeset
    20
  $ grep CallCount .hg/blackbox.log > /dev/null || cat .hg/blackbox.log
39a0b11158d8 profiling: allow logging profile to the blackbox
Durham Goode <durham@fb.com>
parents: 18765
diff changeset
    21
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
    22
  $ $prof --config profiling.format=text st 2>../out
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    23
  $ grep CallCount ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    24
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    25
  $ echo "[profiling]" >> $HGRCPATH
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    26
  $ echo "format=kcachegrind" >> $HGRCPATH
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    27
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
    28
  $ $prof st 2>../out
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    29
  $ grep 'events: Ticks' ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    30
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
    31
  $ $prof --config profiling.output=../out st
16898
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    32
  $ grep 'events: Ticks' ../out > /dev/null || cat ../out
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    33
bb91c602d4ad tests: change odd uses of 'if hghave' to #if
Mads Kiilerich <mads@kiilerich.com>
parents: 12478
diff changeset
    34
#endif
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16898
diff changeset
    35
29787
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    36
#if lsprof serve
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    37
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    38
Profiling of HTTP requests works
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    39
30259
d06c049695e6 tests: explicitly use ls profiler
Gregory Szorc <gregory.szorc@gmail.com>
parents: 29787
diff changeset
    40
  $ $prof --config profiling.format=text --config profiling.output=../profile.log serve -d -p $HGPORT --pid-file ../hg.pid -A ../access.log
29787
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    41
  $ cat ../hg.pid >> $DAEMON_PIDS
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    42
  $ hg -q clone -U http://localhost:$HGPORT ../clone
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    43
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    44
A single profile is logged because file logging doesn't append
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    45
  $ grep CallCount ../profile.log | wc -l
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    46
  \s*1 (re)
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    47
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    48
#endif
80df04266a16 hgweb: profile HTTP requests
Gregory Szorc <gregory.szorc@gmail.com>
parents: 26191
diff changeset
    49
16913
f2719b387380 tests: add missing trailing 'cd ..'
Mads Kiilerich <mads@kiilerich.com>
parents: 16898
diff changeset
    50
  $ cd ..