
M9c       s     d  Z   # d k Z $ d k Z % d k Z & d k Z ' d k Z ) d k Z + d f  d     YZ d f  d     YZ d   Z	 d   Z
 d   Z d	   Z d
   Z d   Z d   Z d   Z d S(   s3   Class for printing reports on profiled python code.Ns   Statsc      s  + d  Z  G I d   Z R d   Z i d   Z  d   Z  d   Z  h  d d f f d f d <d	 d f f d
 f d <d d f f d f d <d d f f d f d <d d f f d f d <d d f f d f d <d d f d d f d d f f d f d <d d f f d f d <d d f f d f d <d d f f d f d <Z  d    Z  d!   Z  d"   Z	  d#   Z
 d$   Z (d%   Z @d&   Z Xd'   Z od(   Z d)   Z d*   Z d+   Z d,   Z d-   Z d.   Z RS(/   s  This class is used for creating reports from data generated by the
	Profile class.  It is a "friend" of that class, and imports data either
	by direct access to members of Profile class, or by reading in a dictionary
	that was emitted (via marshal) from the Profile class.

	The big change from the previous Profiler (in terms of raw functionality)
	is that an "add()" method has been provided to combine Stats from
	several distinct profile runs.  Both the constructor and the add()
	method now take arbitrarily many file names as arguments.

	All the print methods now take an argument that indicates how many lines
	to print.  If the arg is a floating point number between 0 and 1.0, then
	it is taken as a decimal percentage of the available lines to be printed
	(e.g., .1 means print 10% of all available lines).  If it is an integer,
	it is taken to mean the number of lines of data that you wish to have
	printed.

	The sort_stats() method now processes some additional options (i.e., in
	addition to the old -1, 0, 1, or 2).  It takes an arbitrary number of quoted
	strings to select the sort order.  For example sort_stats('time', 'name')
	sorts on the major key of "internal function time", and on the minor
	key of 'the name of the function'.  Look at the two tables in sort_stats()
	and get_sort_arg_defs(self) for more examples.

	All methods now return "self",  so you can string together commands like:
	    Stats('foo', 'goo').strip_dirs().sort_stats('calls').	                        print_stats(5).print_callers(5)
	c    sh   I J t  |  o K t } n M | d } N | d } O |  i |  P t |  i |  i   d  S(   Ni    i   (	   s   lens   argss   Nones   args   selfs   inits   applys   adds   ignore(   s   selfs   argss   args#   /mit/python/lib/python2.0/pstats.pys   __init__I s   c    s   R S t  |  _ T g  |  _ U t  |  _ V d |  _ W d |  _ X d |  _ Y d |  _ Z h  |  _	 [ h  |  _
 \ h  |  _ ] |  i |  ^ d } _ z ` |  i   a d } Wd  b c | o/ d d Ge |  i o e |  i d Gn f Hn Xd  S(   Ni    i   s   Invalid timing data(   s   Nones   selfs   all_calleess   filess   fcn_lists   total_tts   total_callss
   prim_callss   max_name_lens	   top_levels   statss   sort_arg_dicts
   load_statss   args   troubles   get_top_level_stats(   s   selfs   args   troubles#   /mit/python/lib/python2.0/pstats.pys   initR s*   	
 c    sE  i j | o j h  |  _ n k t |  t d  j o l t | d  } m t i |  |  _ n | i   o y4 p t	 i
 |  } q t i | d  d | } Wn r s n Xt | g |  _ n@ u t | d  o, v | i   w | i |  _ x h  | _ n y |  i o% z t d |  i d | d  n } d  Sd  S(	   Ns    s   rbi   s       s   create_statss   Cannot create or construct a s    object from 's   '(   s   args   selfs   statss   types   opens   fs   marshals   loads   closes   oss   stats
   file_statss   times   ctimes   filess   hasattrs   create_statss	   TypeErrors	   __class__(   s   selfs   args   fs
   file_statss#   /mit/python/lib/python2.0/pstats.pys
   load_statsi s&    "%c    s     x |  i i   d  r }  |  i | \ } } } } }  |  i	 | |  _	  |  i
 | |  _
  |  i | |  _  | i d d d f  o  t |  i | <n  t t |   |  i j o  t t |   |  _ n q Wd  S(   Ni    s   jprofiles   profiler(   s   selfs   statss   keyss   funcs   ccs   ncs   tts   cts   callerss   total_callss
   prim_callss   total_tts   has_keys   Nones	   top_levels   lens   func_std_strings   max_name_len(   s   selfs   funcs   ccs   ncs   tts   cts   callerss#   /mit/python/lib/python2.0/pstats.pys   get_top_level_stats s    	c    s    | o  |  Sn  t |  d j o  t |  i | d  n  | d }  t |   t |  j p |  i | i j o  t |  } n  |  i	 | i	 |  _	  |  i
 | i
 |  _
  |  i | i |  _  |  i | i |  _  x, | i i   d  r }  t |  i | <qW |  i | i j  o  | i |  _ n  t |  _  x | i i   d  rk }  |  i i |  o  |  i | } n  d d d d h  f }  t |  | i |  |  i | <qmW |  Sd  S(   Ni   i    (   s   arg_lists   selfs   lens   applys   adds   others   types	   __class__s   Statss   filess   total_callss
   prim_callss   total_tts	   top_levels   keyss   funcs   Nones   max_name_lens   fcn_lists   statss   has_keys   old_func_stats   add_func_stats(   s   selfs   arg_lists   others   funcs   old_func_stats#   /mit/python/lib/python2.0/pstats.pys   add s2     / 	 		i   s
   call counts   callsi   s   cumulative times
   cumulativei   s	   file names   filei   s   line numbers   lines   modulei   s   function names   names   name/file/lines   nfli    s   pcallsi   s   standard names   stdnamei   s   internal times   timec    s     |  i o  h  |  _ }  | i   }  h  }  x |  i i   d  r }  | }  xl  | oa  | o  Pn  | i	 |  o  d | | < Pn  |  i | | | < | d  } qi WqQ W x# | i   d  r }  | | =q Wn  |  i Sd S(   s)   Expand all abbreviations that are unique.i    i   N(
   s   selfs   sort_arg_dicts   dicts   keyss   std_lists   bad_lists   sort_arg_dict_defaults   words   fragments   has_key(   s   selfs   dicts   std_lists   bad_lists   words   fragments#   /mit/python/lib/python2.0/pstats.pys   get_sort_arg_defs s*   	 		 
 	c    s    | o  d |  _  |  Sn  t |  d j o t | d  t d  j o=  h  d d <d d <d d <d d <| d g } n  |  i   }  f  }  d |  _  d }  xP | d  rC }  | | | d }  |  i | | | d |  _  d	 } q W g  }  xq |  i i   d  r[ }  |  i | \ } }	 }
 } }  | i | |	 |
 | f t |  t |  | f  q6W | i t |  i   g  |  _ }  x( | d  r }  | i | d  qW |  Sd  S(
   Ni    i   s   stdnames   callss   times
   cumulativei   s    s   , (   s   fields   selfs   fcn_lists   lens   types   get_sort_arg_defss   sort_arg_defss
   sort_tuples	   sort_types	   connectors   words
   stats_lists   statss   keyss   funcs   ccs   ncs   tts   cts   callerss   appends
   func_splits   func_std_strings   sorts	   TupleComps   compares   tuple(   s   selfs   fields   sort_arg_defss
   sort_tuples	   connectors   words
   stats_lists   funcs   ccs   ncs   tts   cts   callerss   fcn_lists   tuples#   /mit/python/lib/python2.0/pstats.pys
   sort_stats s2   3=		 		 	: 	c    s/     |  i o  |  i i   n  |  Sd  S(   N(   s   selfs   fcn_lists   reverse(   s   selfs#   /mit/python/lib/python2.0/pstats.pys   reverse_order s    c  	  s    |  i }  h  |  _ }  d }  x| i   d  r}  | | \ } } } } }	  t |  }
  t t |
   | j o  t t |
   } n  h  }  x0 |	 i   d  r }  |	 | | t |  <q W| i |
  o0 t | |
 | | | | | f  | |
 <n | | | | | f | |
 <q: W|  i } 	h  |  _ } 
x, | i   d 
r } t | t |  <qsW| |  _ t |  _ t |  _ |  Sd  S(   Ni    (   s   selfs   statss   oldstatss   newstatss   max_name_lens   keyss   funcs   ccs   ncs   tts   cts   callerss   func_strip_paths   newfuncs   lens   func_std_strings
   newcallerss   func2s   has_keys   add_func_statss	   top_levels   old_tops   new_tops   Nones   fcn_lists   all_callees(   s   selfs   oldstatss   newstatss   max_name_lens   funcs   ccs   ncs   tts   cts   callerss   newfuncs
   newcallerss   func2s   old_tops   new_tops#   /mit/python/lib/python2.0/pstats.pys
   strip_dirs s4   	 		 	#  	c 	   s   |  i o d  Sn h  |  _ } x |  i i   d r } | i |  o h  | | <n |  i | \ } } } } } xS | i   d r@ } | i |  o h  | | <n | | | | | <q Wq@ W d  Sd  S(   Ni    (   s   selfs   all_calleess   statss   keyss   funcs   has_keys   ccs   ncs   tts   cts   callerss   func2(	   s   selfs   all_calleess   funcs   ccs   ncs   tts   cts   callerss   func2s#   /mit/python/lib/python2.0/pstats.pys   calc_calleess     	 	c    s  ()| } *t |  t d  j oV +g  } ,xC | d ,r6 } -t i | t |   o .| i |  n q= Wn 0t	 |  } 1t |  t d  j o d | j o
 d j  n o( 2t | | d  } 3| |  } nU 4t |  t d  j o d | j o
 | j  n o 5| } 6| |  } n 7t	 |  t	 |  j o8 8| d t	 |  d t	 |  d	 | d
 } n <| | f Sd  S(   Ns    i    f1.0f0.0f0.5i   s      List reduced from s    to s    due to restriction <s   >
(   s   lists   new_lists   types   sels   funcs   res   searchs   func_std_strings   appends   lens   counts   ints   msg(   s   selfs   sels   lists   msgs   new_lists   funcs   counts#   /mit/python/lib/python2.0/pstats.pys   eval_print_amount(s"   		 	::	8c    sO  @A|  i } B|  i o% C|  i } Dd |  i d } n F|  i i   } Gd } Ix1 | d Ir$ } J|  i | | |  \ } } qh WLt |  } N| o Od | f Sn P| GHQ| t |  i  j  o[ Rd } SxH | d Sr; } Tt t |   | j o Ut t |   } n q Wn V| d | f Sd  S(   Ns      Ordered by: s   
s!      Random listing order was used
i    i   (   s   selfs   max_name_lens   widths   fcn_lists   lists	   sort_types   msgs   statss   keyss   sel_lists	   selections   eval_print_amounts   lens   counts   funcs   func_std_string(   s   selfs   sel_lists   widths   lists   msgs	   selections   counts   funcs#   /mit/python/lib/python2.0/pstats.pys   get_print_list@s(   	 	"	 	!c    sJ  XYx |  i d Yr } Z| GHq W[|  i o [Hn \d } ]x. |  i i   d ]r } ^| Gt |  GHqZ W`| G|  i Gd Ga|  i |  i	 j o bd |  i	 Gd Gn cd Gt
 i |  i d  Gd GHdHe|  i |  \ } } f| oB g|  i   hx# | d hr } i|  i |  qWjHkHn l|  Sd  S(	   Ni    s           s   function callss   (s   primitive calls)s   ini   s   CPU seconds(   s   selfs   filess   filenames   indents	   top_levels   keyss   funcs   func_get_function_names   total_callss
   prim_callss   fpformats   fixs   total_tts   get_print_lists   amounts   widths   lists   print_titles
   print_line(   s   selfs   amounts   filenames   indents   funcs   widths   lists#   /mit/python/lib/python2.0/pstats.pys   print_statsXs.    	 	 	
 	c    s   op|  i |  \ } } q| o r|  i   t|  i | d  uxc | d urV } v|  i i	 |  o$ w|  i
 | x| |  i |  n z|  i
 | | h   qQ W{H|Hn }|  Sd  S(   Ns	   called...i    (   s   selfs   get_print_lists   amounts   widths   lists   calc_calleess   print_call_headings   funcs   all_calleess   has_keys   print_call_line(   s   selfs   amounts   widths   lists   funcs#   /mit/python/lib/python2.0/pstats.pys   print_calleesos   
 	c 
   s   |  i |  \ } } | om |  i | d  xH | d r; } |  i | \ } } } } }	 |  i | | |	  qD WHHn |  Sd  S(   Ns   was called by...i    (   s   selfs   get_print_lists   amounts   widths   lists   print_call_headings   funcs   statss   ccs   ncs   tts   cts   callerss   print_call_line(
   s   selfs   amounts   widths   lists   funcs   ccs   ncs   tts   cts   callerss#   /mit/python/lib/python2.0/pstats.pys   print_callerss   
 	c    s   t  i d |  | GHd  S(   Ns	   Function (   s   strings   ljusts	   name_sizes   column_title(   s   selfs	   name_sizes   column_titles#   /mit/python/lib/python2.0/pstats.pys   print_call_headings   c    s   t  i t |  |  G| o d GHd  Sn | i   } | i   | d } d } xa | d rT } t |  } | | | d | | d Gt |  i | d  GHd } qx Wd  S(	   Ns   --i   s    i    s   (s   )i   s    (   s   strings   ljusts   func_std_strings   sources	   name_sizes	   call_dicts   keyss   clists   sorts   indents   funcs   names   f8s   selfs   stats(   s   selfs	   name_sizes   sources	   call_dicts   clists   indents   funcs   names#   /mit/python/lib/python2.0/pstats.pys   print_call_lines   	 	6c    sn   t  i d d  Gt  i d d  Gt  i d d  Gt  i d d  Gt  i d d  Gd GHd  S(   Ns   ncallsi	   s   tottimei   s   percalls   cumtimes   filename:lineno(function)(   s   strings   rjust(   s   selfs#   /mit/python/lib/python2.0/pstats.pys   print_titles   c    s   |  i | \ } } } } } | } | | j o | d | } n t	 i
 | d  Gt |  G| d j o d d Gn t | |  Gt |  G| d j o d d Gn t | |  Gt |  GHd  S(   Ns   /i	   i    s    i   (   s   selfs   statss   funcs   ccs   ncs   tts   cts   callerss   cs   strings   rjusts   f8s   func_std_string(   s   selfs   funcs   ccs   ncs   tts   cts   callerss   cs#   /mit/python/lib/python2.0/pstats.pys
   print_lines   
c    s
   d  S(   N(    (   s   selfs#   /mit/python/lib/python2.0/pstats.pys   ignores   (   s   __doc__s   __init__s   inits
   load_statss   get_top_level_statss   adds   sort_arg_dict_defaults   get_sort_arg_defss
   sort_statss   reverse_orders
   strip_dirss   calc_calleess   eval_print_amounts   get_print_lists   print_statss   print_calleess   print_callerss   print_call_headings   print_call_lines   print_titles
   print_lines   ignore(    s#   /mit/python/lib/python2.0/pstats.pys   Stats+ s.   		  #!	s	   TupleCompc      s&   d  Z  d   Z d   Z RS(   s  This class provides a generic function for comparing any two tuples.
	Each instance records a list of tuple-indices (from most significant
	to least significant), and sort direction (ascending or decending) for
	each tuple-index.  The compare functions can then be used as the function
	argument to the system sort() function when a list of tuples need to be
	sorted in the instances order.c    s   | |  _  d  S(   N(   s   comp_select_lists   self(   s   selfs   comp_select_lists#   /mit/python/lib/python2.0/pstats.pys   __init__s   c    s   xm |  i d r] \ } } | | } | | } | | j  o | Sn | | j o | Sn q Wd Sd  S(   Ni    (   s   selfs   comp_select_lists   indexs	   directions   lefts   ls   rights   r(   s   selfs   lefts   rights   indexs	   directions   ls   rs#   /mit/python/lib/python2.0/pstats.pys   compares    (   s   __doc__s   __init__s   compare(    s#   /mit/python/lib/python2.0/pstats.pys	   TupleComps   	c    s5   |  \ } } } t i i |  | | f Sd  S(   N(   s	   func_names   files   lines   names   oss   paths   basename(   s	   func_names   files   lines   names#   /mit/python/lib/python2.0/pstats.pys   func_strip_paths   c    s   |  d Sd  S(   Ni   (   s   func(   s   funcs#   /mit/python/lib/python2.0/pstats.pys   func_get_function_names   c    s5   |  \ } } } | d | d | d Sd  S(   Ns   :s   (s   )(   s	   func_names   files   lines   name(   s	   func_names   files   lines   names#   /mit/python/lib/python2.0/pstats.pys   func_std_strings   c    s   |  Sd  S(   N(   s	   func_name(   s	   func_names#   /mit/python/lib/python2.0/pstats.pys
   func_splits   c    si   | \ } } } } } |  \ } } }	 }
 } | | | | | |	 | |
 t | |  f Sd S(   s3   Add together all the stats for two profile entries.N(   s   sources   ccs   ncs   tts   cts   callerss   targets   t_ccs   t_ncs   t_tts   t_cts	   t_callerss   add_callers(   s   targets   sources   ccs   ncs   tts   cts   callerss   t_ccs   t_ncs   t_tts   t_cts	   t_callerss#   /mit/python/lib/python2.0/pstats.pys   add_func_statss   c    s   h  } x* |  i   d r } |  | | | <q! WxZ | i   d rG } | i |  o | | | | | | <n | | | | <qQ W| Sd S(   s*   Combine two caller lists in a single list.i    N(   s   new_callerss   targets   keyss   funcs   sources   has_key(   s   targets   sources   new_callerss   funcs#   /mit/python/lib/python2.0/pstats.pys   add_callerss   	 	 	c    sJ   d } x* |  i   d r } | |  | } q! W| Sd S(   s@   Sum the caller statistics to get total number of calls received.i    N(   s   ncs   callerss   keyss   func(   s   callerss   ncs   funcs#   /mit/python/lib/python2.0/pstats.pys   count_callss   	 	c    s&   t  i t i |  d  d  Sd  S(   Ni   i   (   s   strings   rjusts   fpformats   fixs   x(   s   xs#   /mit/python/lib/python2.0/pstats.pys   f8s   (   s   __doc__s   oss   times   strings   marshals   res   fpformats   Statss	   TupleComps   func_strip_paths   func_get_function_names   func_std_strings
   func_splits   add_func_statss   add_callerss   count_callss   f8(    s#   /mit/python/lib/python2.0/pstats.pys   ? s"   " 	