profiling: Adding a profiling.format config variable

Allows defining other output formats for profiling.

If an invalid format is given, output a warning and ignore it.
For now, only the standard 'text' value is supported.
This commit is contained in:
Nicolas Dumazet 2009-04-02 16:01:30 +09:00
parent 14ff1a53ae
commit f2cfd93c8c
3 changed files with 17 additions and 0 deletions

View File

@ -545,6 +545,13 @@ profiling::
collected during profiling, while 'profiling report' stands for a
statistical text report generated from the profiling data.
The profiling is done using lsprof.
format;;
Profiling format.
Default: text.
text;;
Generate a profiling report.
When saving to a file, it should be noted that only the report is saved,
and the profiling data is not kept.
output;;
File path where profiling data or report should be saved.
If the file exists, it is replaced.

View File

@ -379,6 +379,13 @@ def _runcommand(ui, options, cmd, cmdfunc):
raise error.ParseError(cmd, _("invalid arguments"))
if options['profile']:
format = ui.config('profiling', 'format', default='text')
if not format in ['text']:
ui.warn(_("unrecognized profiling format '%s'"
" - Ignored\n") % format)
format = 'text'
output = ui.config('profiling', 'output')
if output:

View File

@ -15,4 +15,7 @@ if "$TESTDIR/hghave" -q lsprof; then
|| echo --profile + output to file failed
grep CallCount < ../out > /dev/null \
|| echo wrong --profile output when saving to a file
hg --profile --config profiling.format=text st 2>&1 \
| grep CallCount > /dev/null || echo --profile format=text failed
fi