o ö]Lbō ć@s8dZddlmZddlmZdd„ZGdd„deƒZd S) aC lsprofcalltree.py - lsprof output which is readable by kcachegrind Authors: * David Allouche allouche.net> * Jp Calderone & Itamar Shtull-Trauring * Johan Dahlin This software may be used and distributed according to the terms of the GNU General Public License, incorporated herein by reference. é)Śabsolute_importé)ŚpycompatcCs8t|tƒr dt |”Sdt |j”t |j”|jfS)Nó~s%s %s:%d)Ś isinstanceŚstrrŚsysbytesŚco_nameŚ co_filenameŚco_firstlineno)Ścode©r ś:/usr/lib/python3/dist-packages/mercurial/lsprofcalltree.pyŚlabels   żrc@s4eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd S) Ś KCacheGrindcCs| ”|_d|_dS)N)ŚgetstatsŚdataŚout_file)ŚselfŚprofilerr r rŚ__init__s  zKCacheGrind.__init__cCs2||_| d”| ”|jD]}| |”qdS)Nsevents: Ticks )rŚwriteŚ_print_summaryrŚ_entry)rrŚentryr r rŚoutput#s    ’zKCacheGrind.outputcCs<d}|jD]}t|jdƒ}t||ƒ}q|j d|”dS)Nréčs summary: %d )rŚintŚ totaltimeŚmaxrr)rŚmax_costrrr r rr*s   zKCacheGrind._print_summarycCsŅ|j}|j}t|tƒr| d”n | dt |j””| dt|ƒ”t |j dƒ}t|tƒr9| d|”n | d|j |f”|j rJ|j }ng}t|tƒrTd}n|j }|D]}|  ||”qY| d”dS) Nsfi=~ sfi=%s sfn=%s rs0 %d ó%d %d ró )rr rrrrrr rrŚ inlinetimer ŚcallsŚ _subentry)rrrr r#r$ŚlinenoŚsubentryr r rr1s&    zKCacheGrind._entrycCs”|j}|j}| dt|ƒ”t|tƒr"| d”| d|j”n| dt |j ””| d|j|j f”t |j dƒ}| d||f”dS)Nscfn=%s scfi=~ s calls=%d 0 scfi=%s s calls=%d %d rr!) rr rrrrŚ callcountrrr r rr)rr&r'rr rr r rr%Rs  ’zKCacheGrind._subentryN)Ś__name__Ś __module__Ś __qualname__rrrrr%r r r rrs  !rN)Ś__doc__Ś __future__rŚrrŚobjectrr r r rŚs