How to use get_each_method_maximun_cpu_mem method in Airtest

Best Python code snippet using Airtest

plot.py

Source:plot.py Github

copy

Full Screen

...46 self.time_axis.append(date)47 self.cpu_axis.append(cpu_percent)48 self.mem_axis.append(mem_gb_num)49 # 获取各种方法执行过程中的cpu和内存极值:50 self.get_each_method_maximun_cpu_mem()51 def get_each_method_maximun_cpu_mem(self):52 """获取每个方法中的cpu和内存耗费最值点."""53 # 本函数用于丰富self.method_exec_info的信息:存入cpu、mem最值点54 self.method_exec_info = deepcopy(self.data.get("method_exec_info", []))55 method_exec_info = deepcopy(self.method_exec_info) # 用来辅助循环56 method_index, cpu_max, cpu_max_time, mem_max, mem_max_time = 0, 0, 0, 0, 0 # 临时变量57 self.max_mem = 058 for index, timestamp in enumerate(self.timestamp_list):59 # method_exec_info是按顺序的,逐个遍历找出每个method_exec_info中的cpu和mem的最值点和timestamp:60 start, end = method_exec_info[0]["start_time"], method_exec_info[0]["end_time"]61 if timestamp < start:62 # 方法正式start之前的数据,不能参与方法内的cpu、mem计算,直接忽略此条数据63 continue64 elif timestamp <= end:65 # 方法执行期间的数据,纳入最值比较:...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Airtest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful