MCPcopy Create free account
hub / github.com/GaijinEntertainment/daScript / display_scanstats

Function display_scanstats

modules/dasSQLITE/sqlite/shell.c:18275–18355  ·  view source on GitHub ↗

** Display scan stats. */

Source from the content-addressed store, hash-verified

18273** Display scan stats.
18274*/
18275static void display_scanstats(
18276 sqlite3 *db, /* Database to query */
18277 ShellState *pArg /* Pointer to ShellState */
18278){
18279#ifndef SQLITE_ENABLE_STMT_SCANSTATUS
18280 UNUSED_PARAMETER(db);
18281 UNUSED_PARAMETER(pArg);
18282#else
18283 static const int f = SQLITE_SCANSTAT_COMPLEX;
18284 sqlite3_stmt *p = pArg->pStmt;
18285 int ii = 0;
18286 i64 nTotal = 0;
18287 int nWidth = 0;
18288 eqp_reset(pArg);
18289
18290 for(ii=0; 1; ii++){
18291 const char *z = 0;
18292 int n = 0;
18293 if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){
18294 break;
18295 }
18296 n = strlen(z) + scanStatsHeight(p, ii)*3;
18297 if( n>nWidth ) nWidth = n;
18298 }
18299 nWidth += 4;
18300
18301 sqlite3_stmt_scanstatus_v2(p, -1, SQLITE_SCANSTAT_NCYCLE, f, (void*)&nTotal);
18302 for(ii=0; 1; ii++){
18303 i64 nLoop = 0;
18304 i64 nRow = 0;
18305 i64 nCycle = 0;
18306 int iId = 0;
18307 int iPid = 0;
18308 const char *z = 0;
18309 const char *zName = 0;
18310 char *zText = 0;
18311 double rEst = 0.0;
18312
18313 if( sqlite3_stmt_scanstatus_v2(p,ii,SQLITE_SCANSTAT_EXPLAIN,f,(void*)&z) ){
18314 break;
18315 }
18316 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_EST,f,(void*)&rEst);
18317 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NLOOP,f,(void*)&nLoop);
18318 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NVISIT,f,(void*)&nRow);
18319 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NCYCLE,f,(void*)&nCycle);
18320 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_SELECTID,f,(void*)&iId);
18321 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_PARENTID,f,(void*)&iPid);
18322 sqlite3_stmt_scanstatus_v2(p, ii, SQLITE_SCANSTAT_NAME,f,(void*)&zName);
18323
18324 zText = sqlite3_mprintf("%s", z);
18325 if( nCycle>=0 || nLoop>=0 || nRow>=0 ){
18326 char *z = 0;
18327 if( nCycle>=0 && nTotal>0 ){
18328 z = sqlite3_mprintf("%zcycles=%lld [%d%%]", z,
18329 nCycle, ((nCycle*100)+nTotal/2) / nTotal
18330 );
18331 }
18332 if( nLoop>=0 ){

Callers 1

shell_execFunction · 0.85

Calls 4

eqp_resetFunction · 0.85
scanStatsHeightFunction · 0.85
eqp_appendFunction · 0.85
eqp_renderFunction · 0.85

Tested by

no test coverage detected