Show More
@@ -1,101 +1,101 b'' | |||||
1 | test --time |
|
1 | test --time | |
2 |
|
2 | |||
3 | $ hg --time help -q help 2>&1 | grep time > /dev/null |
|
3 | $ hg --time help -q help 2>&1 | grep time > /dev/null | |
4 | $ hg init a |
|
4 | $ hg init a | |
5 | $ cd a |
|
5 | $ cd a | |
6 |
|
6 | |||
7 | #if lsprof |
|
7 | #if lsprof | |
8 |
|
8 | |||
9 | test --profile |
|
9 | test --profile | |
10 |
|
10 | |||
11 | $ prof='hg --config profiling.type=ls --profile' |
|
11 | $ prof='hg --config profiling.type=ls --profile' | |
12 |
|
12 | |||
13 | $ $prof st 2>../out |
|
13 | $ $prof st 2>../out | |
14 | $ grep CallCount ../out > /dev/null || cat ../out |
|
14 | $ grep CallCount ../out > /dev/null || cat ../out | |
15 |
|
15 | |||
16 | $ $prof --config profiling.output=../out st |
|
16 | $ $prof --config profiling.output=../out st | |
17 | $ grep CallCount ../out > /dev/null || cat ../out |
|
17 | $ grep CallCount ../out > /dev/null || cat ../out | |
18 |
|
18 | |||
19 | $ $prof --config profiling.output=blackbox --config extensions.blackbox= st |
|
19 | $ $prof --config profiling.output=blackbox --config extensions.blackbox= st | |
20 | $ grep CallCount .hg/blackbox.log > /dev/null || cat .hg/blackbox.log |
|
20 | $ grep CallCount .hg/blackbox.log > /dev/null || cat .hg/blackbox.log | |
21 |
|
21 | |||
22 | $ $prof --config profiling.format=text st 2>../out |
|
22 | $ $prof --config profiling.format=text st 2>../out | |
23 | $ grep CallCount ../out > /dev/null || cat ../out |
|
23 | $ grep CallCount ../out > /dev/null || cat ../out | |
24 |
|
24 | |||
25 | $ echo "[profiling]" >> $HGRCPATH |
|
25 | $ echo "[profiling]" >> $HGRCPATH | |
26 | $ echo "format=kcachegrind" >> $HGRCPATH |
|
26 | $ echo "format=kcachegrind" >> $HGRCPATH | |
27 |
|
27 | |||
28 | $ $prof st 2>../out |
|
28 | $ $prof st 2>../out | |
29 | $ grep 'events: Ticks' ../out > /dev/null || cat ../out |
|
29 | $ grep 'events: Ticks' ../out > /dev/null || cat ../out | |
30 |
|
30 | |||
31 | $ $prof --config profiling.output=../out st |
|
31 | $ $prof --config profiling.output=../out st | |
32 | $ grep 'events: Ticks' ../out > /dev/null || cat ../out |
|
32 | $ grep 'events: Ticks' ../out > /dev/null || cat ../out | |
33 |
|
33 | |||
34 | #endif |
|
34 | #endif | |
35 |
|
35 | |||
36 | #if lsprof serve |
|
36 | #if lsprof serve | |
37 |
|
37 | |||
38 | Profiling of HTTP requests works |
|
38 | Profiling of HTTP requests works | |
39 |
|
39 | |||
40 | $ $prof --config profiling.format=text --config profiling.output=../profile.log serve -d -p $HGPORT --pid-file ../hg.pid -A ../access.log |
|
40 | $ $prof --config profiling.format=text --config profiling.output=../profile.log serve -d -p $HGPORT --pid-file ../hg.pid -A ../access.log | |
41 | $ cat ../hg.pid >> $DAEMON_PIDS |
|
41 | $ cat ../hg.pid >> $DAEMON_PIDS | |
42 | $ hg -q clone -U http://localhost:$HGPORT ../clone |
|
42 | $ hg -q clone -U http://localhost:$HGPORT ../clone | |
43 |
|
43 | |||
44 | A single profile is logged because file logging doesn't append |
|
44 | A single profile is logged because file logging doesn't append | |
45 | $ grep CallCount ../profile.log | wc -l |
|
45 | $ grep CallCount ../profile.log | wc -l | |
46 | \s*1 (re) |
|
46 | \s*1 (re) | |
47 |
|
47 | |||
48 | #endif |
|
48 | #endif | |
49 |
|
49 | |||
50 | Install an extension that can sleep and guarantee a profiler has time to run |
|
50 | Install an extension that can sleep and guarantee a profiler has time to run | |
51 |
|
51 | |||
52 | $ cat >> sleepext.py << EOF |
|
52 | $ cat >> sleepext.py << EOF | |
53 | > import time |
|
53 | > import time | |
54 | > from mercurial import cmdutil, commands |
|
54 | > from mercurial import cmdutil, commands | |
55 | > cmdtable = {} |
|
55 | > cmdtable = {} | |
56 | > command = cmdutil.command(cmdtable) |
|
56 | > command = cmdutil.command(cmdtable) | |
57 | > @command('sleep', [], 'hg sleep') |
|
57 | > @command('sleep', [], 'hg sleep') | |
58 | > def sleep(ui, *args, **kwargs): |
|
58 | > def sleep(ui, *args, **kwargs): | |
59 | > time.sleep(0.1) |
|
59 | > time.sleep(0.1) | |
60 | > EOF |
|
60 | > EOF | |
61 |
|
61 | |||
62 | $ cat >> $HGRCPATH << EOF |
|
62 | $ cat >> $HGRCPATH << EOF | |
63 | > [extensions] |
|
63 | > [extensions] | |
64 | > sleep = `pwd`/sleepext.py |
|
64 | > sleep = `pwd`/sleepext.py | |
65 | > EOF |
|
65 | > EOF | |
66 |
|
66 | |||
67 | statistical profiler works |
|
67 | statistical profiler works | |
68 |
|
68 | |||
69 | $ hg --profile sleep 2>../out |
|
69 | $ hg --profile sleep 2>../out | |
70 | $ grep Sample ../out |
|
70 | $ grep Sample ../out | |
71 | Sample count: \d+ (re) |
|
71 | Sample count: \d+ (re) | |
72 |
|
72 | |||
73 | Various statprof formatters work |
|
73 | Various statprof formatters work | |
74 |
|
74 | |||
75 | $ hg --profile --config profiling.statformat=byline sleep 2>../out |
|
75 | $ hg --profile --config profiling.statformat=byline sleep 2>../out | |
76 | $ head -n 1 ../out |
|
76 | $ head -n 1 ../out | |
77 | % cumulative self |
|
77 | % cumulative self | |
78 | $ grep Sample ../out |
|
78 | $ grep Sample ../out | |
79 | Sample count: \d+ (re) |
|
79 | Sample count: \d+ (re) | |
80 |
|
80 | |||
81 | $ hg --profile --config profiling.statformat=bymethod sleep 2>../out |
|
81 | $ hg --profile --config profiling.statformat=bymethod sleep 2>../out | |
82 | $ head -n 1 ../out |
|
82 | $ head -n 1 ../out | |
83 | % cumulative self |
|
83 | % cumulative self | |
84 | $ grep Sample ../out |
|
84 | $ grep Sample ../out | |
85 | Sample count: \d+ (re) |
|
85 | Sample count: \d+ (re) | |
86 |
|
86 | |||
87 | $ hg --profile --config profiling.statformat=hotpath sleep 2>../out |
|
87 | $ hg --profile --config profiling.statformat=hotpath sleep 2>../out | |
88 | $ grep Sample ../out |
|
88 | $ grep Sample ../out | |
89 | Sample count: \d+ (re) |
|
89 | Sample count: \d+ (re) | |
90 |
|
90 | |||
91 | $ hg --profile --config profiling.statformat=json sleep 2>../out |
|
91 | $ hg --profile --config profiling.statformat=json sleep 2>../out | |
92 | $ cat ../out |
|
92 | $ cat ../out | |
93 | \[\[\d+.* (re) |
|
93 | \[\[-?\d+.* (re) | |
94 |
|
94 | |||
95 |
|
|
95 | statprof can be used as a standalone module | |
96 |
|
96 | |||
97 | $ $PYTHON -m mercurial.statprof hotpath |
|
97 | $ $PYTHON -m mercurial.statprof hotpath | |
98 | must specify --file to load |
|
98 | must specify --file to load | |
99 | [1] |
|
99 | [1] | |
100 |
|
100 | |||
101 | $ cd .. |
|
101 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now