Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Add a format option to group results by function. #14

Merged
merged 1 commit into from Nov 13, 2012

Conversation

Projects
None yet
2 participants

DurhamG commented Nov 1, 2012

The default behavior is not changed.

This options allows output rows to be by filename:function instead of filename:lineno:function. If particular lines within a function take more than 1% of the total time, they are output as nested rows
beneath the function row and include a snippet of the source. I found this to be less noisy than having a row for every line that got sampled.

See the commit message for example output.

Add a format option to group results by function.
The default behavior is not changed.
This options allows output rows to be by filename:function instead of
filename:lineno:function.  If particular lines within a function
take more than 1% of the total time, they are output as nested rows
beneath the function row and include a snippet of the source. I found
this to be less noisy than having a row for every line that got sampled.

Example:

 %   cumulative      self
time    seconds   seconds  name
71.33      1.97      1.68  dirstate.py:walk
                              56%   1.33   line 674: entries = listdir(jo...
                               6%   0.13   line 681: nf = normalize(nd an...
                               3%   0.07   line 700: visit = sorted([f fo...
                               2%   0.04   line 667: nd = work.pop()
16.17      2.35      0.38  dirstate.py:status
                               6%   0.15   line 764: state, mode, size, t...
                               2%   0.05   line 773: mtime = int(st.st_mtime)
                               2%   0.04   line 776: or ((mode ^ st.st_mo...
                               1%   0.04   line 775: ((size != st.st_size...
                               1%   0.04   line 755: listignored).iteritems():
                               1%   0.03   line 779: or fn in self._copymap):
 6.52      0.15      0.15  match.py:<lambda>
                               7%   0.15   line 105: m = lambda f: True
 3.12      0.07      0.07  match.py:__call__
                               3%   0.06   line 111: return self.matchfn(fn)
 1.36      0.03      0.03  dirstate.py:<lambda>
                               1%   0.03   line 610: normalize = lambda x...
 0.54      0.01      0.01  re.py:escape
 0.54      0.01      0.01  dirstate.py:_join
 0.14      0.01      0.00  dirstate.py:_read
 0.14      0.00      0.00  scmutil.py:read
 0.14      0.00      0.00  demandimport.py:_demandimport
 0.00      0.01      0.00  util.py:__get__
 0.00      2.36      0.00  dispatch.py:_dispatch
 0.00      0.01      0.00  match.py:__init__

bos added a commit that referenced this pull request Nov 13, 2012

Merge pull request #14 from Vickor/master
Add a format option to group results by function.

@bos bos merged commit 3d9ca95 into bos:master Nov 13, 2012

Owner

bos commented Nov 13, 2012

Nice patch, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment