Best Python code snippet using autotest_python
ftrace.py
Source:ftrace.py
...87 while (self.record_job.sp.poll() is None and88 utils.read_file(tracing_on).strip() != '1'):89 time.sleep(0.1)90 if self.record_job.sp.poll() is not None:91 utils.join_bg_jobs([self.record_job])92 raise error.CmdError(self.record_job.command,93 self.record_job.sp.returncode,94 'trace-cmd exited early.')95 def stop(self, test):96 """97 Stop ftrace profiler.98 :param test: Autotest test in which the profiler will operate on.99 """100 os.kill(self.record_job.sp.pid, signal.SIGINT)101 utils.join_bg_jobs([self.record_job])102 # shrink the buffer to free memory.103 utils.system('%s reset -b 1' % self.trace_cmd)104 # compress output105 utils.system('bzip2 %s' % self.output)106 compressed_output = self.output + '.bz2'107 # if the compressed trace file is large (10MB), just delete it.108 compressed_output_size = os.path.getsize(compressed_output)109 if compressed_output_size > 10 * 1024 * 1024:110 logging.warn('Deleting large trace file %s (%d bytes)',111 compressed_output, compressed_output_size)112 os.remove(compressed_output)113 # remove per-cpu files in case trace-cmd died....
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!