profiling: introduce limit configuration option

The number of output lines was hardcoded to 30.

There was a 'nested' configuration options that controlled something else
related to counting the number of output lines.

This introduces the profiling.limit configuration option for controlling the
number of profiling output to show.
This commit is contained in:
Mads Kiilerich 2013-02-04 02:46:53 +01:00
parent 52235c623d
commit a13d45eee6
2 changed files with 6 additions and 1 deletions

View File

@ -748,6 +748,7 @@ def _dispatch(req):
def lsprofile(ui, func, fp): def lsprofile(ui, func, fp):
format = ui.config('profiling', 'format', default='text') format = ui.config('profiling', 'format', default='text')
field = ui.config('profiling', 'sort', default='inlinetime') field = ui.config('profiling', 'sort', default='inlinetime')
limit = ui.configint('profiling', 'limit', default=30)
climit = ui.configint('profiling', 'nested', default=5) climit = ui.configint('profiling', 'nested', default=5)
if format not in ['text', 'kcachegrind']: if format not in ['text', 'kcachegrind']:
@ -776,7 +777,7 @@ def lsprofile(ui, func, fp):
# format == 'text' # format == 'text'
stats = lsprof.Stats(p.getstats()) stats = lsprof.Stats(p.getstats())
stats.sort(field) stats.sort(field)
stats.pprint(limit=30, file=fp, climit=climit) stats.pprint(limit=limit, file=fp, climit=climit)
def statprofile(ui, func, fp): def statprofile(ui, func, fp):
try: try:

View File

@ -996,6 +996,10 @@ profiling is done using lsprof.
``inlinetime``. ``inlinetime``.
Default: inlinetime. Default: inlinetime.
``limit``
Number of lines to show. Specific to the ``ls`` instrumenting profiler.
Default: 30.
``nested`` ``nested``
Show at most this number of lines of drill-down info in a tree structure Show at most this number of lines of drill-down info in a tree structure
after each main entry. This can help explain the difference between Total after each main entry. This can help explain the difference between Total