a +b@szddlmZmZddlZddlZddlmZddlmZejZeeddZ ddgZ d d Z Gd d d e Z iZd dZdS))absolute_importprint_functionNgetattr)pycompatprofiler_entrysprofilesStatscOsFt}|jdddz||i|W|n |0t|S) XXX docstringT)Zsubcallsbuiltins)ProfilerenabledisableStatsZgetstats)fargskwdspr6/usr/lib64/python3.9/site-packages/mercurial/lsprof.pyprofiles rc@s4eZdZdZddZd ddZd dd Zd d ZdS)rr cCs ||_dSN)data)selfrrrr__init__szStats.__init__ inlinetimecstrtjvr@tdn$|jr@t|jdds@td|jjfdddd|jD]"}|jr^|jjfddddq^dS) r sCan't sort by %srNcs t|Srrxcritrr+zStats.sort..T)keyreversecs t|Srrrrrrr.r )r__dict__ ValueErrorrrsortcalls)rrerrrr%"s   z Stats.sortNc Cs|durtj}|j}|dur(|d|}d}d}||dd}|D]} ||| j| j| j| jt| j f|d7}|dur||krdSd} |rF| j rF| j D]j} ||| j| j| j| jdt| j f|d7}| d7} |dur||krdS|dur| |krqFqqFdS)r Ns% 12d %12d %11.4f %11.4f %s s% 12s %12s %12s %12s %s )s CallCounts RecursivesTotal(s)s Inline(s)smodule:lineno(function)rrs %s) sysstdoutrwriteZ callcountZ reccallcountZ totaltimerlabelcoder&) rtopfilelimitZclimitdZcolsZhcolscountr'Zccountserrrpprint0s\       z Stats.pprintcCstt|jD]}|j|}t|jtsNt|t|jf|dd|j|<|jrtt|jD]@}|j|}t|jtsbt|t|jf|dd|j|<qbqdS)zwReplace all references to code objects with string descriptions; this makes it possible to pickle the instance.rN) rangelenr isinstancer,strtyper+r&)rir'jr2rrrfreezefs  &  z Stats.freeze)r)NNNN)__name__ __module__ __qualname____doc__rr%r3r;rrrrrs   6rc Cst|tr$tjjdkr |d}|Szt|j}Wn~tyt t tj D]F\}}|durbqPtt |ddtsvqP|j|jrP|}t|j<qqPd|j}t|j<Yn0d||j|jf}tjjdkr|d}|S)Nzlatin-1__file__z<%s>z %s:%d(%s))r6r7r( version_infomajorencode_fn2mod co_filenameKeyErrorlistrZ iteritemsmodulesrrA startswithco_firstlinenoco_name)r,Zmnamekvresrrrr+ys(      r+)Z __future__rrZ_lsprofr(rrr r__all__robjectrrEr+rrrrs    Z