Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Better integrate the new malloc related instrumentation with the test infrastructure. (CVS 4904) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d2140cae39dcced63e3ad5771e52d522 |
User & Date: | danielk1977 2008-03-21 17:29:38.000 |
Context
2008-03-21
| ||
18:01 | Defer allocating memory space to hold the array of column values and names in sqlite3_exec() until there is a need to use the array. In the common case where there is no callback, this avoids a malloc() call. (CVS 4905) (check-in: d8686abcdf user: drh tags: trunk) | |
17:29 | Better integrate the new malloc related instrumentation with the test infrastructure. (CVS 4904) (check-in: d2140cae39 user: danielk1977 tags: trunk) | |
17:13 | Make sure the text result of an aggregate function has the correct encoding. Ticket #3009. (CVS 4903) (check-in: 13e388cecf user: drh tags: trunk) | |
Changes
Changes to test/tester.tcl.
1 2 3 4 5 6 7 8 9 10 11 12 13 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements some common TCL routines used for regression # testing the SQLite library # | | | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # 2001 September 15 # # The author disclaims copyright to this source code. In place of # a legal notice, here is a blessing: # # May you do good and not evil. # May you find forgiveness for yourself and forgive others. # May you share freely, never taking more than you give. # #*********************************************************************** # This file implements some common TCL routines used for regression # testing the SQLite library # # $Id: tester.tcl,v 1.109 2008/03/21 17:29:38 danielk1977 Exp $ set tcl_precision 15 set sqlite_pending_byte 0x0010000 # # Check the command-line arguments for a default soft-heap-limit. |
︙ | ︙ | |||
40 41 42 43 44 45 46 47 48 49 50 51 52 53 | # # Check the command-line arguments to set the memory debugger # backtrace depth. # # See the sqlite3_memdebug_backtrace() function in mem2.c or # test_malloc.c for additional information. # for {set i 0} {$i<[llength $argv]} {incr i} { if {[regexp {^--backtrace=(\d+)$} [lindex $argv $i] all value]} { sqlite3_memdebug_backtrace $value set argv [lreplace $argv $i $i] } } | > > > > > > > > > | 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | # # Check the command-line arguments to set the memory debugger # backtrace depth. # # See the sqlite3_memdebug_backtrace() function in mem2.c or # test_malloc.c for additional information. # for {set i 0} {$i<[llength $argv]} {incr i} { if {[lindex $argv $i] eq "--malloctrace"} { set argv [lreplace $argv $i $i] sqlite3_memdebug_backtrace 5 sqlite3_memdebug_log start set argv [lreplace $argv $i $i] set tester_do_malloctrace 1 } } for {set i 0} {$i<[llength $argv]} {incr i} { if {[regexp {^--backtrace=(\d+)$} [lindex $argv $i] all value]} { sqlite3_memdebug_backtrace $value set argv [lreplace $argv $i $i] } } |
︙ | ︙ | |||
226 227 228 229 230 231 232 233 234 235 236 237 238 239 | sqlite3_memdebug_dump ./memusage.txt } } puts "Maximum memory usage: [sqlite3_memory_highwater 1] bytes" puts "Current memory usage: [sqlite3_memory_highwater] bytes" if {[info commands sqlite3_memdebug_malloc_count] ne ""} { puts "Number of malloc() : [sqlite3_memdebug_malloc_count] calls" } foreach f [glob -nocomplain test.db-*-journal] { file delete -force $f } foreach f [glob -nocomplain test.db-mj*] { file delete -force $f } | > > > > > > | 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 | sqlite3_memdebug_dump ./memusage.txt } } puts "Maximum memory usage: [sqlite3_memory_highwater 1] bytes" puts "Current memory usage: [sqlite3_memory_highwater] bytes" if {[info commands sqlite3_memdebug_malloc_count] ne ""} { puts "Number of malloc() : [sqlite3_memdebug_malloc_count] calls" } if {[info exists ::tester_do_malloctrace]} { puts "Writing mallocs.sql..." memdebug_log_sql sqlite3_memdebug_log stop sqlite3_memdebug_log clear } foreach f [glob -nocomplain test.db-*-journal] { file delete -force $f } foreach f [glob -nocomplain test.db-mj*] { file delete -force $f } |
︙ | ︙ | |||
642 643 644 645 646 647 648 | foreach prag {default_cache_size} { append txt $prag-[$db eval "PRAGMA $prag"]\n } # puts txt=$txt return [md5 $txt] } | | > < > > > | | | | < < < < | < < | | < < < < < | < < < < < < < < | | < < < | < < > | < < < < | < < < | < < < | < < < | < | | 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 | foreach prag {default_cache_size} { append txt $prag-[$db eval "PRAGMA $prag"]\n } # puts txt=$txt return [md5 $txt] } proc memdebug_log_sql {{filename mallocs.sql}} { set data [sqlite3_memdebug_log dump] set nFrame [expr [llength [lindex $data 0]]-2] if {$nFrame < 0} { return "" } set database temp set tbl "CREATE TABLE ${database}.malloc(nCall, nByte" for {set ii 1} {$ii <= $nFrame} {incr ii} { append tbl ", f${ii}" } append tbl ");\n" set sql "" foreach e $data { append sql "INSERT INTO ${database}.malloc VALUES([join $e ,]);\n" foreach f [lrange $e 2 end] { set frames($f) 1 } } set tbl2 "CREATE TABLE ${database}.frame(frame INTEGER PRIMARY KEY, line);\n" set tbl3 "CREATE TABLE ${database}.file(name PRIMARY KEY, content);\n" foreach f [array names frames] { set addr [format %x $f] set cmd "addr2line -e [info nameofexec] $addr" set line [eval exec $cmd] append sql "INSERT INTO ${database}.frame VALUES($f, '$line');\n" set file [lindex [split $line :] 0] set files($file) 1 } foreach f [array names files] { set contents "" catch { set fd [open $f] set contents [read $fd] close $fd } set contents [string map {' ''} $contents] append sql "INSERT INTO ${database}.file VALUES('$f', '$contents');\n" } set fd [open $filename w] puts $fd "BEGIN; ${tbl}${tbl2}${tbl3}${sql} ; COMMIT;" close $fd } # Copy file $from into $to. This is used because some versions of # TCL for windows (notably the 8.4.1 binary package shipped with the # current mingw release) have a broken "file copy" command. # proc copy_file {from to} { |
︙ | ︙ |