File: //proc/self/root/opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyc
�
��4]c @ s d Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l m Z d d l m
Z
d d l m Z d d l m Z d d
l m
Z
y d d l Z Wn e k
r� d Z n Xd Z d Z d e f d � � YZ d
d � Z e j d
d � � Z d S( s� Profiling support for unit and performance tests.
These are special purpose profiling methods which operate
in a more fine-grained way than nose's profiling plugin.
i����Ni ( t config( t
gc_collecti ( t jython( t pypy( t update_wrapper( t win32t ProfileStatsFilec B s\ e Z d Z d � Z e d � � Z d � Z d � Z d � Z d � Z d � Z
d � Z RS( s� "Store per-platform/fn profiling results in a file.
We're still targeting Py2.5, 2.4 on 0.7 with no dependencies,
so no json lib :( need to roll something silly
c C s� t j d k o t j j | _ | j p? t j d k o? t j j | _ t j j | � | _
t j j | j
� d | _ t
j d � � | _ | j � | j r� | j � n d S( Ni����c S s
t j t � S( N( t collectionst defaultdictt dict( ( ( sO /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyt <lambda>: t ( R t optionst Nonet force_write_profilest force_writet write_profilest writet ost patht abspatht fnamet splitt short_fnameR R t datat _readt _write( t selft filename( ( sO /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyt __init__0 s
c C s� t j j d t j j } d j g t j d d !D] } t | � ^ q1 � } | g } | j | � t rx | j d � n t
r� | j d � n t r� | j d � n | j t j j j
r� d n d � t j j � } | j | r� d
p� d � d j | � S( Nt _t .i i R R t wint
nativeunicodet dbapiunicodet cextensionst
nocextensions( R t dbt namet drivert joint syst version_infot strt appendR R R t dialectt convert_unicodet requirementst _has_cextensions( R t dbapi_keyt vt
py_versiont platform_tokenst _has_cext( ( sO /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyt platform_keyB s 2
c C s) t } | | j k o( | j | j | k S( N( t
_current_testR R6 ( R t test_key( ( sO /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyt has_stats[ s c C s� t } | j | } | | j } d | k r= g | d <} n
| d } d | k rd d | d <} n
| d } t | � | k } | s� | j | � | j r� | j � n d } n | d | | f } | d c d 7<| S( Nt countst
current_counti t linenoi ( R7 R R6 t lenR, R R R
( R t callcountR8 t per_fnt per_platformR: R; t has_countt result( ( sO /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/testing/profiling.pyRB a s$
c C s{ t } | j | } | | j } | d } | d } | t | � k rW | | | d <n
| | d <| j rw | j � n d S( NR: R; i i����( R7 R R6 R= R R ( R R>