##// END OF EJS Templates
perf: test the formatting of a command help...
marmoute -
r47104:09a5cce4 default draft
parent child Browse files
Show More
@@ -1,411 +1,425
1 1 #require test-repo
2 2
3 3 Set vars:
4 4
5 5 $ . "$TESTDIR/helpers-testrepo.sh"
6 6 $ CONTRIBDIR="$TESTDIR/../contrib"
7 7
8 8 Prepare repo:
9 9
10 10 $ hg init
11 11
12 12 $ echo this is file a > a
13 13 $ hg add a
14 14 $ hg commit -m first
15 15
16 16 $ echo adding to file a >> a
17 17 $ hg commit -m second
18 18
19 19 $ echo adding more to file a >> a
20 20 $ hg commit -m third
21 21
22 22 $ hg up -r 0
23 23 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
24 24 $ echo merge-this >> a
25 25 $ hg commit -m merge-able
26 26 created new head
27 27
28 28 $ hg up -r 2
29 29 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
30 30
31 31 perfstatus
32 32
33 33 $ cat >> $HGRCPATH << EOF
34 34 > [extensions]
35 35 > perf=$CONTRIBDIR/perf.py
36 36 > [perf]
37 37 > presleep=0
38 38 > stub=on
39 39 > parentscount=1
40 40 > EOF
41 41 $ hg help -e perf
42 42 perf extension - helper extension to measure performance
43 43
44 44 Configurations
45 45 ==============
46 46
47 47 "perf"
48 48 ------
49 49
50 50 "all-timing"
51 51 When set, additional statistics will be reported for each benchmark: best,
52 52 worst, median average. If not set only the best timing is reported
53 53 (default: off).
54 54
55 55 "presleep"
56 56 number of second to wait before any group of runs (default: 1)
57 57
58 58 "pre-run"
59 59 number of run to perform before starting measurement.
60 60
61 61 "profile-benchmark"
62 62 Enable profiling for the benchmarked section. (The first iteration is
63 63 benchmarked)
64 64
65 65 "run-limits"
66 66 Control the number of runs each benchmark will perform. The option value
67 67 should be a list of '<time>-<numberofrun>' pairs. After each run the
68 68 conditions are considered in order with the following logic:
69 69
70 70 If benchmark has been running for <time> seconds, and we have performed
71 71 <numberofrun> iterations, stop the benchmark,
72 72
73 73 The default value is: '3.0-100, 10.0-3'
74 74
75 75 "stub"
76 76 When set, benchmarks will only be run once, useful for testing (default:
77 77 off)
78 78
79 79 list of commands:
80 80
81 81 perf--addremove
82 82 (no help text available)
83 83 perf--ancestors
84 84 (no help text available)
85 85 perf--ancestorset
86 86 (no help text available)
87 87 perf--annotate
88 88 (no help text available)
89 89 perf--bdiff benchmark a bdiff between revisions
90 90 perf--bookmarks
91 91 benchmark parsing bookmarks from disk to memory
92 92 perf--branchmap
93 93 benchmark the update of a branchmap
94 94 perf--branchmapload
95 95 benchmark reading the branchmap
96 96 perf--branchmapupdate
97 97 benchmark branchmap update from for <base> revs to <target>
98 98 revs
99 99 perf--bundleread
100 100 Benchmark reading of bundle files.
101 101 perf--cca (no help text available)
102 102 perf--changegroupchangelog
103 103 Benchmark producing a changelog group for a changegroup.
104 104 perf--changeset
105 105 (no help text available)
106 106 perf--ctxfiles
107 107 (no help text available)
108 108 perf--diffwd Profile diff of working directory changes
109 109 perf--dirfoldmap
110 110 benchmap a 'dirstate._map.dirfoldmap.get()' request
111 111 perf--dirs (no help text available)
112 112 perf--dirstate
113 113 benchmap the time of various distate operations
114 114 perf--dirstatedirs
115 115 benchmap a 'dirstate.hasdir' call from an empty 'dirs' cache
116 116 perf--dirstatefoldmap
117 117 benchmap a 'dirstate._map.filefoldmap.get()' request
118 118 perf--dirstatewrite
119 119 benchmap the time it take to write a dirstate on disk
120 120 perf--discovery
121 121 benchmark discovery between local repo and the peer at given
122 122 path
123 123 perf--fncacheencode
124 124 (no help text available)
125 125 perf--fncacheload
126 126 (no help text available)
127 127 perf--fncachewrite
128 128 (no help text available)
129 129 perf--heads benchmark the computation of a changelog heads
130 130 perf--helper-mergecopies
131 131 find statistics about potential parameters for
132 132 'perfmergecopies'
133 133 perf--helper-pathcopies
134 134 find statistic about potential parameters for the
135 135 'perftracecopies'
136 136 perf--ignore benchmark operation related to computing ignore
137 137 perf--index benchmark index creation time followed by a lookup
138 138 perf--linelogedits
139 139 (no help text available)
140 140 perf--loadmarkers
141 141 benchmark the time to parse the on-disk markers for a repo
142 142 perf--log (no help text available)
143 143 perf--lookup (no help text available)
144 144 perf--lrucachedict
145 145 (no help text available)
146 146 perf--manifest
147 147 benchmark the time to read a manifest from disk and return a
148 148 usable
149 149 perf--mergecalculate
150 150 (no help text available)
151 151 perf--mergecopies
152 152 measure runtime of 'copies.mergecopies'
153 153 perf--moonwalk
154 154 benchmark walking the changelog backwards
155 155 perf--nodelookup
156 156 (no help text available)
157 157 perf--nodemap
158 158 benchmark the time necessary to look up revision from a cold
159 159 nodemap
160 160 perf--parents
161 161 benchmark the time necessary to fetch one changeset's parents.
162 162 perf--pathcopies
163 163 benchmark the copy tracing logic
164 164 perf--phases benchmark phasesets computation
165 165 perf--phasesremote
166 166 benchmark time needed to analyse phases of the remote server
167 167 perf--progress
168 168 printing of progress bars
169 169 perf--rawfiles
170 170 (no help text available)
171 171 perf--revlogchunks
172 172 Benchmark operations on revlog chunks.
173 173 perf--revlogindex
174 174 Benchmark operations against a revlog index.
175 175 perf--revlogrevision
176 176 Benchmark obtaining a revlog revision.
177 177 perf--revlogrevisions
178 178 Benchmark reading a series of revisions from a revlog.
179 179 perf--revlogwrite
180 180 Benchmark writing a series of revisions to a revlog.
181 181 perf--revrange
182 182 (no help text available)
183 183 perf--revset benchmark the execution time of a revset
184 184 perf--startup
185 185 (no help text available)
186 186 perf--status benchmark the performance of a single status call
187 187 perf--tags (no help text available)
188 188 perf--templating
189 189 test the rendering time of a given template
190 190 perf--unidiff
191 191 benchmark a unified diff between revisions
192 192 perf--volatilesets
193 193 benchmark the computation of various volatile set
194 194 perf--walk (no help text available)
195 195 perf--write microbenchmark ui.write (and others)
196 196
197 197 (use 'hg help -v perf' to show built-in aliases and global options)
198
199 $ hg help perfaddremove
200 hg perf--addremove
201
202 aliases: perfaddremove
203
204 (no help text available)
205
206 options:
207
208 -T --template TEMPLATE display with template
209
210 (some details hidden, use --verbose to show complete help)
211
198 212 $ hg perfaddremove
199 213 $ hg perfancestors
200 214 $ hg perfancestorset 2
201 215 $ hg perfannotate a
202 216 $ hg perfbdiff -c 1
203 217 $ hg perfbdiff --alldata 1
204 218 $ hg perfunidiff -c 1
205 219 $ hg perfunidiff --alldata 1
206 220 $ hg perfbookmarks
207 221 $ hg perfbranchmap
208 222 $ hg perfbranchmapload
209 223 $ hg perfbranchmapupdate --base "not tip" --target "tip"
210 224 benchmark of branchmap with 3 revisions with 1 new ones
211 225 $ hg perfcca
212 226 $ hg perfchangegroupchangelog
213 227 $ hg perfchangegroupchangelog --cgversion 01
214 228 $ hg perfchangeset 2
215 229 $ hg perfctxfiles 2
216 230 $ hg perfdiffwd
217 231 $ hg perfdirfoldmap
218 232 $ hg perfdirs
219 233 $ hg perfdirstate
220 234 $ hg perfdirstate --contains
221 235 $ hg perfdirstate --iteration
222 236 $ hg perfdirstatedirs
223 237 $ hg perfdirstatefoldmap
224 238 $ hg perfdirstatewrite
225 239 #if repofncache
226 240 $ hg perffncacheencode
227 241 $ hg perffncacheload
228 242 $ hg debugrebuildfncache
229 243 fncache already up to date
230 244 $ hg perffncachewrite
231 245 $ hg debugrebuildfncache
232 246 fncache already up to date
233 247 #endif
234 248 $ hg perfheads
235 249 $ hg perfignore
236 250 $ hg perfindex
237 251 $ hg perflinelogedits -n 1
238 252 $ hg perfloadmarkers
239 253 $ hg perflog
240 254 $ hg perflookup 2
241 255 $ hg perflrucache
242 256 $ hg perfmanifest 2
243 257 $ hg perfmanifest -m 44fe2c8352bb3a478ffd7d8350bbc721920134d1
244 258 $ hg perfmanifest -m 44fe2c8352bb
245 259 abort: manifest revision must be integer or full node
246 260 [255]
247 261 $ hg perfmergecalculate -r 3
248 262 $ hg perfmoonwalk
249 263 $ hg perfnodelookup 2
250 264 $ hg perfpathcopies 1 2
251 265 $ hg perfprogress --total 1000
252 266 $ hg perfrawfiles 2
253 267 $ hg perfrevlogindex -c
254 268 #if reporevlogstore
255 269 $ hg perfrevlogrevisions .hg/store/data/a.i
256 270 #endif
257 271 $ hg perfrevlogrevision -m 0
258 272 $ hg perfrevlogchunks -c
259 273 $ hg perfrevrange
260 274 $ hg perfrevset 'all()'
261 275 $ hg perfstartup
262 276 $ hg perfstatus
263 277 $ hg perfstatus --dirstate
264 278 $ hg perftags
265 279 $ hg perftemplating
266 280 $ hg perfvolatilesets
267 281 $ hg perfwalk
268 282 $ hg perfparents
269 283 $ hg perfdiscovery -q .
270 284
271 285 Test run control
272 286 ----------------
273 287
274 288 Simple single entry
275 289
276 290 $ hg perfparents --config perf.stub=no --config perf.run-limits='0.000000001-15'
277 291 ! wall * comb * user * sys * (best of 15) (glob)
278 292
279 293 Multiple entries
280 294
281 295 $ hg perfparents --config perf.stub=no --config perf.run-limits='500000-1, 0.000000001-5'
282 296 ! wall * comb * user * sys * (best of 5) (glob)
283 297
284 298 error case are ignored
285 299
286 300 $ hg perfparents --config perf.stub=no --config perf.run-limits='500, 0.000000001-5'
287 301 malformatted run limit entry, missing "-": 500
288 302 ! wall * comb * user * sys * (best of 5) (glob)
289 303 $ hg perfparents --config perf.stub=no --config perf.run-limits='aaa-12, 0.000000001-5'
290 304 malformatted run limit entry, could not convert string to float: aaa: aaa-12 (no-py3 !)
291 305 malformatted run limit entry, could not convert string to float: 'aaa': aaa-12 (py3 !)
292 306 ! wall * comb * user * sys * (best of 5) (glob)
293 307 $ hg perfparents --config perf.stub=no --config perf.run-limits='12-aaaaaa, 0.000000001-5'
294 308 malformatted run limit entry, invalid literal for int() with base 10: 'aaaaaa': 12-aaaaaa
295 309 ! wall * comb * user * sys * (best of 5) (glob)
296 310
297 311 test actual output
298 312 ------------------
299 313
300 314 normal output:
301 315
302 316 $ hg perfheads --config perf.stub=no
303 317 ! wall * comb * user * sys * (best of *) (glob)
304 318
305 319 detailed output:
306 320
307 321 $ hg perfheads --config perf.all-timing=yes --config perf.stub=no
308 322 ! wall * comb * user * sys * (best of *) (glob)
309 323 ! wall * comb * user * sys * (max of *) (glob)
310 324 ! wall * comb * user * sys * (avg of *) (glob)
311 325 ! wall * comb * user * sys * (median of *) (glob)
312 326
313 327 test json output
314 328 ----------------
315 329
316 330 normal output:
317 331
318 332 $ hg perfheads --template json --config perf.stub=no
319 333 [
320 334 {
321 335 "comb": *, (glob)
322 336 "count": *, (glob)
323 337 "sys": *, (glob)
324 338 "user": *, (glob)
325 339 "wall": * (glob)
326 340 }
327 341 ]
328 342
329 343 detailed output:
330 344
331 345 $ hg perfheads --template json --config perf.all-timing=yes --config perf.stub=no
332 346 [
333 347 {
334 348 "avg.comb": *, (glob)
335 349 "avg.count": *, (glob)
336 350 "avg.sys": *, (glob)
337 351 "avg.user": *, (glob)
338 352 "avg.wall": *, (glob)
339 353 "comb": *, (glob)
340 354 "count": *, (glob)
341 355 "max.comb": *, (glob)
342 356 "max.count": *, (glob)
343 357 "max.sys": *, (glob)
344 358 "max.user": *, (glob)
345 359 "max.wall": *, (glob)
346 360 "median.comb": *, (glob)
347 361 "median.count": *, (glob)
348 362 "median.sys": *, (glob)
349 363 "median.user": *, (glob)
350 364 "median.wall": *, (glob)
351 365 "sys": *, (glob)
352 366 "user": *, (glob)
353 367 "wall": * (glob)
354 368 }
355 369 ]
356 370
357 371 Test pre-run feature
358 372 --------------------
359 373
360 374 (perf discovery has some spurious output)
361 375
362 376 $ hg perfdiscovery . --config perf.stub=no --config perf.run-limits='0.000000001-1' --config perf.pre-run=0
363 377 ! wall * comb * user * sys * (best of 1) (glob)
364 378 searching for changes
365 379 $ hg perfdiscovery . --config perf.stub=no --config perf.run-limits='0.000000001-1' --config perf.pre-run=1
366 380 ! wall * comb * user * sys * (best of 1) (glob)
367 381 searching for changes
368 382 searching for changes
369 383 $ hg perfdiscovery . --config perf.stub=no --config perf.run-limits='0.000000001-1' --config perf.pre-run=3
370 384 ! wall * comb * user * sys * (best of 1) (glob)
371 385 searching for changes
372 386 searching for changes
373 387 searching for changes
374 388 searching for changes
375 389
376 390 test profile-benchmark option
377 391 ------------------------------
378 392
379 393 Function to check that statprof ran
380 394 $ statprofran () {
381 395 > egrep 'Sample count:|No samples recorded' > /dev/null
382 396 > }
383 397 $ hg perfdiscovery . --config perf.stub=no --config perf.run-limits='0.000000001-1' --config perf.profile-benchmark=yes 2>&1 | statprofran
384 398
385 399 Check perf.py for historical portability
386 400 ----------------------------------------
387 401
388 402 $ cd "$TESTDIR/.."
389 403
390 404 $ (testrepohg files -r 1.2 glob:mercurial/*.c glob:mercurial/*.py;
391 405 > testrepohg files -r tip glob:mercurial/*.c glob:mercurial/*.py) |
392 406 > "$TESTDIR"/check-perf-code.py contrib/perf.py
393 407 contrib/perf.py:\d+: (re)
394 408 > from mercurial import (
395 409 import newer module separately in try clause for early Mercurial
396 410 contrib/perf.py:\d+: (re)
397 411 > from mercurial import (
398 412 import newer module separately in try clause for early Mercurial
399 413 contrib/perf.py:\d+: (re)
400 414 > origindexpath = orig.opener.join(orig.indexfile)
401 415 use getvfs()/getsvfs() for early Mercurial
402 416 contrib/perf.py:\d+: (re)
403 417 > origdatapath = orig.opener.join(orig.datafile)
404 418 use getvfs()/getsvfs() for early Mercurial
405 419 contrib/perf.py:\d+: (re)
406 420 > vfs = vfsmod.vfs(tmpdir)
407 421 use getvfs()/getsvfs() for early Mercurial
408 422 contrib/perf.py:\d+: (re)
409 423 > vfs.options = getattr(orig.opener, 'options', None)
410 424 use getvfs()/getsvfs() for early Mercurial
411 425 [1]
General Comments 0
You need to be logged in to leave comments. Login now