1 """Test lldb's response time for 'frame variable' command."""
3 from __future__ import print_function
9 from lldbsuite.test import configuration
10 from lldbsuite.test import lldbtest_config
11 from lldbsuite.test.lldbbench import *
13 class FrameVariableResponseBench(BenchBase):
15 mydir = TestBase.compute_mydir(__file__)
19 self.exe = lldbtest_config.lldbExec
20 self.break_spec = '-n main'
25 @expectedFailureWindows("llvm.org/pr22274: need a pexpect replacement for windows")
26 def test_startup_delay(self):
27 """Test response time for the 'frame variable' command."""
29 self.run_frame_variable_bench(self.exe, self.break_spec, self.count)
30 print("lldb frame variable benchmark:", self.stopwatch)
32 def run_frame_variable_bench(self, exe, break_spec, count):
34 # Set self.child_prompt, which is "(lldb) ".
35 self.child_prompt = '(lldb) '
36 prompt = self.child_prompt
38 # Reset the stopwatchs now.
39 self.stopwatch.reset()
40 for i in range(count):
41 # So that the child gets torn down after the test.
42 self.child = pexpect.spawn('%s %s %s' % (lldbtest_config.lldbExec, self.lldbOption, exe))
45 # Turn on logging for what the child sends back.
47 child.logfile_read = sys.stdout
50 child.sendline('breakpoint set %s' % break_spec)
51 child.expect_exact(prompt)
53 # Run the target and expect it to be stopped due to breakpoint.
54 child.sendline('run') # Aka 'process launch'.
55 child.expect_exact(prompt)
58 # Measure the 'frame variable' response time.
59 child.sendline('frame variable')
60 child.expect_exact(prompt)
62 child.sendline('quit')
64 self.child.expect(pexpect.EOF)
68 # The test is about to end and if we come to here, the child process has
69 # been terminated. Mark it so.