/ Check-in [71167951]
Login

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

Overview
Comment:Add an elapsed-time output for faststat1.c.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | est_count_pragma
Files: files | file ages | folders
SHA1:7116795134922b7dc6c527365faadf0b9101c1d4
User & Date: drh 2016-10-26 12:58:31
Context
2016-11-30
16:39
Merge all the latest changes from trunk. check-in: 7ca58a07 user: drh tags: est_count_pragma
2016-10-26
12:58
Add an elapsed-time output for faststat1.c. check-in: 71167951 user: drh tags: est_count_pragma
2016-10-25
19:39
Simplifications to faststat1.c. Fix a bug in sqlite3MovetoProportional() for very large b-trees. check-in: f7f78147 user: drh tags: est_count_pragma
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to tool/faststat1.c.

65
66
67
68
69
70
71










72
73
74
75
76
77
78
...
284
285
286
287
288
289
290

291
292
293

294
295
296
297
298
299
300
...
332
333
334
335
336
337
338


339
340
  fprintf(stderr, "%s: ", g.zArgv0);
  va_start(ap, zFormat);
  vfprintf(stderr, zFormat, ap);
  va_end(ap);
  fprintf(stderr, "\n");
  exit(1);
}











/*
** Prepare a new SQL statement.  Print an error and abort if anything
** goes wrong.
*/
static sqlite3_stmt *db_vprepare(const char *zFormat, va_list ap){
  char *zSql;
................................................................................

int main(int argc, char **argv){
  const char *zDb = 0;
  int i;
  int rc;
  char *zErrMsg = 0;
  sqlite3_stmt *pStmt;


  g.zArgv0 = argv[0];
  sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);

  for(i=1; i<argc; i++){
    const char *z = argv[i];
    if( z[0]=='-' ){
      z++;
      if( z[0]=='-' ) z++;
      if( strcmp(z,"debug")==0 ){
        if( i==argc-1 ) cmdlineError("missing argument to %s", argv[i]);
................................................................................
  while( sqlite3_step(pStmt)==SQLITE_ROW ){
    const char *zName = (const char*)sqlite3_column_text(pStmt, 0);
    analyzeTable(zName);
  }
  sqlite3_finalize(pStmt);
  printf("ANALYZE sqlite_master;\n");
  sqlite3_close(g.db);


  return 0;
}







>
>
>
>
>
>
>
>
>
>







 







>



>







 







>
>


65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
...
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
...
344
345
346
347
348
349
350
351
352
353
354
  fprintf(stderr, "%s: ", g.zArgv0);
  va_start(ap, zFormat);
  vfprintf(stderr, zFormat, ap);
  va_end(ap);
  fprintf(stderr, "\n");
  exit(1);
}

/*
** Return the current time in milliseconds since the julian epoch.
*/
static sqlite3_int64 currentTime(void){
  sqlite3_vfs *pVfs = sqlite3_vfs_find(0);
  sqlite3_int64 x = 0;
  (void)pVfs->xCurrentTimeInt64(pVfs, &x);
  return x;
}

/*
** Prepare a new SQL statement.  Print an error and abort if anything
** goes wrong.
*/
static sqlite3_stmt *db_vprepare(const char *zFormat, va_list ap){
  char *zSql;
................................................................................

int main(int argc, char **argv){
  const char *zDb = 0;
  int i;
  int rc;
  char *zErrMsg = 0;
  sqlite3_stmt *pStmt;
  sqlite3_int64 iStart, iTotal;

  g.zArgv0 = argv[0];
  sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
  iStart = currentTime();
  for(i=1; i<argc; i++){
    const char *z = argv[i];
    if( z[0]=='-' ){
      z++;
      if( z[0]=='-' ) z++;
      if( strcmp(z,"debug")==0 ){
        if( i==argc-1 ) cmdlineError("missing argument to %s", argv[i]);
................................................................................
  while( sqlite3_step(pStmt)==SQLITE_ROW ){
    const char *zName = (const char*)sqlite3_column_text(pStmt, 0);
    analyzeTable(zName);
  }
  sqlite3_finalize(pStmt);
  printf("ANALYZE sqlite_master;\n");
  sqlite3_close(g.db);
  iTotal = currentTime() - iStart;
  printf("-- elapsed time: %lld.%03lld seconds\n", iTotal/1000, iTotal%1000);
  return 0;
}