]> git.saurik.com Git - redis.git/commitdiff
Merge remote-tracking branch 'origin/2.6' into 2.6
authorantirez <antirez@gmail.com>
Mon, 19 Mar 2012 18:30:30 +0000 (19:30 +0100)
committerantirez <antirez@gmail.com>
Mon, 19 Mar 2012 18:30:30 +0000 (19:30 +0100)
src/memtest.c
src/redis.c

index 01569d059a54b55c131cb11b05ca55cf4e46d992..272ec502255527207afd27af952b222df5f10a24 100644 (file)
@@ -56,6 +56,33 @@ void memtest_progress_step(size_t curr, size_t size, char c) {
     fflush(stdout);
 }
 
+/* Test that addressing is fine. Every location is populated with its own
+ * address, and finally verified. This test is very fast but may detect
+ * ASAP big issues with the memory subsystem. */
+void memtest_addressing(unsigned long *l, size_t bytes) {
+    unsigned long words = bytes/sizeof(unsigned long);
+    unsigned long j, *p;
+
+    /* Fill */
+    p = l;
+    for (j = 0; j < words; j++) {
+        *p = (unsigned long)p;
+        p++;
+        if ((j & 0xffff) == 0) memtest_progress_step(j,words*2,'A');
+    }
+    /* Test */
+    p = l;
+    for (j = 0; j < words; j++) {
+        if (*p != (unsigned long)p) {
+            printf("\n*** MEMORY ADDRESSING ERROR: %p contains %lu\n",
+                (void*) p, *p);
+            exit(1);
+        }
+        p++;
+        if ((j & 0xffff) == 0) memtest_progress_step(j+words,words*2,'A');
+    }
+}
+
 /* Fill words stepping a single page at every write, so we continue to
  * touch all the pages in the smallest amount of time reducing the
  * effectiveness of caches, and making it hard for the OS to transfer
@@ -162,6 +189,11 @@ void memtest_test(size_t megabytes, int passes) {
     }
     while (pass != passes) {
         pass++;
+
+        memtest_progress_start("Addressing test",pass);
+        memtest_addressing(m,bytes);
+        memtest_progress_end();
+
         memtest_progress_start("Random fill",pass);
         memtest_fill_random(m,bytes);
         memtest_progress_end();
index eb19fbbf3018870492099672f6fcb0061f74d6f9..0b5d672bfd258389c510a2f0f5f7785ef8cf7715 100644 (file)
@@ -229,7 +229,7 @@ struct redisCommand redisCommandTable[] = {
     {"unsubscribe",unsubscribeCommand,-1,"rps",0,NULL,0,0,0,0,0},
     {"psubscribe",psubscribeCommand,-2,"rps",0,NULL,0,0,0,0,0},
     {"punsubscribe",punsubscribeCommand,-1,"rps",0,NULL,0,0,0,0,0},
-    {"publish",publishCommand,3,"rpf",0,NULL,0,0,0,0,0},
+    {"publish",publishCommand,3,"pf",0,NULL,0,0,0,0,0},
     {"watch",watchCommand,-2,"rs",0,noPreloadGetKeys,1,-1,1,0,0},
     {"unwatch",unwatchCommand,1,"rs",0,NULL,0,0,0,0,0},
     {"restore",restoreCommand,4,"awm",0,NULL,1,1,1,0,0},