annotate tests/test-profile @ 8849:80cc4b1a62d0

compare grep result between target and its parent I found that typical case is that grep target is added at (*) revision in the tree shown below. +--- 1(*) --- 3 0 +--- 2 ------ 4 Now, I expect 'hg grep --all' to show only rev:1 which is first appearance of target line. But 'hg grep --all' will tell: target line dis-appeared at 3 => 4 target line appeared at 2 => 3 target line dis-appeared at 1 => 2 target line appeared at 0 => 1 because current 'hg grep' implementation compares not between target revision and its parent, but between neighbor revisions in walkthrough order. I checked performance of this patch by "hg grep --follow --all walkchangerevs" on whole Mercurial repo, and patched version could complete as fast as un-patched one.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Tue, 19 May 2009 16:49:54 +0900
parents 9a1b86cfd29e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5099
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
1 #!/bin/sh
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
2
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
3 echo % test --time
5102
9b0efeb725f4 test-profile: fix grep, check hotshot availability
Patrick Mezard <pmezard@gmail.com>
parents: 5099
diff changeset
4 hg --time help -q help 2>&1 | grep Time > /dev/null || echo --time failed
5099
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
5
8022
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
6 hg init a
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
7 cd a
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
8
5099
105d4cf7ec24 Test --time, --profile and --lsprof
Patrick Mezard <pmezard@gmail.com>
parents:
diff changeset
9 echo % test --profile
8021
1c2cf2e5dc9b profiling: dropping hotshot profiling. --profile as a unique profiling option
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 5102
diff changeset
10 if "$TESTDIR/hghave" -q lsprof; then
8022
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
11 hg --profile st 2>../out || echo --profile failed
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
12 grep CallCount < ../out > /dev/null || echo wrong --profile
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
13
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
14 hg --profile --config profiling.output=../out st 2>&1 \
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
15 || echo --profile + output to file failed
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
16 grep CallCount < ../out > /dev/null \
4f3fdfaa3874 profiling: Adding profiling.output config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8021
diff changeset
17 || echo wrong --profile output when saving to a file
8023
fd9debb3ea1b profiling: Adding a profiling.format config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8022
diff changeset
18
fd9debb3ea1b profiling: Adding a profiling.format config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8022
diff changeset
19 hg --profile --config profiling.format=text st 2>&1 \
fd9debb3ea1b profiling: Adding a profiling.format config variable
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8022
diff changeset
20 | grep CallCount > /dev/null || echo --profile format=text failed
8024
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
21
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
22 echo "[profiling]" >> $HGRCPATH
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
23 echo "format=kcachegrind" >> $HGRCPATH
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
24
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
25 hg --profile st 2>../out || echo --profile format=kcachegrind failed
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
26 grep 'events: Ticks' < ../out > /dev/null || echo --profile output is wrong
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
27
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
28 hg --profile --config profiling.output=../out st 2>&1 \
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
29 || echo --profile format=kcachegrind + output to file failed
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
30 grep 'events: Ticks' < ../out > /dev/null \
9a1b86cfd29e profiling: Adding support for kcachegrind output format, using lsprofcalltree
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 8023
diff changeset
31 || echo --profile output is wrong
5102
9b0efeb725f4 test-profile: fix grep, check hotshot availability
Patrick Mezard <pmezard@gmail.com>
parents: 5099
diff changeset
32 fi