ó
	GÏOc           @   sg   d  Z  d d l m Z d d l Z d d l Z d d l Z d „  Z e d k rc e e j d ƒ n  d S(   s¦   
gather_profile_stats.py /path/to/dir/of/profiles

Note that the aggregated profiles must be read with pstats.Stats, not
hotshot.stats (the formats are incompatible)
iÿÿÿÿ(   t   statsNc         C   s?  i  } xõ t  j |  ƒ D]ä } | j d ƒ rV | d  } t j t  j j |  | ƒ ƒ } nU | j d ƒ r | j d ƒ } d j | d  ƒ } t j	 t  j j |  | ƒ ƒ } n q d | GH| | k rÔ | | j
 | ƒ n
 | | | <t  j t  j j |  | ƒ ƒ q Wx: | j ƒ  D], \ } } | j t  j j |  d | ƒ ƒ qWd  S(   Ns	   .agg.profi÷ÿÿÿs   .proft   .iýÿÿÿs   Processing %ss   %s.agg.prof(   t   ost   listdirt   endswitht   pstatst   Statst   patht   joint   splitR    t   loadt   addt   unlinkt   itemst
   dump_stats(   t   pt   profilest   fR   t   proft   bits(    (    sB   ../Django//lib/python/django/bin/profiling/gather_profile_stats.pyt   gather_stats   s"    
!!	
 t   __main__i   (	   t   __doc__t   hotshotR    R   R   t   sysR   t   __name__t   argv(    (    (    sB   ../Django//lib/python/django/bin/profiling/gather_profile_stats.pyt   <module>   s   	