/ Check-in [1041deb6]
Login

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

Overview
Comment:Tweak to the ".timer" command in the CLI to help it work better with GCC. (CVS 5398)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:1041deb6ae03c52ce1fb8170d11913cc0bbf3a6e
User & Date: drh 2008-07-11 17:23:25
Context
2008-07-11
21:02
Detect and handles the case where a row is modified or deleted while it is being read during SELECT processing. (CVS 5399) check-in: c80a5d09 user: drh tags: trunk
17:23
Tweak to the ".timer" command in the CLI to help it work better with GCC. (CVS 5398) check-in: 1041deb6 user: drh tags: trunk
16:39
Added corruptA.test for testing malformed database headers. (CVS 5397) check-in: 6dcce6b9 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/shell.c.

     8      8   **    May you find forgiveness for yourself and forgive others.
     9      9   **    May you share freely, never taking more than you give.
    10     10   **
    11     11   *************************************************************************
    12     12   ** This file contains code to implement the "sqlite" command line
    13     13   ** utility for accessing SQLite databases.
    14     14   **
    15         -** $Id: shell.c,v 1.183 2008/06/28 11:29:23 mihailim Exp $
           15  +** $Id: shell.c,v 1.184 2008/07/11 17:23:25 drh Exp $
    16     16   */
    17     17   #include <stdlib.h>
    18     18   #include <string.h>
    19     19   #include <stdio.h>
    20     20   #include <assert.h>
    21     21   #include "sqlite3.h"
    22     22   #include <ctype.h>
................................................................................
    75     75   */
    76     76   static void beginTimer(void){
    77     77     if( enableTimer ){
    78     78       getrusage(RUSAGE_SELF, &sBegin);
    79     79     }
    80     80   }
    81     81   
    82         -/* Return the difference of two time_structs in microseconds */
    83         -static int timeDiff(struct timeval *pStart, struct timeval *pEnd){
    84         -  return (pEnd->tv_usec - pStart->tv_usec) + 
    85         -         1000000*(pEnd->tv_sec - pStart->tv_sec);
           82  +/* Return the difference of two time_structs in seconds */
           83  +static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
           84  +  return (pEnd->tv_usec - pStart->tv_usec)*0.000001 + 
           85  +         (double)(pEnd->tv_sec - pStart->tv_sec);
    86     86   }
    87     87   
    88     88   /*
    89     89   ** Print the timing results.
    90     90   */
    91     91   static void endTimer(void){
    92     92     if( enableTimer ){
    93     93       struct rusage sEnd;
    94     94       getrusage(RUSAGE_SELF, &sEnd);
    95     95       printf("CPU Time: user %f sys %f\n",
    96         -       0.000001*timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
    97         -       0.000001*timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
           96  +       timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
           97  +       timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
    98     98     }
    99     99   }
   100    100   #define BEGIN_TIMER beginTimer()
   101    101   #define END_TIMER endTimer()
   102    102   #define HAS_TIMER 1
   103    103   #else
   104    104   #define BEGIN_TIMER