System.Data.SQLite
Check-in [9a14ecd4bc]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixes and tweaks to the previous check-in.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | memoryUsage
Files: files | file ages | folders
SHA1: 9a14ecd4bc7f76b8804552bf4c4f848941857e37
User & Date: mistachkin 2015-10-19 05:16:59
Context
2015-10-19
17:22
Further enhancements to the memory usage stress test. Closed-Leaf check-in: 2000da5b93 user: mistachkin tags: memoryUsage
05:16
Fixes and tweaks to the previous check-in. check-in: 9a14ecd4bc user: mistachkin tags: memoryUsage
04:50
Initial work on memory usage stress test. check-in: 7dd94a2532 user: mistachkin tags: memoryUsage
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to Tests/memory.eagle.

56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
  set connection [getDbConnection]

  set sql "SELECT rid, rcvid, size, uuid, content FROM blob ORDER BY rid;"

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db $sql]

  set result [list]

  while {0 && [$dataReader Read]} {
    set working(rid) [$dataReader GetValue \
        [$dataReader GetOrdinal rid]]

    set working(rcvid) [$dataReader GetValue \
        [$dataReader GetOrdinal rcvid]]

    set working(size) [$dataReader GetValue \
        [$dataReader GetOrdinal size]]

    set working(uuid) [$dataReader GetValue \
        [$dataReader GetOrdinal uuid]]

    # set working(content) [$dataReader GetValue \
    #     [$dataReader GetOrdinal content]]

    set working(counter1Cur) [$counter(1) RawValue]
    set working(counter2Cur) [$counter(2) RawValue]
    set working(counter3Cur) [$counter(3) RawValue]

    if {![info exists working(counter1Max)] || \
        $working(counter1Cur) > $working(counter1Max)} then {
      set working(counter1Max) $working(counter1Cur)
      reportMemoryCounters $test_channel counter "new maximum"
      cleanupMemory $test_channel connection
    }

    if {![info exists working(counter2Max)] || \
        $working(counter2Cur) > $working(counter2Max)} then {
      set working(counter2Max) $working(counter2Cur)
      reportMemoryCounters $test_channel counter "new maximum"
      cleanupMemory $test_channel connection
    }

    if {![info exists working(counter3Max)] || \
        $working(counter3Cur) > $working(counter3Max)} then {
      set working(counter3Max) $working(counter3Cur)
      reportMemoryCounters $test_channel counter "new maximum"
      cleanupMemory $test_channel connection
    }
  }

  reportMemoryCounters $test_channel counter final

  set result
} -cleanup {
  freeDbConnection

  unset -nocomplain dataReader connection

  cleanupDb $fileName db true false false

  unset -nocomplain result working sql counter db fileName
} -constraints {eagle monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite fossil_repository_file variable_test_repository_file} \
-result {}}

###############################################################################

#
# NOTE: Report after test.







<
<
|












|
|









|






|






|




<
<







|
|







56
57
58
59
60
61
62


63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105


106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
  set connection [getDbConnection]

  set sql "SELECT rid, rcvid, size, uuid, content FROM blob ORDER BY rid;"

  set dataReader [sql execute -execute reader -format datareader \
      -alias $db $sql]



  while {[$dataReader Read]} {
    set working(rid) [$dataReader GetValue \
        [$dataReader GetOrdinal rid]]

    set working(rcvid) [$dataReader GetValue \
        [$dataReader GetOrdinal rcvid]]

    set working(size) [$dataReader GetValue \
        [$dataReader GetOrdinal size]]

    set working(uuid) [$dataReader GetValue \
        [$dataReader GetOrdinal uuid]]

    set working(content) [$dataReader -create -alias GetValue \
        [$dataReader GetOrdinal content]]

    set working(counter1Cur) [$counter(1) RawValue]
    set working(counter2Cur) [$counter(2) RawValue]
    set working(counter3Cur) [$counter(3) RawValue]

    if {![info exists working(counter1Max)] || \
        $working(counter1Cur) > $working(counter1Max)} then {
      set working(counter1Max) $working(counter1Cur)
      reportMemoryCounters $test_channel counter "new maximum"
      cleanupMemory connection
    }

    if {![info exists working(counter2Max)] || \
        $working(counter2Cur) > $working(counter2Max)} then {
      set working(counter2Max) $working(counter2Cur)
      reportMemoryCounters $test_channel counter "new maximum"
      cleanupMemory connection
    }

    if {![info exists working(counter3Max)] || \
        $working(counter3Cur) > $working(counter3Max)} then {
      set working(counter3Max) $working(counter3Cur)
      reportMemoryCounters $test_channel counter "new maximum"
      cleanupMemory connection
    }
  }

  reportMemoryCounters $test_channel counter final


} -cleanup {
  freeDbConnection

  unset -nocomplain dataReader connection

  cleanupDb $fileName db true false false

  unset -nocomplain working sql counter db fileName
} -constraints {eagle command.object monoBug28 command.sql compile.DATA SQLite\
System.Data.SQLite fossil_repository_file variable_test_repository_file} \
-result {}}

