View file File name : profile.pyc Content :� �bc @ s$ d Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d d d g Z e d d � Z e d d � Z d � Z e e d � r� e j d � Z n d Z y+ d d l Z d � Z e d � Z d Z Wn e k r� n Xd f d � � YZ d � Z d � Z e d k r e � n d S( s Class for profiling Python code.i����N( t OptionParsert runt runctxt helpt Profilec C s] t � } y | j | � } Wn t k r/ n X| d k rL | j | � n | j | � Sd S( s Run statement under profiler optionally saving results in filename This function takes a single argument that can be passed to the "exec" statement, and an optional file name. In all cases this routine attempts to "exec" its first argument and gather profiling statistics from the execution. If no file name is present, then this function automatically prints a simple profiling report, sorted by the standard name string (file/line/function-name) that is presented in each line. N( R R t SystemExitt Nonet dump_statst print_stats( t statementt filenamet sortt prof( ( s /usr/lib/python2.7/profile.pyR 0 s c C sc t � } y | j | | | � } Wn t k r5 n X| d k rR | j | � n | j | � Sd S( s� Run statement under profiler, supplying your own globals and locals, optionally saving results in filename. statement and filename have the same semantics as profile.run N( R R R R R R ( R t globalst localsR R R ( ( s /usr/lib/python2.7/profile.pyR E s c C s d GHd GHd S( Ns2 Documentation for the profile module can be found s? in the Python Library Reference, section 'The Python Profiler'.( ( ( ( s /usr/lib/python2.7/profile.pyR W s t timesc C s | � } | d | d S( Ni i ( ( t timert t( ( s /usr/lib/python2.7/profile.pyt _get_time_times\ s i c C s t j t j � S( N( t resourcet getrusaget RUSAGE_SELF( ( ( s /usr/lib/python2.7/profile.pyt <lambda>g t c C s | � } | d | d S( Ni i ( ( R R ( ( s /usr/lib/python2.7/profile.pyt _get_time_resourceh s i c B s3 e Z d Z d Z d"