Patchwork [3,of,3,stable] profiling: introduce limit configuration option

login
register
mail settings
Submitter Mads Kiilerich
Date Jan. 29, 2013, 5:04 p.m.
Message ID <9ed706d26ff91d694145.1359479093@mk-desktop>
Download mbox | patch
Permalink /patch/758/
State Accepted
Commit e71c2ff93167322e2908a1f9fcec090fb8a53666
Headers show

Comments

Mads Kiilerich - Jan. 29, 2013, 5:04 p.m.
# HG changeset patch
# User Mads Kiilerich <madski@unity3d.com>
# Date 1359478710 -3600
# Branch stable
# Node ID 9ed706d26ff91d694145e023e00eeb793945b5ab
# Parent  8256fe23401ea99fb8408f3873005a905254ab30
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.
Bryan O'Sullivan - Jan. 30, 2013, 6:19 p.m.
On Tue, Jan 29, 2013 at 9:04 AM, Mads Kiilerich <mads@kiilerich.com> wrote:

> profiling: introduce limit configuration option
>
> The number of output lines was hardcoded to 30.
>

This should be wired into the statprof support even more urgently, as that
dumps out a ridiculously long list of stuff.

Patch

diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
--- a/mercurial/dispatch.py
+++ b/mercurial/dispatch.py
@@ -748,6 +748,7 @@ 
 def lsprofile(ui, func, fp):
     format = ui.config('profiling', 'format', default='text')
     field = ui.config('profiling', 'sort', default='inlinetime')
+    limit = ui.configint('profiling', 'limit', default=30)
     climit = ui.configint('profiling', 'nested', default=5)
 
     if format not in ['text', 'kcachegrind']:
@@ -776,7 +777,7 @@ 
             # format == 'text'
             stats = lsprof.Stats(p.getstats())
             stats.sort(field)
-            stats.pprint(limit=30, file=fp, climit=climit)
+            stats.pprint(limit=limit, file=fp, climit=climit)
 
 def statprofile(ui, func, fp):
     try:
diff --git a/mercurial/help/config.txt b/mercurial/help/config.txt
--- a/mercurial/help/config.txt
+++ b/mercurial/help/config.txt
@@ -996,6 +996,10 @@ 
     ``inlinetime``.
     Default: inlinetime.
 
+``limit``
+    Number of lines to show.  Specific to the ``ls`` instrumenting profiler.
+    Default: 30.
+
 ``nested``
     Show at most this number of lines of drill-down info in-line after each
     main entry. This can help explain the difference between Total and Inline.