How to use cgconfig_restart method in autotest

Best Python code snippet using autotest_python

cpu_high_load_test.py

Source: cpu_high_load_test.py Github

copy

Full Screen

...172 dic_cgroup_property[cgroup_name2] = mk_dic_property(controller_list,173 property_value2)174 cgconfig_file_modify(cgconfig_file, controller_list,175 dic_cgroup_property, cgroup)176 utils_cgroup.cgconfig_restart()177 # After cgconfig restart, there are some cgroups created automatically178 cgroup.refresh_cgroups()179 cgroup_index1 = cgroup.get_cgroup_index(cgroup=cgroup_name1)180 cgroup_index2 = cgroup.get_cgroup_index(cgroup=cgroup_name2)181 threads = []182 cgroup_name = []183 cgroup_name.append(cgroup_name1)184 cgroup_name.append(cgroup_name2)185 sh_path = []186 sh_path.append(tmp_file1)187 sh_path.append(tmp_file2)188 for i in range(0, 2):189 thd = threading.Thread(190 target=cgroup.cgexec,191 args=(cgroup_name[i], sh_path[i]))192 threads.append(thd)193 # Start process194 for i in range(0, 2):195 threads[i].start()196 time.sleep(3)197 pid_list1 = cgroup.get_pids(cgroup_index1)198 pid_list2 = cgroup.get_pids(cgroup_index2)199 pid_rate1 = get_cpu_rate(pid_list1)200 pid_rate2 = get_cpu_rate(pid_list2)201 kill_pids(pid_list1)202 kill_pids(pid_list2)203 del cgroup204 del modules205 if pid_rate1.get(pid_list1[-1]) <= pid_rate2.get(pid_list1[-1]):206 raise error.TestFail("cpu rate test pid rate failed!")207 finally:208 # Recover environment209 utils.run(recover_cmd)210 utils_cgroup.cgconfig_restart()211def execute(cgroup_cls):212 """213 Execute cpu test.214 :param cgroup_cls: Cgroup class215 """216 if cgroup_cls is None:217 raise error.TestNAError("Got a none cgroup class")218 cpu_test = CpuHighLoad(cgroup_cls._cgroup_dir, cgroup_cls.tmpdir)...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

Scala Testing: A Comprehensive Guide

Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.

What Agile Testing (Actually) Is

So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.

How To Choose The Right Mobile App Testing Tools

Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools

A Complete Guide To CSS Houdini

As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????

Appium Testing Tutorial For Mobile Applications

The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.

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 autotest 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