If SQLITE_ENABLE_STMT_SCANSTATUS is defined, record the number of times each VDBE opcode is executed. Derive the values returned by sqlite3_stmt_scanstatus() from these records on demand.

FossilOrigin-Name: 9ea37422a8cc2fce51bb10508e5e90f40fd4b511
This commit is contained in:
dan
2014-11-01 20:38:06 +00:00
parent 89e71646df
commit 6f9702ed4d
10 changed files with 203 additions and 177 deletions
+6 -16
View File
@@ -25,7 +25,6 @@
** of this structure.
*/
typedef struct Vdbe Vdbe;
typedef struct ExplainArg ExplainArg;
/*
** The names of the following types declared in vdbeInt.h are required
@@ -60,7 +59,6 @@ struct VdbeOp {
KeyInfo *pKeyInfo; /* Used when p4type is P4_KEYINFO */
int *ai; /* Used when p4type is P4_INTARRAY */
SubProgram *pProgram; /* Used when p4type is P4_SUBPROGRAM */
ExplainArg *pExplain; /* Used when p4type is P4_EXPLAIN */
int (*xAdvance)(BtCursor *, int *);
} p4;
#ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
@@ -102,19 +100,6 @@ struct VdbeOpList {
};
typedef struct VdbeOpList VdbeOpList;
/*
** Structure used as the P4 parameter for OP_Explain opcodes.
*/
struct ExplainArg {
int iCsr; /* Cursor number this applies to */
i64 nLoop; /* Number of times loop has run */
i64 nVisit; /* Total number of rows visited */
i64 nEst; /* Estimated number of rows per scan */
const char *zName; /* Name of table/index being scanned */
const char *zExplain; /* EQP text for this loop */
};
/*
** Allowed values of VdbeOp.p4type
*/
@@ -134,7 +119,6 @@ struct ExplainArg {
#define P4_INTARRAY (-15) /* P4 is a vector of 32-bit integers */
#define P4_SUBPROGRAM (-18) /* P4 is a pointer to a SubProgram structure */
#define P4_ADVANCE (-19) /* P4 is a pointer to BtreeNext() or BtreePrev() */
#define P4_EXPLAIN (-20) /* P4 is a pointer to an instance of ExplainArg */
/* Error message codes for OP_Halt */
#define P5_ConstraintNotNull 1
@@ -298,4 +282,10 @@ void sqlite3VdbeLinkSubProgram(Vdbe *, SubProgram *);
# define VDBE_OFFSET_LINENO(x) 0
#endif
#ifdef SQLITE_ENABLE_STMT_SCANSTATUS
void sqlite3VdbeScanCounter(Vdbe*, int, int, int, i64, const char*);
#else
# define sqlite3VdbeScanCounter(a,b,c,d,e)
#endif
#endif