bgFddlmZddlZddlmZmZddlmZ ddlZej Z n #e $rdZ YnwxYwGdde Z e ZdS) )unicode_literalsN)CounterMetricFamilyGaugeMetricFamily)REGISTRYic0eZdZdZdddefdZdZdZdS) ProcessCollectorz6Collector for Standard Exports such as cpu and memory.cdS)Nselfr t/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/prometheus_client/process_collector.pyzProcessCollector.srz/procc||_||_||_|r |dz|_nd|_d|_ t jd|_n##ttttf$rYnwxYwt|_ d|_ ||_ n#t$rYnwxYw|r||dSdS)N _process_process_gY@ SC_CLK_TCKr) _namespace_pid_proc_prefix_ticksossysconf ValueError TypeErrorAttributeErrorOSError _PAGESIZE _pagesize_btime _boot_timeIOErrorregister)r namespacepidprocregistrys r__init__zProcessCollector.__init__s#   &${2DLL%DL  *\22DKKI~w?    D #  //++DKK    D   $   d # # # # # $ $s#A A,+A,B B*)B*c>ttj|jdd5}|D]L}|dr5t |dccdddSM ddddS#1swxYwYdS)Nstatrbsbtime r)openrpathjoinr startswithfloatsplit)r r,lines rr#zProcessCollector._boot_time-s "',,tz622D 9 9 2T 2 2??9--2 a1111 2 2 2 2 2 2 2 22 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2sABBBBc f|jsgStj|jt |}g} ttj|dd5}| dd }dddn #1swxYwYt|j dzdt|d}t|j d zd t|d |jz}t|d |jz }t|j d zd||jz}t|d|jz } t|d|jz } t!|j dzd| | z} ||||| gn#t$$rYnwxYw ttj|dd5} | D]X} | drAt|j dzdt| d}nYdddn #1swxYwYt|j dzdt)tjtj|d}|||gn#t$t,f$rYnwxYw|S)Nr,r-)virtual_memory_byteszVirtual memory size in bytes.)valueresident_memory_byteszResident memory size in bytes.start_time_secondsz6Start time of the process since unix epoch in seconds. cpu_seconds_totalz0Total user and system CPU time spent in seconds.limitss Max open filemax_fdsz(Maximum number of open file descriptors.open_fdsz Number of open file descriptors.fd)r"rr/r0rstrrstripr.readr3rrr2r!rrextendr$r1lenlistdirr)r r'resultr,partsvmemrssstart_time_secs start_timeutimestimecpurBr4rCrEs rcollectzProcessCollector.collect3s{ Igll4:s499;;'7'7'='='?'?@@ bgll3//66 >$**4004::<< > > > > > > > > > > > > > > >%T\4J%J%DERWXZR[L\L\^^^D#DL3J$JLl*/b *:*:T^*KMMMC#E"I..rbs'''''' @@@@@@@@OOO$$&&IIIII MMMMMvMMM`%$&&<