WIP: basho_bench tests are running fine now, need more work to ensure cache is functioning properly.

This commit is contained in:
Gregory Burd 2013-06-05 11:41:41 -04:00
parent 778ba20352
commit 0fef28de92
5 changed files with 124 additions and 25 deletions

View file

@ -256,12 +256,14 @@ async_nif_enqueue_req(struct async_nif_state* async_nif, struct async_nif_req_en
enif_mutex_unlock(q->reqs_mutex); enif_mutex_unlock(q->reqs_mutex);
return 0; return 0;
} }
double await = STAT_MEAN_LOG2_SAMPLE(async_nif, qwait); if (fifo_q_size(reqs, q->reqs) > async_nif->num_queues) {
double await_inthisq = STAT_MEAN_LOG2_SAMPLE(q, qwait); double await = STAT_MEAN_LOG2_SAMPLE(async_nif, qwait);
if (fifo_q_full(reqs, q->reqs) || await_inthisq > await) { double await_inthisq = STAT_MEAN_LOG2_SAMPLE(q, qwait);
enif_mutex_unlock(q->reqs_mutex); if (fifo_q_full(reqs, q->reqs) || await_inthisq > await) {
qid = (qid + 1) % async_nif->num_queues; enif_mutex_unlock(q->reqs_mutex);
q = &async_nif->queues[qid]; qid = (qid + 1) % async_nif->num_queues;
q = &async_nif->queues[qid];
}
} else { } else {
break; break;
} }

View file

@ -45,12 +45,14 @@ static inline uint64_t cpu_clock_ticks()
{ {
uint32_t lo, hi; uint32_t lo, hi;
__asm__ __volatile__ ( __asm__ __volatile__ (
"xorl %%eax, %%eax\n" "; Flush the pipeline"
"cpuid\n" "XORL %%eax, %%eax\n"
"rdtsc\n" "CPUID\n"
: "=a" (lo), "=d" (hi) "; Get RDTSC counter in edx:eax"
: "RDTSC\n"
: "%ebx", "%ecx" ); : "=a" (lo), "=d" (hi)
:
: "%ebx", "%ecx" );
return (uint64_t)hi << 32 | lo; return (uint64_t)hi << 32 | lo;
} }

View file

