1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Revamp SQLITE_TESTCTRL_TUNE to provide visibility of current turning

parameter values.

FossilOrigin-Name: 677e645e69e1f06487c26da6671fc03f0fb89a0f8e0d35712e6bdcf7279bdfc4
This commit is contained in:
drh
2021-06-04 13:40:26 +00:00
parent f3c1256a4d
commit 2d26cfcc4a
5 changed files with 43 additions and 18 deletions

View File

@@ -4285,11 +4285,12 @@ int sqlite3_test_control(int op, ...){
}
#ifdef SQLITE_DEBUG
/* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, val)
/* sqlite3_test_control(SQLITE_TESTCTRL_TUNE, id, *piValue)
**
** "id" must be an integer between 0 and SQLITE_NTUNE-1. "val"
** is a 64-bit signed integer. This test-control sets tuning parameter
** id to the value val.
** If "id" is an integer between 1 and SQLITE_NTUNE then set the value
** of the id-th tuning parameter to *piValue. If "id" is between -1
** and -SQLITE_NTUNE, then write the current value of the (-id)-th
** tuning parameter into *piValue.
**
** Tuning parameters are for use during transient development builds,
** to help find the best values for constants in the query planner.
@@ -4301,8 +4302,14 @@ int sqlite3_test_control(int op, ...){
*/
case SQLITE_TESTCTRL_TUNE: {
int id = va_arg(ap, int);
int val = va_arg(ap, sqlite3_int64);
if( id>=0 && id<SQLITE_NTUNE ) Tuning(id) = val;
int *piValue = va_arg(ap, int*);
if( id>0 && id<=SQLITE_NTUNE ){
Tuning(id) = *piValue;
}else if( id<0 && id>=-SQLITE_NTUNE ){
*piValue = Tuning(-id);
}else{
rc = SQLITE_NOTFOUND;
}
break;
}
#endif