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

Function display_stats

modules/dasSQLITE/sqlite/shell.c:18098–18241  ·  view source on GitHub ↗

** Display memory stats. */

Source from the content-addressed store, hash-verified

18096** Display memory stats.
18097*/
18098static int display_stats(
18099 sqlite3 *db, /* Database to query */
18100 ShellState *pArg, /* Pointer to ShellState */
18101 int bReset /* True to reset the stats */
18102){
18103 int iCur;
18104 int iHiwtr;
18105 FILE *out;
18106 if( pArg==0 || pArg->out==0 ) return 0;
18107 out = pArg->out;
18108
18109 if( pArg->pStmt && pArg->statsOn==2 ){
18110 int nCol, i, x;
18111 sqlite3_stmt *pStmt = pArg->pStmt;
18112 char z[100];
18113 nCol = sqlite3_column_count(pStmt);
18114 raw_printf(out, "%-36s %d\n", "Number of output columns:", nCol);
18115 for(i=0; i<nCol; i++){
18116 sqlite3_snprintf(sizeof(z),z,"Column %d %nname:", i, &x);
18117 utf8_printf(out, "%-36s %s\n", z, sqlite3_column_name(pStmt,i));
18118#ifndef SQLITE_OMIT_DECLTYPE
18119 sqlite3_snprintf(30, z+x, "declared type:");
18120 utf8_printf(out, "%-36s %s\n", z, sqlite3_column_decltype(pStmt, i));
18121#endif
18122#ifdef SQLITE_ENABLE_COLUMN_METADATA
18123 sqlite3_snprintf(30, z+x, "database name:");
18124 utf8_printf(out, "%-36s %s\n", z, sqlite3_column_database_name(pStmt,i));
18125 sqlite3_snprintf(30, z+x, "table name:");
18126 utf8_printf(out, "%-36s %s\n", z, sqlite3_column_table_name(pStmt,i));
18127 sqlite3_snprintf(30, z+x, "origin name:");
18128 utf8_printf(out, "%-36s %s\n", z, sqlite3_column_origin_name(pStmt,i));
18129#endif
18130 }
18131 }
18132
18133 if( pArg->statsOn==3 ){
18134 if( pArg->pStmt ){
18135 iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_VM_STEP,bReset);
18136 raw_printf(pArg->out, "VM-steps: %d\n", iCur);
18137 }
18138 return 0;
18139 }
18140
18141 displayStatLine(pArg, "Memory Used:",
18142 "%lld (max %lld) bytes", SQLITE_STATUS_MEMORY_USED, bReset);
18143 displayStatLine(pArg, "Number of Outstanding Allocations:",
18144 "%lld (max %lld)", SQLITE_STATUS_MALLOC_COUNT, bReset);
18145 if( pArg->shellFlgs & SHFLG_Pagecache ){
18146 displayStatLine(pArg, "Number of Pcache Pages Used:",
18147 "%lld (max %lld) pages", SQLITE_STATUS_PAGECACHE_USED, bReset);
18148 }
18149 displayStatLine(pArg, "Number of Pcache Overflow Bytes:",
18150 "%lld (max %lld) bytes", SQLITE_STATUS_PAGECACHE_OVERFLOW, bReset);
18151 displayStatLine(pArg, "Largest Allocation:",
18152 "%lld bytes", SQLITE_STATUS_MALLOC_SIZE, bReset);
18153 displayStatLine(pArg, "Largest Pcache Allocation:",
18154 "%lld bytes", SQLITE_STATUS_PAGECACHE_SIZE, bReset);
18155#ifdef YYTRACKMAXSTACKDEPTH

Callers 2

shell_execFunction · 0.85
do_meta_commandFunction · 0.85

Calls 3

utf8_printfFunction · 0.85
displayStatLineFunction · 0.85
displayLinuxIoStatsFunction · 0.85

Tested by

no test coverage detected