@ -10,3 +10,97 @@ index 6d78823..2122cf8 100644
+libwiredtiger_snappy_la_CFLAGS = -I$(src_builddir)/../../system/include +libwiredtiger_snappy_la_CFLAGS = -I$(src_builddir)/../../system/include
+libwiredtiger_snappy_la_LDFLAGS = -avoid-version -module -L$(src_builddir)/../../system/lib -Wl,-rpath,lib/wterl-0.9.0/priv:lib/wterl/priv:priv +libwiredtiger_snappy_la_LDFLAGS = -avoid-version -module -L$(src_builddir)/../../system/lib -Wl,-rpath,lib/wterl-0.9.0/priv:lib/wterl/priv:priv
libwiredtiger_snappy_la_LIBADD = -lsnappy libwiredtiger_snappy_la_LIBADD = -lsnappy
diff --git a/src/support/cksum.c b/src/support/cksum.c
index 7e9befe..b924db7 100644
--- a/src/support/cksum.c
+++ b/src/support/cksum.c
@@ -27,6 +27,13 @@
#include "wt_internal.h"
+#if defined(__amd64) || defined(__x86_64)
+#define USE_HARDWARE_CRC32 1
+#else
+#undef USE_HARDWARE_CRC32
+#endif
+
+#ifdef USE_HARDWARE_CRC32
static const uint32_t g_crc_slicing[8][256] = {
#ifdef WORDS_BIGENDIAN
/*
@@ -1078,6 +1085,7 @@ static const uint32_t g_crc_slicing[8][256] = {
}
#endif
};
+#endif /* USE_HARDWARE_CRC32 */
/*
* __wt_cksum --
@@ -1106,15 +1114,29 @@ __wt_cksum(const void *chunk, size_t len)
/* Checksum one byte at a time to the first 4B boundary. */
for (p = chunk;
((uintptr_t)p & (sizeof(uint32_t) - 1)) != 0 &&
- len > 0; ++p, --len)
+ len > 0; ++p, --len) {
+#ifdef USE_HARDWARE_CRC32
+ __asm__ __volatile__(
+ ".byte 0xF2, 0x0F, 0x38, 0xF0, 0xF1"
+ : "=S" (crc)
+ : "0" (crc), "c" (*p));
+#else
#ifdef WORDS_BIGENDIAN
crc = g_crc_slicing[0][((crc >> 24) ^ *p) & 0xFF] ^ (crc << 8);
#else
crc = g_crc_slicing[0][(crc ^ *p) & 0xFF] ^ (crc >> 8);
#endif
+#endif
+ }
/* Checksum in 8B chunks. */
for (nqwords = len / sizeof(uint64_t); nqwords; nqwords--) {
+#ifdef USE_HARDWARE_CRC32
+ __asm__ __volatile__ (
+ ".byte 0xf2, 0x48, 0x0f, 0x38, 0xf0, 0xf1;"
+ : "=S"(crc)
+ : "S"(crc), "c"(*p));
+#else
crc ^= *(uint32_t *)p;
p += sizeof(uint32_t);
next = *(uint32_t *)p;
@@ -1139,22 +1161,32 @@ __wt_cksum(const void *chunk, size_t len)
g_crc_slicing[1][(next >> 16) & 0xFF] ^
g_crc_slicing[0][(next >> 24)];
#endif
+#endif
}
/* Checksum trailing bytes one byte at a time. */
+ for (len &= 0x7; len > 0; ++p, len--) {
+#ifdef USE_HARDWARE_CRC32
+ __asm__ __volatile__(
+ ".byte 0xF2, 0x0F, 0x38, 0xF0, 0xF1"
+ : "=S" (crc)
+ : "0" (crc), "c" (*p));
+#else
#ifdef WORDS_BIGENDIAN
- for (len &= 0x7; len > 0; ++p, len--)
crc = g_crc_slicing[0][((crc >> 24) ^ *p) & 0xFF] ^ (crc << 8);
+#else
+ crc = g_crc_slicing[0][(crc ^ *p) & 0xFF] ^ (crc >> 8);
+#endif
+#endif
+ }
+#ifdef WORDS_BIGENDIAN
/* Do final byte swap to produce a result identical to little endian */
crc =
((crc << 24) & 0xFF000000) |
((crc << 8) & 0x00FF0000) |
((crc >> 8) & 0x0000FF00) |
((crc >> 24) & 0x000000FF);
-#else
- for (len &= 0x7; len > 0; ++p, len--)
- crc = g_crc_slicing[0][(crc ^ *p) & 0xFF] ^ (crc >> 8);
#endif
return (~crc);
}

View file

@ -7,24 +7,24 @@
{eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}. {eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.
{erl_opts, [%{d,'DEBUG',true}, {erl_opts, [
debug_info, {parse_transform, lager_transform},
fail_on_warning, debug_info, %{d,'DEBUG',true},
warn_unused_vars, %strict_validation,
warn_export_all, %fail_on_warning,
warn_shadow_vars, warn_missing_spec,
warn_unused_import,
warn_unused_function,
warn_bif_clash, warn_bif_clash,
warn_unused_record,
warn_deprecated_function, warn_deprecated_function,
warn_obsolete_guard, warn_export_all,
warn_export_vars, warn_export_vars,
warn_exported_vars, warn_exported_vars,
warn_obsolete_guard,
warn_shadow_vars,
warn_untyped_record, warn_untyped_record,
{parse_transform, lager_transform} warn_unused_function,
%warn_missing_spec, warn_unused_import,
%strict_validation warn_unused_record,
warn_unused_vars
]}. ]}.
{xref_checks, [undefined_function_calls, deprecated_function_calls]}. {xref_checks, [undefined_function_calls, deprecated_function_calls]}.

View file

@ -455,6 +455,7 @@ config_to_bin([{Key, Value} | Rest], Acc) ->
[{block_compressor, {string, quoted}}, [{block_compressor, {string, quoted}},
{cache_size, string}, {cache_size, string},
{checkpoint, config}, {checkpoint, config},
{checksum, string},
{create, bool}, {create, bool},
{direct_io, list}, {direct_io, list},
{drop, list}, {drop, list},