diff options
| author | Johnny Chen <johnny.chen@apple.com> | 2011-08-09 00:56:07 +0000 |
|---|---|---|
| committer | Johnny Chen <johnny.chen@apple.com> | 2011-08-09 00:56:07 +0000 |
| commit | 250a501702f0f1786bc093415dada54729b124e1 (patch) | |
| tree | 7de9c42ffd899c475c58de79904eaadb000c9d9d | |
| parent | 413bff1b3b49cd644d63936e8132932bad9f4b02 (diff) | |
| download | bcm5719-llvm-250a501702f0f1786bc093415dada54729b124e1.tar.gz bcm5719-llvm-250a501702f0f1786bc093415dada54729b124e1.zip | |
Check in a customized benchmark which compares the Xcode 4.1 vs. Xcode 4.2's gdb disassembly speed
on lldb's Driver::MainLoop function which is ~1190 lines of x86 assembly code. This file is not
exercised during the normal test suite run, i.e., no +b option specified. So it should be ok.
The following is the benchmark result on my MBP running OSX Lion:
[17:38:46] johnny:/Volumes/data/lldb/svn/trunk/test $ ./dotest.py -v +b -p TestFlintVsSlate
/Volumes/data/lldb/svn/trunk/build/Debug
LLDB-71
Path: /Volumes/data/lldb/svn/trunk
URL: https://johnny@llvm.org/svn/llvm-project/lldb/trunk
Repository Root: https://johnny@llvm.org/svn/llvm-project
Repository UUID: 91177308-0d34-0410-b5e6-96231b3b80d8
Revision: 137008
Node Kind: directory
Schedule: normal
Last Changed Author: gclayton
Last Changed Rev: 137008
Last Changed Date: 2011-08-05 17:50:36 -0700 (Fri, 05 Aug 2011)
Session logs for test failures/errors/unexpected successes will go into directory '2011-08-08-17_38_52'
Command invoked: python ./dotest.py -v +b -p TestFlintVsSlate
----------------------------------------------------------------------
Collected 2 tests
1: test_run_41_then_42 (TestFlintVsSlateGDBDisassembly.FlintVsSlateGDBDisassembly)
Test disassembly on a large function with 4.1 vs. 4.2's gdb. ...
4.1 gdb benchmark: Avg: 0.205623 (Laps: 5, Total Elapsed Time: 1.028113)
4.2 gdb benchmark: Avg: 0.201970 (Laps: 5, Total Elapsed Time: 1.009849)
gdb_42_avg/gdb_41_avg: 0.982236
ok
2: test_run_42_then_41 (TestFlintVsSlateGDBDisassembly.FlintVsSlateGDBDisassembly)
Test disassembly on a large function with 4.1 vs. 4.2's gdb. ...
4.2 gdb benchmark: Avg: 0.202602 (Laps: 5, Total Elapsed Time: 1.013012)
4.1 gdb benchmark: Avg: 0.204418 (Laps: 5, Total Elapsed Time: 1.022089)
gdb_42_avg/gdb_41_avg: 0.991119
ok
----------------------------------------------------------------------
Ran 2 tests in 15.688s
OK
llvm-svn: 137092
| -rw-r--r-- | lldb/test/benchmarks/disassembly/TestFlintVsSlateGDBDisassembly.py | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/lldb/test/benchmarks/disassembly/TestFlintVsSlateGDBDisassembly.py b/lldb/test/benchmarks/disassembly/TestFlintVsSlateGDBDisassembly.py new file mode 100644 index 00000000000..48c29168f46 --- /dev/null +++ b/lldb/test/benchmarks/disassembly/TestFlintVsSlateGDBDisassembly.py @@ -0,0 +1,92 @@ +"""Disassemble lldb's Driver::MainLoop() functions comparing Xcode 4.1 vs. 4.2's gdb.""" + +import os, sys +import unittest2 +import lldb +import pexpect +from lldbbench import * + +class FlintVsSlateGDBDisassembly(BenchBase): + + mydir = os.path.join("benchmarks", "example") + + def setUp(self): + BenchBase.setUp(self) + self.gdb_41_exe = '/Flint/usr/bin/gdb' + self.gdb_42_exe = '/Developer/usr/bin/gdb' + self.exe = self.lldbExec + self.function = 'Driver::MainLoop()' + self.gdb_41_avg = None + self.gdb_42_avg = None + + @benchmarks_test + def test_run_41_then_42(self): + """Test disassembly on a large function with 4.1 vs. 4.2's gdb.""" + print + self.run_gdb_disassembly(self.gdb_41_exe, self.exe, self.function, 5) + print "4.1 gdb benchmark:", self.stopwatch + self.gdb_41_avg = self.stopwatch.avg() + self.run_gdb_disassembly(self.gdb_42_exe, self.exe, self.function, 5) + print "4.2 gdb benchmark:", self.stopwatch + self.gdb_42_avg = self.stopwatch.avg() + print "gdb_42_avg/gdb_41_avg: %f" % (self.gdb_42_avg/self.gdb_41_avg) + + @benchmarks_test + def test_run_42_then_41(self): + """Test disassembly on a large function with 4.1 vs. 4.2's gdb.""" + print + self.run_gdb_disassembly(self.gdb_42_exe, self.exe, self.function, 5) + print "4.2 gdb benchmark:", self.stopwatch + self.gdb_42_avg = self.stopwatch.avg() + self.run_gdb_disassembly(self.gdb_41_exe, self.exe, self.function, 5) + print "4.1 gdb benchmark:", self.stopwatch + self.gdb_41_avg = self.stopwatch.avg() + print "gdb_42_avg/gdb_41_avg: %f" % (self.gdb_42_avg/self.gdb_41_avg) + + def run_gdb_disassembly(self, gdb_exe_path, exe, function, count): + # Set self.child_prompt, which is "(gdb) ". + self.child_prompt = '(gdb) ' + prompt = self.child_prompt + + # So that the child gets torn down after the test. + self.child = pexpect.spawn('%s %s' % (gdb_exe_path, exe)) + child = self.child + + # Turn on logging for what the child sends back. + if self.TraceOn(): + child.logfile_read = sys.stdout + + child.expect_exact(prompt) + child.sendline('break %s' % function) + child.expect_exact(prompt) + child.sendline('run') + child.expect_exact(prompt) + + # Reset the stopwatch now. + self.stopwatch.reset() + for i in range(count): + with self.stopwatch: + # Disassemble the function. + child.sendline('disassemble') + child.expect_exact(prompt) + child.sendline('next') + child.expect_exact(prompt) + + child.sendline('quit') + child.expect_exact('The program is running. Exit anyway?') + child.sendline('y') + try: + self.child.expect(pexpect.EOF) + except: + pass + + if self.TraceOn(): + print "gdb disassembly benchmark:", str(self.stopwatch) + self.child = None + + +if __name__ == '__main__': + import atexit + lldb.SBDebugger.Initialize() + atexit.register(lambda: lldb.SBDebugger.Terminate()) + unittest2.main() |

