mirror of
https://github.com/sqlite/sqlite.git
synced 2025-07-27 20:41:58 +03:00
Add performance tests to the test suite. (CVS 3516)
FossilOrigin-Name: 270c745dffad7aa24f8707720b3d68ad7a6b2749
This commit is contained in:
@ -11,7 +11,7 @@
|
||||
# This file implements some common TCL routines used for regression
|
||||
# testing the SQLite library
|
||||
#
|
||||
# $Id: tester.tcl,v 1.69 2006/10/04 11:55:50 drh Exp $
|
||||
# $Id: tester.tcl,v 1.70 2006/11/23 09:39:16 drh Exp $
|
||||
|
||||
# Make sure tclsqlite3 was compiled correctly. Abort now with an
|
||||
# error message if not.
|
||||
@ -78,6 +78,9 @@ set nTest 0
|
||||
set skip_test 0
|
||||
set failList {}
|
||||
set maxErr 1000
|
||||
if {![info exists speedTest]} {
|
||||
set speedTest 0
|
||||
}
|
||||
|
||||
# Invoke the do_test procedure to run a single test
|
||||
#
|
||||
@ -118,6 +121,19 @@ proc do_test {name cmd expected} {
|
||||
}
|
||||
}
|
||||
|
||||
# Run an SQL script.
|
||||
# Return the number of microseconds per statement.
|
||||
#
|
||||
proc speed_trial {name numstmt sql} {
|
||||
puts -nonewline [format {%-20.20s } $name...]
|
||||
flush stdout
|
||||
set speed [time {sqlite3_exec_nr db $sql}]
|
||||
set tm [lindex $speed 0]
|
||||
set per [expr {$tm/(1.0*$numstmt)}]
|
||||
set rate [expr {1000000.0*$numstmt/$tm}]
|
||||
puts [format {%20.1f us/stmt %20.5f stmt/s} $per $rate]
|
||||
}
|
||||
|
||||
# The procedure uses the special "sqlite_malloc_stat" command
|
||||
# (which is only available if SQLite is compiled with -DSQLITE_DEBUG=1)
|
||||
# to see how many malloc()s have not been free()ed. The number
|
||||
|
Reference in New Issue
Block a user