Your IP : 3.12.165.68
3
\�g � @ sf d Z ddlZddlZddlZddlZddlZddlmZ dgZG dd� d�Z G dd� d�Z
dd � Zd
d� Zdd
� Z
dd� Zdd� Zdd� Zdd� Zedk�rbddlZyddlZW n ek
r� Y nX G dd� dej�Zeej�dkr�ejd ZndZyTee�Zx"ejdd� D ]Zeje� �qW edejd� ej � edejd� W n e!k
�r` Y nX dS )z3Class for printing reports on profiled python code.� N)�
cmp_to_key�Statsc @ s� e Zd ZdZdd�dd�Zdd� Zdd � Zd
d� Zdd
� Zdd� Z dBdFdJdNdQdTdWdZd]dbdfdidmdqd!�Z
d"d#� Zd$d%� Zd&d'� Z
d(d)� Zd*d+� Zd,d-� Zd.d/� Zd0d1� Zd2d3� Zd4d5� Zd6d7� Zdrd9d:�Zd;d<� Zd=d>� ZdS )sr a� 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 that are respectively interpreted as
'stdname', 'calls', 'time', and 'cumulative'). 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 return self, so you can string together commands like:
Stats('foo', 'goo').strip_dirs().sort_stats('calls'). print_stats(5).print_callers(5)
N)�streamc G sF |pt j| _t|�sd }n|d }|dd � }| j|� | j|� d S )Nr � )�sys�stdoutr �len�init�add)�selfr �args�arg� r �/usr/lib64/python3.6/pstats.py�__init__A s
zStats.__init__c C s� d | _ g | _d | _d| _d| _d| _d| _t� | _i | _ i | _
| j|� y| j� W n8 t
k
r� td| jrx| jd nd | jd� � Y nX d S )Nr zInvalid timing data %sr � )�file���)�all_callees�files�fcn_list�total_tt�total_calls�
prim_calls�max_name_len�set� top_level�stats�
sort_arg_dict�
load_stats�get_top_level_stats� Exception�printr )r r
r r r r K s"