| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 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
>lqjx$ c �h � Q s ] PHs] PHs] PHs] PHs] PHsQsQs]ds]
s QQ ks
Q s Q Q2 sP! )z�
Child process monitoring for the sampling profiler.
This module monitors a target process for child process creation and spawns
separate profiler instances for each discovered child.
皙�����?g >@c �2 � [ O VQ5 ! )z�
Get all child process IDs of the given process.
Args:
pid: Process ID of the parent process
recursive: If True, return all descendants (children, grandchildren, etc.)
Returns:
List of child PIDs
�� recursive)�_remote_debugging�get_child_pids)�pidr s &&�6C:\Python315\\Lib\profiling\sampling\_child_monitor.pyr r s � � �+�+�C�E�E� c �0 � [ O U 2 ! )z�
Check if a process is a Python process.
Args:
pid: Process ID to check
Returns:
bool: True if the process appears to be a Python process, False otherwise
)r �is_python_process)r s &r r r * s � � �.�.�s�3�3r c �v ` � \ sQ s]7s n QsQ sQ sQ sQ
Q ks\ Q 2 s
\1Q ksQ s
Q sQ
sQ sQsU sP! )�ChildProcessMonitora:
Monitors a target process for child processes and spawns profilers for them.
Use as a context manager:
with ChildProcessMonitor(pid, cli_args, output_pattern) as monitor:
# monitoring runs here
monitor.wait_for_profilers() # optional: wait before cleanup
# cleanup happens automatically
c �� � Vm V m V0m [ 2 U m , U m [ O 2 U m [ O 2 U m
PU m ] U m P! )z�
Initialize the child process monitor.
Args:
pid: Parent process ID to monitor
cli_args: CLI arguments to pass to child profilers
output_pattern: Pattern for output files (format string with {pid})
)
�
parent_pid�cli_args�output_pattern�set�_known_children�_spawned_profilers� threading�Lock�_lock�Event�_stop_event�_monitor_thread�_poll_count)�selfr r r s &&&&r �__init__�ChildProcessMonitor.__init__B sS � � �� �
�,��"�u���"$����^�^�%��
�$�?�?�,���#�����r c � � [ O U O P QU O 0Q5 U m U O O 2 U ! )Tzchild-monitor-)�target�daemon�name)r �Thread�
_monitor_loopr r �start�r s &r � __enter__�ChildProcessMonitor.__enter__V sI � �(�/�/��%�%��!�$�/�/�!2�3�
���
���"�"�$��r c � � U O O 2 U O dX U O O QQ5 U O O 2 % c [ Q[ O Q5 U O 2 U O 9^tt^ 2 [ U O 2 oU O O 2 PPP2 WF D oU O U2 J P
! ) % f h K-9 h)N� @��timeoutz,Warning: Monitor thread did not stop cleanly��file)r r r �join�is_alive�print�sys�stderr�wait_for_profilersr �listr �clear�_cleanup_process)r �exc_type�exc_val�exc_tb�profilers_to_cleanup�procs &&&& r �__exit__�ChildProcessMonitor.__exit___ s� � ����������+�� � �%�%�c�%�2��#�#�,�,�.�.��B�����
���!� �Z�Z�Z�#'��(?�(?�#@� ��#�#�)�)�+� � )�D��!�!�$�'� )��
�Z�s �%0C:�:D
�D
c �x � UO 2 d P! UO 2 UO UQ5 P! [ O cj SO 2 SO SQ5 P! [ O c+ SO 2 P! [ c P! h 9 hh 9 hh 9 h)Nr+ )�poll� terminate�wait�
subprocess�TimeoutExpired�kill� Exception)r r<