K i zddlZddlZddlZddlmZmZmZddlmZdZ dZ dZ dZ d Z d Zed k(reyy) N)startfinalize_select_backend)set_command_linec tjddtj}|jddtd|jdd td dgd  |jd dtddddg |jddtdd|jddtddddg |jddtddddg |jdtj d !|j }||jfS)"NzBThe proton command utility for profiling scripts and pytest tests.z proton [options] script.py [script_args] [script_options] proton [options] pytest [pytest_args] [script_options] python -m triton.profiler.proton [options] script.py [script_args] [script_options] ) descriptionusageformatter_classz-nz--namezName of the profiling session)typehelpz-bz --backendzProfiling backend)cupti roctracerinstrumentation)r r defaultchoicesz-cz --contextzProfiling contextshadowpythonz-mz--modezProfiling mode)r r rz-dz--datazProfiling datatreetracez-kz--hookzProfiling hooklaunch target_argszSubcommand and its arguments)nargsr )argparseArgumentParserRawTextHelpFormatter add_argumentstr REMAINDER parse_argsr)parserargss \/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/triton/profiler/proton.pyparse_argumentsr$s(  $ $Xa22 4F  hS7VW k:MW[ IK k:MW_!)8 46 hS7GQUV hS7GQWbhjqars hS7GQU`dfn_op  X-?-?Fde    D !! !!cFtjj|dk(S)Npytest)ospathbasename)scripts r# is_pytestr,s 77  F #x //r%crtjj|}ddd|dttj ti}tj }|g|zt_tjjtjj| t|d5}t|j|d}dddt||t_y#1swY!xYw#t$r-}td|t jdYd}~Id}~wwxYw#|t_wxYw) N__name____main____file__ __builtins__rbexecz.An error occurred while executing the script: r)r(r)abspathr1sysr.argvappenddirnameopencompilereadr3 Exceptionprintexit)r+r" script_path clean_globals original_argvfilecodees r#execute_as_mainrE s''//&)K JK  c MHHMx$CHHHOOBGGOOK01! +t $ =499; VqcBC  !sB C0(C$C0$C-)C00 D&9#D!D)!D&&D)) D6ct|d}t|dkDr|ddng}t|rddl}|j |yt ||y)Nrr)rlenr,r'mainrE)rr+ script_argsr's r#do_setup_and_executerJ;sK ^F%(%5%9+ab/rK K  ,r%c|jr |jn t}t|j|j|j ||j t|ty)N)contextdatabackendhook) rNrrnamerLrMrOrJr)r"rrNs r# run_profilingrQHsF"lldll0AG $))T\\ 7QUQZQZ[% Jr%c6t\}}t||y)N)r$rQ)r"rs r#rHrHRs')D+$ $r%r/)rr5r(profilerrrflagsrr$r,rErJrQrHr.r%r#rVsI 55#"(0!6 -%  zFr%