B S��jm�@szdZdddgZddlZddlZddd�Zddd�Zejje_ejje_Gd d�dej�Zd d �Z d d �Z e dkrve �dS)zUPython interface for the 'lsprof' profiler. Compatible with the 'profile' module. �run�runctx�Profile�N���cCst�t��|||�S)N)� _pyprofile�_Utilsrr)� statement�filename�sort�r �-/opt/alt/python37/lib64/python3.7/cProfile.pyrscCst�t��|||||�S)N)rrrr)r�globals�localsr r r r r rsc@sJeZdZdZddd�Zdd�Zdd�Zd d �Zd d �Zd d�Z dd�Z dS)ra`Profile(timer=None, timeunit=None, subcalls=True, builtins=True) Builds a profiler object using the specified timer function. The default timer is a fast built-in one based on real time. For custom timer functions returning integers, timeunit can be a float specifying a scale (i.e. how long each integer unit is, in seconds). rcCs$ddl}|�|����|���dS)Nr)�pstats�StatsZ strip_dirsZ sort_stats� print_stats)�selfr rr r r r(szProfile.print_statsc Cs8ddl}t|d��}|��|�|j|�WdQRXdS)Nr�wb)�marshal�open� create_stats�dump�stats)r�filer�fr r r � dump_stats,s zProfile.dump_statscCs|��|��dS)N)�disable�snapshot_stats)rr r r r2szProfile.create_statsc Cs6|��}i|_i}xX|D]P}t|j�}|j}||j}|j}|j}i} | |t|j�<||||| f|j|<qWx�|D]�}|j rrt|j�}x�|j D]�} y|t| j�} Wnt k r�w�YnX| j}|| j}| j}| j}|| k�r| |} || d7}|| d7}|| d7}|| d7}||||f| |<q�WqrWdS)Nr���) Zgetstatsr�label�codeZ callcountZ reccallcountZ inlinetimeZ totaltime�idZcalls�KeyError) r�entriesZ callersdicts�entry�funcZncZccZttZctZcallersZsubentry�prevr r r r6s>            zProfile.snapshot_statscCsddl}|j}|�|||�S)Nr)�__main__�__dict__r)r�cmdr)�dictr r r r\sz Profile.runcCs(|��zt|||�Wd|��X|S)N)�enable�execr)rr+r rr r r ras  zProfile.runctxcOsxt|�dkr|^}}}n>|s&td��n0d|krB|�d�}|^}}ntdt|�d��|��z |||�S|��XdS)Nrz:descriptor 'runcall' of 'Profile' object needs an argumentr'z7runcall expected at least 1 positional argument, got %dr)�len� TypeError�popr-r)�args�kwrr'r r r �runcalljs      zProfile.runcallN)r) �__name__� __module__� __qualname__�__doc__rrrrrrr4r r r r rs & cCs(t|t�rdd|fS|j|j|jfSdS)N�~r)� isinstance�str� co_filename�co_firstlineno�co_name)r"r r r r!s  r!c Cs^ddl}ddl}ddl}ddl}ddlm}d}||d�}d|_|jdddd dd �|jd d d ddt|j j �d�|jdddddd�|j dd�s�|� �|� d�|��\}}||j dd�<t|�dk�rR|jr�d} |j|dd�} nR|d} |j�d|j�| ��t| d��} t| ��| d�} WdQRX| dddd�} t| | d|j|j�n|� �|S)Nr)� OptionParserzNcProfile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...)�usageFz-oz --outfile�outfilezSave stats to <outfile>)�dest�help�defaultz-sz--sortr z?Sort order when printing to stdout, based on pstats.Stats classr)rBrCrD�choicesz-m�module� store_truezProfile a library module)rB�actionrCrDrrz(run_module(modname, run_name='__main__'))� run_module�modname�rbr.r))�__file__r5� __package__� __cached__)�os�sys�runpyrZoptparser?Zallow_interspersed_argsZ add_option�sortedrZsort_arg_dict_default�argvZ print_usage�exit� parse_argsr/rFrI�path�insert�dirnamer�compile�readrrAr ) rOrPrQrr?r@�parserZoptionsr2r"ZglobsZprogname�fpr r r �main�sJ          r]r))Nr)Nr) r8�__all__Z_lsprofZprofilerrrZProfilerrr!r]r5r r r r �<module>s     d1