/ Check-in [d44d5936]
Login

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

Overview
Comment:When compiling with VDBE_PROFILE, add the sqlite3NProfileCnt global variable which can be used to measure per-opcode values other than elapse time, if non-zero.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d44d5936428859b6d3e089d9835acb8ca1f3c0a85b59eeaa619170623e7dcc30
User & Date: drh 2018-02-12 20:27:34
Context
2018-02-12
20:50
Updates to the speed-check.sh script for improvements to the --vdbeprofile option. check-in: f89c8f8e user: drh tags: trunk
20:27
When compiling with VDBE_PROFILE, add the sqlite3NProfileCnt global variable which can be used to measure per-opcode values other than elapse time, if non-zero. check-in: d44d5936 user: drh tags: trunk
15:27
Update test file func6.test so that it works with SQLITE_ENABLE_NULL_TRIM builds. check-in: e128d72f user: dan tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/global.c.

   254    254   ** Constant tokens for values 0 and 1.
   255    255   */
   256    256   const Token sqlite3IntTokens[] = {
   257    257      { "0", 1 },
   258    258      { "1", 1 }
   259    259   };
   260    260   
          261  +#ifdef VDBE_PROFILE
          262  +/*
          263  +** The following performance counter can be used in place of
          264  +** sqlite3Hwtime() for profiling.  This is a no-op on standard builds.
          265  +*/
          266  +sqlite3_uint64 sqlite3NProfileCnt = 0;
          267  +#endif
   261    268   
   262    269   /*
   263    270   ** The value of the "pending" byte must be 0x40000000 (1 byte past the
   264    271   ** 1-gibabyte boundary) in a compatible database.  SQLite never uses
   265    272   ** the database page that contains the pending byte.  It never attempts
   266    273   ** to read or write that page.  The pending byte page is set aside
   267    274   ** for use by the VFS layers as space for managing file locks.

Changes to src/sqliteInt.h.

  4065   4065   extern const Token sqlite3IntTokens[];
  4066   4066   extern SQLITE_WSD struct Sqlite3Config sqlite3Config;
  4067   4067   extern FuncDefHash sqlite3BuiltinFunctions;
  4068   4068   #ifndef SQLITE_OMIT_WSD
  4069   4069   extern int sqlite3PendingByte;
  4070   4070   #endif
  4071   4071   #endif
         4072  +#ifdef VDBE_PROFILE
         4073  +extern sqlite3_uint64 sqlite3NProfileCnt;
         4074  +#endif
  4072   4075   void sqlite3RootPageMoved(sqlite3*, int, int, int);
  4073   4076   void sqlite3Reindex(Parse*, Token*, Token*);
  4074   4077   void sqlite3AlterFunctions(void);
  4075   4078   void sqlite3AlterRenameTable(Parse*, SrcList*, Token*);
  4076   4079   int sqlite3GetToken(const unsigned char *, int *);
  4077   4080   void sqlite3NestedParse(Parse*, const char*, ...);
  4078   4081   void sqlite3ExpirePreparedStatements(sqlite3*);

Changes to src/vdbe.c.

   644    644     for(pOp=&aOp[p->pc]; 1; pOp++){
   645    645       /* Errors are detected by individual opcodes, with an immediate
   646    646       ** jumps to abort_due_to_error. */
   647    647       assert( rc==SQLITE_OK );
   648    648   
   649    649       assert( pOp>=aOp && pOp<&aOp[p->nOp]);
   650    650   #ifdef VDBE_PROFILE
   651         -    start = sqlite3Hwtime();
          651  +    start = sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();
   652    652   #endif
   653    653       nVmStep++;
   654    654   #ifdef SQLITE_ENABLE_STMT_SCANSTATUS
   655    655       if( p->anExec ) p->anExec[(int)(pOp-aOp)]++;
   656    656   #endif
   657    657   
   658    658       /* Only allow tracing if SQLITE_DEBUG is defined.
................................................................................
  7229   7229   ** readability.  From this point on down, the normal indentation rules are
  7230   7230   ** restored.
  7231   7231   *****************************************************************************/
  7232   7232       }
  7233   7233   
  7234   7234   #ifdef VDBE_PROFILE
  7235   7235       {
  7236         -      u64 endTime = sqlite3Hwtime();
         7236  +      u64 endTime = sqlite3NProfileCnt ? sqlite3NProfileCnt : sqlite3Hwtime();
  7237   7237         if( endTime>start ) pOrigOp->cycles += endTime - start;
  7238   7238         pOrigOp->cnt++;
  7239   7239       }
  7240   7240   #endif
  7241   7241   
  7242   7242       /* The following code adds nothing to the actual functionality
  7243   7243       ** of the program.  It is only here for testing and debugging.