ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     ÿØÿà JFIF      ÿÛ „ 	 ( %!1!%)+//.383,7(-.+



-%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ               ÿÄ J  	     ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ              ÿÄ *        !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú
"SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5
ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍÑ¶¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e
ríV
..............................................................................................................................................................................
.............................................................................                                                  
                                                                                                                                                                                     
fc           @   s   d  Z  d d l Z d d l Z d d l Z d d l Z d d l Z e e d  s` e d   n  e j   Z	 e j
   a d   Z d   Z d   Z d   Z d	   Z d
   Z d d  Z d S(   s  
Some helper functions to analyze the output of sys.getdxp() (which is
only available if Python was built with -DDYNAMIC_EXECUTION_PROFILE).
These will tell you which opcodes have been executed most frequently
in the current process, and, if Python was also built with -DDXPAIRS,
will tell you which instruction _pairs_ were executed most frequently,
which may help in choosing new instructions.

If Python was built without -DDYNAMIC_EXECUTION_PROFILE, importing
this module will raise a RuntimeError.

If you're running a script you want to profile, a simple way to get
the common pairs is:

$ PYTHONPATH=$PYTHONPATH:<python_srcdir>/Tools/scripts ./python -i -O the_script.py --args
...
> from analyze_dxp import *
> s = render_common_pairs()
> open('/tmp/some_file', 'w').write(s)
iNt   getdxpsK   Can't import analyze_dxp: Python built without -DDYNAMIC_EXECUTION_PROFILE.c         C   s#   t  |   d k o" t |  d t  S(   s[   Returns True if the Python that produced the argument profile
    was built with -DDXPAIRS.i    (   t   lent
   isinstancet   list(   t   profile(    (    s1   /usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt	   has_pairs(   s    c           C   s'   t   t j   t j   a Wd QXd S(   s<   Forgets any execution profile that has been gathered so far.N(   t   _profile_lockt   sysR    t   _cumulative_profile(    (    (    s1   /usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt   reset_profile/   s    
c          C   s   t   t j   }  t |   r| x t t t   D]C } x: t t t |   D]" } t | | c |  | | 7<qO Wq2 Wn1 x. t t t   D] } t | c |  | 7<q WWd QXd S(   s   Reads sys.getdxp() and merges it into this module's cached copy.

    We need this because sys.getdxp() 0s itself every time it's called.N(   R   R   R    R   t   rangeR   R   (   t   new_profilet
   first_instt   second_instt   inst(    (    s1   /usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt   merge_profile7   s    c           C   s%   t   t   t j t  SWd QXd S(   s9   Returns the cumulative execution profile until this call.N(   R   R   t   copyt   deepcopyR   (    (    (    s1   /usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt   snapshot_profileH   s    c         C   s   t  |   r |  r |  d } n |  } g  t |  D]. \ } } | d k r2 | t j | | f ^ q2 } | j d t j d  d t  | S(   s   Returns the most common opcodes in order of descending frequency.

    The result is a list of tuples of the form
      (opcode, opname, # of occurrences)

    ii    t   keyi   t   reverse(   R   t	   enumeratet   opcodet   opnamet   sortt   operatort
   itemgettert   True(   R   t	   inst_listt   opt   countt   result(    (    s1   /usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt   common_instructionsO   s    (c         C   s   t  |   s g  Sg  t |  d   D]Z \ } } t |  D]A \ } } | d k r7 | | f t j | t j | f | f ^ q7 q! } | j d t j d  d t  | S(   s   Returns the most common opcode pairs in order of descending frequency.

    The result is a list of tuples of the form
      ((1st opcode, 2nd opcode),
       (1st opname, 2nd opname),
       # of occurrences of the pair)

    ii    R   i   R   (   R   R   R   R   R   R   R   R   (   R   t   op1t
   op1profilet   op2R   R   (    (    s1   /usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt   common_pairsa   s    	>c            s7     d k r t     n    f d   } d j |    S(   s   Renders the most common opcode pairs to a string in order of
    descending frequency.

    The result is a series of lines of the form:
      # of occurrences: ('1st opname', '2nd opname')

    c          3   s3   x, t     D] \ }  } } d | | f Vq Wd  S(   Ns   %s: %s
(   R$   (   t   _t   opsR   (   R   (    s1   /usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt   seq   s    t    N(   t   NoneR   t   join(   R   R'   (    (   R   s1   /usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt   render_common_pairsu   s    (   t   __doc__R   R   R   R   t	   threadingt   hasattrt   RuntimeErrort   RLockR   R    R   R   R	   R   R   R    R$   R)   R+   (    (    (    s1   /usr/lib64/python2.7/Tools/scripts/analyze_dxp.pyt   <module>   s    						