Yf@sdZdddgZddlZddlZddddZddddZejje_ejje_Gd ddejZd d Z d d Z e dkre dS)zUPython interface for the 'lsprof' profiler. Compatible with the 'profile' module. runrunctxProfileNcCstjtj|||S)N) _pyprofile_Utilsrr) statementfilenamesortr -/opt/alt/python35/lib64/python3.5/cProfile.pyrscCs"tjtj|||||S)N)rrrr)rglobalslocalsr r r r r rsc@smeZdZdZdddZddZddZd d Zd d Zd dZ ddZ dS)raiProfile(custom_timer=None, time_unit=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, time_unit can be a float specifying a scale (i.e. how long each integer unit is, in seconds). rcCs2ddl}|j|jj|jdS)Nr)pstatsZStatsZ strip_dirsZ sort_stats print_stats)selfr rr r r r(s zProfile.print_statsc CsFddl}t|d$}|j|j|j|WdQRXdS)Nrwb)marshalopen create_statsdumpstats)rfilerfr r r dump_stats,s  zProfile.dump_statscCs|j|jdS)N)disablesnapshot_stats)rr r r r2s zProfile.create_statsc Cs|j}i|_i}xz|D]r}t|j}|j}||j}|j}|j}i} | |t|j<||||| f|j|                 zProfile.snapshot_statscCs(ddl}|j}|j|||S)Nr)__main____dict__r)rcmdr'dictr r r r\s  z Profile.runc Cs0|jzt|||Wd|jX|S)N)enableexecr)rr)r rr r r ras   zProfile.runctxc Os-|jz|||SWd|jXdS)N)r+r)rr%argskwr r r runcalljs zProfile.runcallN) __name__ __module__ __qualname____doc__rrrrrrr/r r r r rs    &  cCs6t|trdd|fS|j|j|jfSdS)N~r) isinstancestr co_filenameco_firstlinenoco_name)r r r r rss rc Csddl}ddl}ddlm}d}|d|}d|_|jdddd d d d d|jd dddd dd d|jdds|j|jd|j \}}||jdddefaultz-sz--sortr z?Sort order when printing to stdout, based on pstats.Stats classrrrbr,__file__r1r' __package__ __cached__r0)ossysZoptparser;Zallow_interspersed_argsZ add_optionargvZ print_usageexit parse_argslenpathinsertdirnamercompilereadrr>r ) rErFr;r<parserZoptionsr-Zprognamefpr Zglobsr r r main{s6       rRr'r0r0) r4__all__Z_lsprofZprofilerrrZProfilerrrrRr1r r r r s  X  $