| Server IP : 121.121.20.254 / Your IP : 216.73.217.51 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Python315/Lib/profiling/sampling/__pycache__/ |
Upload File : |
R
>lqj�# c �v � Q s ] QHGs ] PHs] PHs] QHGs ]QHGs ]QH$G
s
]QH,Gs Qs
] s Q Q\2 sP! ) a�
JSON Lines (JSONL) collector for the sampling profiler.
Emits a normalized newline-delimited JSON record stream suitable for
programmatic consumption by external tools, scripts, and agents. Each line
is one JSON object; consumers can parse the file incrementally line by
line, but the producer writes the whole file at the end of the run (it is
not a live/streaming producer).
Record schema
=============
Every record is a JSON object with at least ``"type"``, ``"v"`` (record
schema version), and ``"run_id"`` (UUID4 hex tagging the run; allows
demultiplexing concatenated streams). Records appear in this fixed order:
1. ``meta`` (exactly one, first line)::
{"type":"meta","v":0,"run_id":"<hex>",
"sample_interval_usec":<int>,"mode":"wall|cpu|gil|all|exception"}
``mode`` is omitted when not provided.
2. ``string_table`` (zero or more)::
{"type":"string_table","v":0,"run_id":"<hex>",
"strings":[{"str_id":<int>,"value":"<str>"}, ...]}
Strings (filenames, function names) are interned to keep repeated values
compact. IDs are zero-based. Each chunk holds up to ``_CHUNK_SIZE``
entries, and each entry carries its explicit ``str_id`` so consumers do
not need to infer offsets across chunks.
3. ``frame_table`` (zero or more)::
{"type":"frame_table","v":0,"run_id":"<hex>",
"frames":[{"frame_id":<int>,"path_str_id":<int>,"func_str_id":<int>,
"line":<int>,"end_line":<int>,"col":<int>,
"end_col":<int>}, ...]}
``end_line``/``col``/``end_col`` are *omitted* when source location data
is unavailable (a missing key means "not available", not zero or null).
``line`` is ``0`` for synthetic frames (for example, internal marker
frames whose source location is None). Frame IDs are zero-based.
4. ``agg`` (zero or more)::
{"type":"agg","v":0,"run_id":"<hex>","kind":"frame","scope":"final",
"samples_total":<int>,
"entries":[{"frame_id":<int>,"self":<int>,"cumulative":<int>}, ...]}
``self`` counts samples where the frame was the leaf (currently
executing); ``cumulative`` counts samples where the frame appeared
anywhere in the stack (deduped per sample so recursion does not
double-count). ``samples_total`` is the run-wide total, repeated on
each chunk so a streaming consumer always knows the denominator.
5. ``end`` (exactly one, last line)::
{"type":"end","v":0,"run_id":"<hex>","samples_total":<int>}
Presence of ``end`` is the consumer's signal that the file is complete.
Forward compatibility
=====================
Consumers MUST ignore unknown record ``"type"`` values and unknown object
fields. New fields will be added by adding optional keys; an incompatible
schema change will bump the per-record ``"v"``.
)�Counter)�batched)�PROFILING_MODE_NAMES��normalize_location)�StackTraceCollector� c � ` `� \ sQ s]Us nQsQP
QP-U 1Q kksQQ ksQ sQ sQ s Q s
Q
sQ s\
Q 2 sQ
s\
Q 2 sQsUsU 9s! )�JsonlCollectorz�Collector that exports finalized profiling data as JSONL.
See the module docstring for the full record schema. The collector
accumulates samples in memory and writes the complete file at
``export()`` time.
� skip_idle�modec � :� [ RU _ VQ 5 [ O 2 O U m - U m , U m - U m , U m [ 2 U m [ 2 U m ] U m
[ 2 U m V0m P! ))r
)�super�__init__�uuid�uuid4�hex�run_id�
_string_to_id�_strings�_frame_to_id�_framesr �_frame_self�_frame_cumulative�_samples_total�set�_seen_frame_ids�_mode)�self�sample_interval_usecr
r � __class__s &&$$��7C:\Python315\\Lib\profiling\sampling\jsonl_collector.pyr �JsonlCollector.__init__] sp �� �
���-��C��j�j�l�&�&��������
�������"�9���!(�������"�u����
� c �� � U 9O U*
tm U O O 2 [ U2 F D� v ov qVqxU O VVU2 o U] 6H o
V�O 7 oU% c U O O U 2 U
% c U O U 99* U*
tt$ U% f J� U O U 99* U*
tt$ J� P! )� )r r �clear� enumerate�_get_or_create_frame_id�addr r )r �frames�
_thread_id�weight�i�filename�location�funcname�_opcode�frame_id�is_leaf�count_cumulatives &&&& r �process_frames�JsonlCollector.process_framesn s� � ����v�%�����"�"�$�:C�F�:K�6�A�6��H��3�3��H��H� �1�f�G�'�/C�/C�C����$�$�(�(��2��� � ��*�f�4�*����&�&�x�0�F�:�0� ;Lr"