File: C:/Users/fred/miniconda3/Tools/scripts/__pycache__/summarize_stats.cpython-312.pyc
�
�X�fy_ � �� � d Z ddlZddlZddlZddlZddlZddlmZ ddl Z ddl
Z
ej dk( rdZndZ e
ej � ZdgZej dd D ]- Zej# d � r ee� Zej) e� �/ ee� D � �ci c] \ } }|| ��
c}} Z e eej3 � � � Zd
Zd� Zd� Zd
� Zd� Zd� Zd� Z d� Z!d� Z"d� Z#d4d�Z$d� Z%d� Z&d� Z'd5d�Z( G d� d� Z)d� Z*d� Z+d� Z,d� Z-d� Z.d � Z/d!� Z0d"� Z1d#� Z2d$� Z3d%� Z4d&� Z5d'� Z6d(� Z7d)� Z8d*� Z9d+� Z:d,� Z;d-� Z<d.� Z=d/� Z>d0� Z?d6d1�Z@d2� ZAeBd3k( r eA� yy# e$ r Y ��w xY wc c}} w )7zTPrint a summary of specialization stats for all files in the
default stats folders.
� N)�date�ntzc:\temp\py_stats\z/tmp/py_stats/z<0>� �<)�specialization.hit�specialization.miss�execution_countc � � |dk( ry| |z d�S )zb
Format a ratio as a percentage. When the denominator is 0, returns the empty
string.
r � z.01%� )�num�dens � Tools\scripts\summarize_stats.py�format_ratior % s � �
�a�x���c�'�$�� � c � � t | � dk( rt |� dk( rg S t | � r4t t d� | D � � � }t |� dk7 rt d� �t |� r4t t d� |D � � � }t |� dk7 rt d� �t | � r!t |� rd d k7 rt d� �t | � rd }nd }dg|dz
z }| D �ci c] }|d |dd ��
}}|D �ci c] }|d |dd ��
}}t |� t | � k7 st |� t |� k7 rt d
� �t |j � � |j � D � cg c] } | |vs�| �� c} z }
|
D � cg c]* } | g|j | |� �|j | |� ����, c} S c c}w c c}w c c} w c c} w )zf
Joins two tables together, side-by-side, where the first column in each is a
common key.
r c 3 �2 K � | ] }t |� �� � y �w�N��len��.0�xs r � <genexpr>zjoin_rows.<locals>.<genexpr>8 � � �� �2�6�a�3�q�6�6�� �r zTable a is raggedc 3 �2 K � | ] }t |� �� � y �wr r r s r r zjoin_rows.<locals>.<genexpr>= r r zTable b is raggedzTables have different widthsr NzDuplicate keys)r �list�set�
ValueError�keys�get)�a_rows�b_rows�a_ncols�b_ncols�ncols�defaultr �a_data�b_data�kr! s r � join_rowsr, / s� � �
�6�{�a��C��K�1�,�� �
�6�{��s�2�6�2�2�3���w�<�1���0�1�1�
�6�{��s�2�6�2�2�3���w�<�1���0�1�1�
�6�{�s�6�{�w�q�z�W�Q�Z�'?��7�8�8�
�6�{���
����
���d�e�a�i� �G�#)�
*�6�a�a��d�A�a�b�E�k�6�F�
*�#)�
*�6�a�a��d�A�a�b�E�k�6�F�
*�
�6�{�c�&�k�!�S��[�C��K�%?��)�*�*� ����
��V�[�[�]�!N�]��a�v�o�!�]�!N�N�D�KO�P�4�a�Q�A����A�w�'�A�&�*�*�Q��*@�A�4�P�P�� +��
*�� "O��Ps �,G �G�7 G
�G
�/Gc � � g }t | � D ]n }|j d� r�|dv r|t d� d }n|dk( r�.|dv r�3|j d� r�E|}|j |d�| | d�t | | |� f� �p |S )Nzspecialization.failure_kinds)r r �specialization.r )�specialization.success�specialization.failure�
specializable�pairz>12)�sorted�
startswithr �appendr )�family_stats�total�rows�key�labels r �calculate_specialization_statsr; U s� � �
�D��l�#���>�>�8�9���?�?���-�.�/�0�E�
�%�
%��
�Z�
Z��
�^�^�F�
#���E�����c�{��S�(9�#�'>��l�[^�N_�af�Ag�h�i� $� �Kr c � � d}dD ] }|| j |d� z
}� g }|r^dD ]Y }|t d� d }|d j � |dd z }| j |d� }|j ||t ||� f� �[ |S )Nr )r/ r0 r. r )r"