/*** A program for performance testing.**** The available command-line options are described below:*/staticconstcharzHelp[]="Usage: %s [--options] DATABASE\n""Options:\n"" --autovacuum Enable AUTOVACUUM mode\n"" --cachesize N Set the cache size to N\n"" --exclusive Enable locking_mode=EXCLUSIVE\n"" --explain Like --sqlonly but with added EXPLAIN keywords\n"" --heap SZ MIN Memory allocator uses SZ bytes & min allocation MIN\n"" --incrvacuum Enable incremenatal vacuum mode\n"" --journalmode M Set the journal_mode to MODE\n"" --key KEY Set the encryption key to KEY\n"" --lookaside N SZ Configure lookaside for N slots of SZ bytes each\n"" --nosync Set PRAGMA synchronous=OFF\n"" --notnull Add NOT NULL constraints to table columns\n"" --pagesize N Set the page size to N\n"" --pcache N SZ Configure N pages of pagecache each of size SZ bytes\n"" --primarykey Use PRIMARY KEY instead of UNIQUE where appropriate\n"" --reprepare Reprepare each statement upon every invocation\n"" --scratch N SZ Configure scratch memory for N slots of SZ bytes each\n"" --sqlonly No-op. Only show the SQL that would have been run.\n"" --size N Relative test size. Default=100\n"" --stats Show statistics at the end\n"" --testset T Run test-set T\n"" --trace Turn on SQL tracing\n"" --utf16be Set text encoding to UTF-16BE\n"" --utf16le Set text encoding to UTF-16LE\n"" --verify Run additional verification steps.\n"" --without-rowid Use WITHOUT ROWID where appropriate\n";#include"sqlite3.h"#include<assert.h>#include<stdio.h>#include<stdlib.h>#include<stdarg.h>#include<string.h>#include<ctype.h>/* All global state is held in this structure */staticstructGlobal{sqlite3*db;/* The open database connection */sqlite3_stmt*pStmt;/* Current SQL statement */sqlite3_int64iStart;/* Start-time for the current test */sqlite3_int64iTotal;/* Total time */intbWithoutRowid;/* True for --without-rowid */intbReprepare;/* True to reprepare the SQL on each rerun */intbSqlOnly;/* True to print the SQL once only */intbExplain;/* Print SQL with EXPLAIN prefix */intbVerify;/* Try to verify that results are correct */intszTest;/* Scale factor for test iterations */constchar*zWR;/* Might be WITHOUT ROWID */constchar*zNN;/* Might be NOT NULL */constchar*zPK;/* Might be UNIQUE or PRIMARY KEY */unsignedintx,y;/* Pseudo-random n