Mercurial > hg-stable
changeset 8023:fd9debb3ea1b
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.
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Thu, 02 Apr 2009 16:01:30 +0900 |
parents | 4f3fdfaa3874 |
children | 9a1b86cfd29e |
files | doc/hgrc.5.txt mercurial/dispatch.py tests/test-profile |
diffstat | 3 files changed, 17 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/hgrc.5.txt Wed Apr 08 14:19:41 2009 +0200 +++ b/doc/hgrc.5.txt Thu Apr 02 16:01:30 2009 +0900 @@ -545,6 +545,13 @@ 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.
--- a/mercurial/dispatch.py Wed Apr 08 14:19:41 2009 +0200 +++ b/mercurial/dispatch.py Thu Apr 02 16:01:30 2009 +0900 @@ -379,6 +379,13 @@ 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:
--- a/tests/test-profile Wed Apr 08 14:19:41 2009 +0200 +++ b/tests/test-profile Thu Apr 02 16:01:30 2009 +0900 @@ -15,4 +15,7 @@ || 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