Best Python code snippet using lisa_python
performance.py
Source:performance.py  
...279                    [server_lagscope.set_busy_poll, client_lagscope.set_busy_poll]280                )281                server_lagscope.run_as_server(ip=server_nic.ip_addr)282                result = client_lagscope.run_as_client(server_ip=server_nic.ip_addr)283                lagscope_messages = client_lagscope.create_latency_performance_messages(284                    result=result,285                    test_case_name=inspect.stack()[2].function,286                    test_result=test_result,287                )288                assert lagscope_messages289                assert_that(len(lagscope_messages)).described_as(290                    "at least one message is necessary"291                ).is_greater_than(0)292                return float(293                    sum(x.average_latency_us for x in lagscope_messages)294                    / len(lagscope_messages)295                )296            finally:297                for lagscope in [server_lagscope, client_lagscope]:...common.py
Source:common.py  
...132    try:133        for lagscope in [client_lagscope, server_lagscope]:134            lagscope.set_busy_poll()135        server_lagscope.run_as_server(ip=server.internal_address)136        latency_perf_messages = client_lagscope.create_latency_performance_messages(137            client_lagscope.run_as_client(server_ip=server.internal_address),138            inspect.stack()[1][3],139            test_result,140        )141    finally:142        for lagscope in [client_lagscope, server_lagscope]:143            lagscope.restore_busy_poll()144    return latency_perf_messages145def perf_tcp_pps(146    test_result: TestResult,147    test_type: str,148    server: Optional[RemoteNode] = None,149    client: Optional[RemoteNode] = None,150) -> None:...lagscope.py
Source:lagscope.py  
...220            return Decimal(matched_results.group("average_latency_us"))221        else:222            self._log.debug(f"no average latency found in {result.stdout}")223            return Decimal(-1.0)224    def create_latency_performance_messages(225        self,226        result: ExecutableResult,227        test_case_name: str,228        test_result: "TestResult",229    ) -> List[NetworkLatencyPerformanceMessage]:230        matched_results = self._result_pattern.match(result.stdout)231        assert (232            matched_results233        ), "not found matched latency statistics from lagscope results."234        all_matched_results = find_groups_in_lines(235            result.stdout, self._interval_frequency_pattern236        )237        perf_message_list: List[NetworkLatencyPerformanceMessage] = []238        for matched_result in all_matched_results:...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!!
