]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Tighter description of I/O stats in the shell. Show I/O stats on speedtest1.c.
authordrh <drh@noemail.net>
Sat, 27 Feb 2016 19:19:22 +0000 (19:19 +0000)
committerdrh <drh@noemail.net>
Sat, 27 Feb 2016 19:19:22 +0000 (19:19 +0000)
FossilOrigin-Name: f681d800340e0e710f73d0f7c09101f899249183

manifest
manifest.uuid
src/shell.c
test/speedtest1.c

index 435c15b0a492b0e0b23791d348e9c11cbba9340d..706e06deb01d24a3952c3b837bf67678d2c695f9 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Enhance\sthe\s".stats"\scommand\sin\ssqlite3.exe\sto\sshow\sone-time\sstats\sinformation\nif\sinvoked\swith\sone\sargument.\s\sAlso\sshow\s/proc/PID/io\sinformation\sif\srun\son\nLinux.
-D 2016-02-27T17:12:36.918
+C Tighter\sdescription\sof\sI/O\sstats\sin\sthe\sshell.\s\sShow\sI/O\sstats\son\sspeedtest1.c.
+D 2016-02-27T19:19:22.849
 F Makefile.in 4e90dc1521879022aa9479268a4cd141d1771142
 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434
 F Makefile.msc 4f319afb7c049d40aff7af6e8c4e7cc2ba18e079
@@ -350,7 +350,7 @@ F src/random.c ba2679f80ec82c4190062d756f22d0c358180696
 F src/resolve.c b8f7174e5f8c33c44ded3a25a973d0bb89228c20
 F src/rowset.c 9fe4b3ad7cc00944386bb600233d8f523de07a6e
 F src/select.c 1bacfde7b7cec134d2b354cbcf67bafc67078431
-F src/shell.c f30efdd675007ec6006d51193fc47aabda2984a5
+F src/shell.c 5e0ab1e708dc294330ccd8230536e1801f60822e
 F src/sqlite.h.in 57d2a02b14c9ec4f7cb294153eaf62294dc5aa68
 F src/sqlite3.rc 5121c9e10c3964d5755191c80dd1180c122fc3a8
 F src/sqlite3ext.h dfbe62ffd95b99afe2140d8c35b180d11924072d
@@ -1052,7 +1052,7 @@ F test/speed3.test d32043614c08c53eafdc80f33191d5bd9b920523
 F test/speed4.test abc0ad3399dcf9703abed2fff8705e4f8e416715
 F test/speed4p.explain 6b5f104ebeb34a038b2f714150f51d01143e59aa
 F test/speed4p.test 0e51908951677de5a969b723e03a27a1c45db38b
-F test/speedtest1.c 947421c324f5cd4cb3dcae1ec214e4be763df718
+F test/speedtest1.c 1478cb3fb64ad30f291ddca87ca9dbd72ff552aa
 F test/spellfix.test f9c1f431e2c096c8775fec032952320c0e4700db
 F test/spellfix2.test dfc8f519a3fc204cb2dfa8b4f29821ae90f6f8c3
 F test/spellfix3.test f7bf7b3482971473d32b6b00f6944c5c066cff97
@@ -1451,7 +1451,7 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
 F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
 F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
-P d1392c627934b89cdb86d82e73d56e8f76952b30
-R cc008a8c941c26feeb254cac8325586b
+P 3c36948f16b58fe8042c37d0df634308b4e48217
+R 2b473c8c6b36608ca875feba0d8cbb83
 U drh
-Z 0f34ce71f4553990685c1f98cc5c169c
+Z 565e8454d2408a569a86791d9e6b12a6
index 31a87c65161d473753a64c2b29d916697b275ce7..546a6418d6019a31a1ef8e104050bb60a42f2f04 100644 (file)
@@ -1 +1 @@
-3c36948f16b58fe8042c37d0df634308b4e48217
\ No newline at end of file
+f681d800340e0e710f73d0f7c09101f899249183
\ No newline at end of file
index 303fd008ad2bfe79450a6d6eb6e9c4e7d25fe486..789a464d09125038ee0fdd12ebeeff1273e3263c 100644 (file)
@@ -1299,13 +1299,13 @@ static void displayLinuxIoStats(FILE *out){
       const char *zPattern;
       const char *zDesc;
     } aTrans[] = {
-      { "rchar: ",                  "Number of bytes received by read():" },
-      { "wchar: ",                  "Number of bytes sent to write():"    },
-      { "syscr: ",                  "Number of read() system calls:"      },
-      { "syscw: ",                  "Number of write() system calls:"     },
-      { "read_bytes: ",             "Number of bytes from storage:"       },
-      { "write_bytes: ",            "Number of bytes sent to storage:"    },
-      { "cancelled_write_bytes: ",  "Cancelled write bytes:"              },
+      { "rchar: ",                  "Bytes received by read():" },
+      { "wchar: ",                  "Bytes sent to write():"    },
+      { "syscr: ",                  "Read() system calls:"      },
+      { "syscw: ",                  "Write() system calls:"     },
+      { "read_bytes: ",             "Bytes read from storage:"  },
+      { "write_bytes: ",            "Bytes written to storage:" },
+      { "cancelled_write_bytes: ",  "Cancelled write bytes:"    },
     };
     int i;
     for(i=0; i<ArraySize(aTrans); i++){
index afb446bbf10891902496053ab276b49983eec4bc..d7f2af47b8ad46ae2a728f8d747a62664bc2251b 100644 (file)
@@ -1167,6 +1167,45 @@ void testset_debug1(void){
   }
 }
 
+#ifdef __linux__
+#include <sys/types.h>
+#include <unistd.h>
+
+/*
+** Attempt to display I/O stats on Linux using /proc/PID/io
+*/
+static void displayLinuxIoStats(FILE *out){
+  FILE *in;
+  char z[200];
+  sqlite3_snprintf(sizeof(z), z, "/proc/%d/io", getpid());
+  in = fopen(z, "rb");
+  if( in==0 ) return;
+  while( fgets(z, sizeof(z), in)!=0 ){
+    static const struct {
+      const char *zPattern;
+      const char *zDesc;
+    } aTrans[] = {
+      { "rchar: ",                  "Bytes received by read():" },
+      { "wchar: ",                  "Bytes sent to write():"    },
+      { "syscr: ",                  "Read() system calls:"      },
+      { "syscw: ",                  "Write() system calls:"     },
+      { "read_bytes: ",             "Bytes rcvd from storage:"  },
+      { "write_bytes: ",            "Bytes sent to storage:"    },
+      { "cancelled_write_bytes: ",  "Cancelled write bytes:"    },
+    };
+    int i;
+    for(i=0; i<sizeof(aTrans)/sizeof(aTrans[0]); i++){
+      int n = (int)strlen(aTrans[i].zPattern);
+      if( strncmp(aTrans[i].zPattern, z, n)==0 ){
+        fprintf(out, "-- %-28s %s", aTrans[i].zDesc, &z[n]);
+        break;
+      }
+    }
+  }
+  fclose(in);
+}   
+#endif
+
 int main(int argc, char **argv){
   int doAutovac = 0;            /* True for --autovacuum */
   int cacheSize = 0;            /* Desired cache size.  0 means default */
@@ -1460,6 +1499,12 @@ int main(int argc, char **argv){
   }
 #endif
 
+#ifdef __linux__
+  if( showStats ){
+    displayLinuxIoStats(stdout);
+  }
+#endif
+
   /* Release memory */
   free( pLook );
   free( pPCache );