###############################################################################

#
# NOTE: Report after test.

Changes to lib/System.Data.SQLite/common.eagle.

2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
....
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
....
2537
2538
2539
2540
2541
2542
2543


2544
2545
2546
2547
2548
2549
2550
        #
        set code 0
      }

      return $code
    }
 
    proc cleanupMemory { channel varName {quiet false} } {
      if {[haveSQLiteObjectCommand] && \
          [string length $varName] > 0} then {
        #
        # NOTE: Refer to the specified variable (e.g. "connection") in the
        #       context of our caller.  The opaque object handle for an
        #       ADO.NET connection previously returned by [getDbConnection]
        #       should be stored there.
................................................................................
        #
        upvar 1 $varName connection

        if {[catch {
          object invoke $connection ReleaseMemory
        } result]} then {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "==== WARNING: failed to release database memory, error: " \
                \n\t $result \n]
          }
        }
      }

      if {[llength [info commands debug]] > 0} then {
        if {[catch {
          uplevel 1 [list debug purge]
        } result]} then {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "==== WARNING: failed to purge call frame, error: " \
                \n\t $result \n]
          }
        }

        if {[catch {
          uplevel 1 [list debug cleanup]
        } result]} then {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "==== WARNING: failed to cleanup interpreter, error: " \
                \n\t $result \n]
          }
        }

        if {[catch {
          uplevel 1 [list debug collect]
        } result]} then {
          if {!$quiet} then {
            tputs $channel [appendArgs \
                "==== WARNING: failed to collect garbage, error: " \
                \n\t $result \n]
          }
        }
      }
    }
 
................................................................................
            System.Diagnostics.PerformanceCounter Process \
            "Working Set Peak" [file rootname [file tail $::bin_file]]]

        set counter(3) [object create -alias \
            System.Diagnostics.PerformanceCounter Process \
            "Private Bytes" [file rootname [file tail $::bin_file]]]
      }


    }
 
    proc reportMemoryCounters { channel varName prefix } {
      if {[haveSQLiteObjectCommand]} then {
        upvar 1 $varName counter

        tputs $channel [appendArgs \







|







 







|











|









|









|







 







>
>







2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
....
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
....
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
        #
        set code 0
      }

      return $code
    }
 
    proc cleanupMemory { varName {quiet false} } {
      if {[haveSQLiteObjectCommand] && \
          [string length $varName] > 0} then {
        #
        # NOTE: Refer to the specified variable (e.g. "connection") in the
        #       context of our caller.  The opaque object handle for an
        #       ADO.NET connection previously returned by [getDbConnection]
        #       should be stored there.
................................................................................
        #
        upvar 1 $varName connection

        if {[catch {
          object invoke $connection ReleaseMemory
        } result]} then {
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "==== WARNING: failed to release database memory, error: " \
                \n\t $result \n]
          }
        }
      }

      if {[llength [info commands debug]] > 0} then {
        if {[catch {
          uplevel 1 [list debug purge]
        } result]} then {
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "==== WARNING: failed to purge call frame, error: " \
                \n\t $result \n]
          }
        }

        if {[catch {
          uplevel 1 [list debug cleanup]
        } result]} then {
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "==== WARNING: failed to cleanup interpreter, error: " \
                \n\t $result \n]
          }
        }

        if {[catch {
          uplevel 1 [list debug collect]
        } result]} then {
          if {!$quiet} then {
            tputs $::test_channel [appendArgs \
                "==== WARNING: failed to collect garbage, error: " \
                \n\t $result \n]
          }
        }
      }
    }
 
................................................................................
            System.Diagnostics.PerformanceCounter Process \
            "Working Set Peak" [file rootname [file tail $::bin_file]]]

        set counter(3) [object create -alias \
            System.Diagnostics.PerformanceCounter Process \
            "Private Bytes" [file rootname [file tail $::bin_file]]]
      }

      return ""
    }
 
    proc reportMemoryCounters { channel varName prefix } {
      if {[haveSQLiteObjectCommand]} then {
        upvar 1 $varName counter

        tputs $channel [appendArgs \