/ Check-in [4df0ac90]
Login

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

Overview
Comment:Remove an unused variable from the VDBE_PROFILE compile-time option. Keep the opcode count in an u32 instead of an int.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4df0ac9023d9261145a4425a508ba009a10276fc
User & Date: drh 2014-02-24 14:24:01
Context
2014-02-24
19:07
In memsys5, initialize new allocations to non-zero bytes. Change the content of freed allocations to prevent use after free. These changes in SQLITE_DEBUG only. check-in: ba5f0a55 user: drh tags: trunk
14:24
Remove an unused variable from the VDBE_PROFILE compile-time option. Keep the opcode count in an u32 instead of an int. check-in: 4df0ac90 user: drh tags: trunk
2014-02-20
19:42
Fix the text of a comment used to generate VDBE opcode documentation so that it omits symbols that can be mistaken for a hyperlink by the parser. check-in: b46d4e89 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/vdbe.c.

   488    488     Mem *pIn2 = 0;             /* 2nd input operand */
   489    489     Mem *pIn3 = 0;             /* 3rd input operand */
   490    490     Mem *pOut = 0;             /* Output operand */
   491    491     int *aPermute = 0;         /* Permutation of columns for OP_Compare */
   492    492     i64 lastRowid = db->lastRowid;  /* Saved value of the last insert ROWID */
   493    493   #ifdef VDBE_PROFILE
   494    494     u64 start;                 /* CPU clock count at start of opcode */
   495         -  int origPc;                /* Program counter at start of opcode */
   496    495   #endif
   497    496     /*** INSERT STACK UNION HERE ***/
   498    497   
   499    498     assert( p->magic==VDBE_MAGIC_RUN );  /* sqlite3_step() verifies this */
   500    499     sqlite3VdbeEnter(p);
   501    500     if( p->rc==SQLITE_NOMEM ){
   502    501       /* This happens if a malloc() inside a call to sqlite3_column_text() or
................................................................................
   550    549     }
   551    550     sqlite3EndBenignMalloc();
   552    551   #endif
   553    552     for(pc=p->pc; rc==SQLITE_OK; pc++){
   554    553       assert( pc>=0 && pc<p->nOp );
   555    554       if( db->mallocFailed ) goto no_mem;
   556    555   #ifdef VDBE_PROFILE
   557         -    origPc = pc;
   558    556       start = sqlite3Hwtime();
   559    557   #endif
   560    558       nVmStep++;
   561    559       pOp = &aOp[pc];
   562    560   
   563    561       /* Only allow tracing if SQLITE_DEBUG is defined.
   564    562       */
................................................................................
  6271   6269       }
  6272   6270   
  6273   6271   #ifdef VDBE_PROFILE
  6274   6272       {
  6275   6273         u64 elapsed = sqlite3Hwtime() - start;
  6276   6274         pOp->cycles += elapsed;
  6277   6275         pOp->cnt++;
  6278         -#if 0
  6279         -        fprintf(stdout, "%10llu ", elapsed);
  6280         -        sqlite3VdbePrintOp(stdout, origPc, &aOp[origPc]);
  6281         -#endif
  6282   6276       }
  6283   6277   #endif
  6284   6278   
  6285   6279       /* The following code adds nothing to the actual functionality
  6286   6280       ** of the program.  It is only here for testing and debugging.
  6287   6281       ** On the other hand, it does burn CPU cycles every time through
  6288   6282       ** the evaluator loop.  So we can leave it out when NDEBUG is defined.

Changes to src/vdbe.h.

    61     61       SubProgram *pProgram;  /* Used when p4type is P4_SUBPROGRAM */
    62     62       int (*xAdvance)(BtCursor *, int *);
    63     63     } p4;
    64     64   #ifdef SQLITE_ENABLE_EXPLAIN_COMMENTS
    65     65     char *zComment;          /* Comment to improve readability */
    66     66   #endif
    67     67   #ifdef VDBE_PROFILE
    68         -  int cnt;                 /* Number of times this instruction was executed */
           68  +  u32 cnt;                 /* Number of times this instruction was executed */
    69     69     u64 cycles;              /* Total time spent executing this instruction */
    70     70   #endif
    71     71   #ifdef SQLITE_VDBE_COVERAGE
    72     72     int iSrcLine;            /* Source-code line that generated this opcode */
    73     73   #endif
    74     74   };
    75     75   typedef struct VdbeOp VdbeOp;

Changes to src/vdbeaux.c.

  2576   2576             if( pc=='\n' ) fprintf(out, "-- ");
  2577   2577             putc(c, out);
  2578   2578             pc = c;
  2579   2579           }
  2580   2580           if( pc!='\n' ) fprintf(out, "\n");
  2581   2581         }
  2582   2582         for(i=0; i<p->nOp; i++){
  2583         -        fprintf(out, "%6d %10lld %8lld ",
         2583  +        char zHdr[100];
         2584  +        sqlite3_snprintf(sizeof(zHdr), zHdr, "%6u %12llu %8llu ",
  2584   2585              p->aOp[i].cnt,
  2585   2586              p->aOp[i].cycles,
  2586   2587              p->aOp[i].cnt>0 ? p->aOp[i].cycles/p->aOp[i].cnt : 0
  2587   2588           );
         2589  +        fprintf(out, "%s", zHdr);
  2588   2590           sqlite3VdbePrintOp(out, i, &p->aOp[i]);
  2589   2591         }
  2590   2592         fclose(out);
  2591   2593       }
  2592   2594     }
  2593   2595   #endif
  2594   2596     p->iCurrentTime = 0;