eaiovnaovbqoebvqoeavibavo B  fm@szdZdddgZddlZddlZdddZdddZejje_ejje_Gd ddejZd d Z d d Z e dkrve dS)zUPython interface for the 'lsprof' profiler. Compatible with the 'profile' module. runrunctxProfileNcCstt|||S)N) _pyprofile_Utilsrr) statementfilenamesortr -/opt/alt/python37/lib64/python3.7/cProfile.pyrscCstt|||||S)N)rrrr)rglobalslocalsr r r r r rsc@sJeZdZdZdddZddZddZd d Zd d Zd dZ ddZ 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)pstatsStatsZ strip_dirsZ sort_stats print_stats)selfr rr r r r(szProfile.print_statsc Cs8ddl}t|d}|||j|WdQRXdS)Nrwb)marshalopen create_statsdumpstats)rfilerfr r r dump_stats,s zProfile.dump_statscCs||dS)N)disablesnapshot_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 rwYnX| j}|| j}| j}| j}|| kr| |} || d7}|| d7}|| d7}|| d7}||||f| |<qWqrWdS)Nr) ZgetstatsrlabelcodeZ callcountZ reccallcountZ inlinetimeZ totaltimeidZcallsKeyError) rentriesZ callersdictsentryfuncZncZccZttZctZcallersZsubentryprevr r r r6s>            zProfile.snapshot_statscCsddl}|j}||||S)Nr)__main____dict__r)rcmdr)dictr r r r\sz Profile.runcCs(|zt|||Wd|X|S)N)enableexecr)rr+r rr r r ras  zProfile.runctxcOsxt|dkr|^}}}n>|s&tdn0d|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 TypeErrorpopr-r)argskwrr'r r r runcalljs      zProfile.runcallN)r) __name__ __module__ __qualname____doc__rrrrrrr4r r r r rs & cCs(t|trdd|fS|j|j|jfSdS)N~r) isinstancestr co_filenameco_firstlinenoco_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 dds| | d|\}}||j dd<t|dkrR|jrd} |j|dd} nR|d} |jd|j| t| d} t| | d} WdQRX| dddd} t| | d|j|jn| |S)Nr) OptionParserzNcProfile.py [-o output_file_path] [-s sort] [-m module | scriptfile] [arg] ...)usageFz-oz --outfileoutfilezSave stats to )desthelpdefaultz-sz--sortr z?Sort order when printing to stdout, based on pstats.Stats classr)rBrCrDchoicesz-mmodule store_truezProfile a library module)rBactionrCrDrrz(run_module(modname, run_name='__main__')) run_modulemodnamerbr.r))__file__r5 __package__ __cached__)ossysrunpyrZoptparser?Zallow_interspersed_argsZ add_optionsortedrZsort_arg_dict_defaultargvZ print_usageexit parse_argsr/rFrIpathinsertdirnamercompilereadrrAr ) rOrPrQrr?r@parserZoptionsr2r"ZglobsZprognamefpr r r mainsJ          r]r))Nr)Nr) r8__all__Z_lsprofZprofilerrrZProfilerrr!r]r5r r r r s     d1