3a559a3b3c
------------------------------------------------------------------------ r1601 | sears.russell@gmail.com | 2012-03-20 18:43:00 -0400 (Tue, 20 Mar 2012) | 1 line commit bLSM bloom filter to stasis/util, which is where it really belongs ------------------------------------------------------------------------ r1600 | sears.russell@gmail.com | 2012-03-04 01:58:38 -0500 (Sun, 04 Mar 2012) | 1 line fix memory leak in skiplist unit test (now it is valgrind clean) ------------------------------------------------------------------------ r1599 | sears.russell@gmail.com | 2012-03-04 01:58:05 -0500 (Sun, 04 Mar 2012) | 1 line fix typo in finalize type ------------------------------------------------------------------------ r1598 | sears.russell@gmail.com | 2012-03-04 00:59:59 -0500 (Sun, 04 Mar 2012) | 1 line add comparator and finalizer parameters to skiplist constructor ------------------------------------------------------------------------ r1597 | sears.russell@gmail.com | 2012-03-03 18:23:16 -0500 (Sat, 03 Mar 2012) | 1 line bugfixes for skiplist ------------------------------------------------------------------------ r1596 | sears.russell@gmail.com | 2012-03-02 15:05:07 -0500 (Fri, 02 Mar 2012) | 1 line updated concurrentSkipList. Seeing strange crashes ------------------------------------------------------------------------ r1595 | sears.russell@gmail.com | 2012-03-01 16:51:59 -0500 (Thu, 01 Mar 2012) | 1 line add progress reports ------------------------------------------------------------------------ r1594 | sears.russell@gmail.com | 2012-02-28 13:17:05 -0500 (Tue, 28 Feb 2012) | 1 line experimental support for automatic logfile preallocation ------------------------------------------------------------------------ r1593 | sears.russell@gmail.com | 2012-02-28 12:10:01 -0500 (Tue, 28 Feb 2012) | 1 line add histogram reporting to rawIOPS benchmark ------------------------------------------------------------------------ r1592 | sears.russell@gmail.com | 2012-02-24 16:31:36 -0500 (Fri, 24 Feb 2012) | 1 line userspace raid 0 implementation ------------------------------------------------------------------------ r1591 | sears.russell@gmail.com | 2012-02-12 01:47:25 -0500 (Sun, 12 Feb 2012) | 1 line add skiplist unit test, fix compile warnings ------------------------------------------------------------------------ r1590 | sears.russell@gmail.com | 2012-02-12 00:52:52 -0500 (Sun, 12 Feb 2012) | 1 line fix compile error ------------------------------------------------------------------------ r1589 | sears.russell@gmail.com | 2012-02-12 00:50:21 -0500 (Sun, 12 Feb 2012) | 1 line fix some bugs in hazard.h surrounding thread list management and overruns of R under high contention ------------------------------------------------------------------------ r1588 | sears.russell@gmail.com | 2012-02-11 14:23:10 -0500 (Sat, 11 Feb 2012) | 1 line add hazard pointer for get_lock. It was implicitly blowing away the hazard pointer protecting y in the caller ------------------------------------------------------------------------ r1587 | sears.russell@gmail.com | 2012-02-10 18:51:25 -0500 (Fri, 10 Feb 2012) | 1 line fix null pointer bug ------------------------------------------------------------------------ r1586 | sears.russell@gmail.com | 2012-02-10 18:03:39 -0500 (Fri, 10 Feb 2012) | 1 line add simple refcounting scheme to concurrentSkipList. This solves the problem where a deleted node points to another deleted node, and we only have a hazard pointer for the first node. ------------------------------------------------------------------------ r1585 | sears.russell@gmail.com | 2012-02-10 14:19:14 -0500 (Fri, 10 Feb 2012) | 1 line add hazard pointers for update using the smallest free slot first. The old method left a race condition, since hazard_scan stops at the first null pointer. ------------------------------------------------------------------------ r1584 | sears.russell@gmail.com | 2012-02-10 02:45:30 -0500 (Fri, 10 Feb 2012) | 1 line add hazard pointers for update array ------------------------------------------------------------------------ r1583 | sears.russell@gmail.com | 2012-02-10 00:04:50 -0500 (Fri, 10 Feb 2012) | 1 line skiplist update: concurrent, but broken ------------------------------------------------------------------------ r1582 | sears.russell@gmail.com | 2012-02-09 17:44:27 -0500 (Thu, 09 Feb 2012) | 1 line skip list implementation. Not concurrent yet. ------------------------------------------------------------------------ r1581 | sears.russell@gmail.com | 2012-02-08 13:33:29 -0500 (Wed, 08 Feb 2012) | 1 line Commit of a bunch of new, unused code: KISS random number generator, Hazard Pointers, SUX latches (untested) and bit twiddling for concurrent b-tree ------------------------------------------------------------------------ r1580 | sears.russell@gmail.com | 2012-01-17 19:17:37 -0500 (Tue, 17 Jan 2012) | 1 line fix typo ------------------------------------------------------------------------ r1579 | sears.russell@gmail.com | 2012-01-11 18:33:31 -0500 (Wed, 11 Jan 2012) | 1 line static build fixes for linux. hopefully these do not break macos... ------------------------------------------------------------------------ r1578 | sears.russell@gmail.com | 2012-01-09 19:13:34 -0500 (Mon, 09 Jan 2012) | 1 line fix cmake under linux ------------------------------------------------------------------------ r1577 | sears.russell@gmail.com | 2012-01-09 18:37:15 -0500 (Mon, 09 Jan 2012) | 1 line fix linux static binary compilation bugs ------------------------------------------------------------------------ r1576 | sears.russell | 2012-01-09 18:00:08 -0500 (Mon, 09 Jan 2012) | 1 line port to macos x ------------------------------------------------------------------------ r1575 | sears.russell | 2012-01-09 17:39:43 -0500 (Mon, 09 Jan 2012) | 1 line add missing _ from sync call name ------------------------------------------------------------------------ r1574 | sears.russell@gmail.com | 2012-01-09 14:26:31 -0500 (Mon, 09 Jan 2012) | 1 line add -rt flag to static builds ------------------------------------------------------------------------ r1573 | sears.russell@gmail.com | 2011-12-20 23:38:29 -0500 (Tue, 20 Dec 2011) | 1 line Simple makefile geared toward building libstasis.so and libstasis.a (and nothing else) ------------------------------------------------------------------------ r1572 | sears.russell@gmail.com | 2011-12-20 22:37:54 -0500 (Tue, 20 Dec 2011) | 1 line add some missing #include<config.h> lines
181 lines
5.3 KiB
C
181 lines
5.3 KiB
C
#include <config.h>
|
|
#include <stasis/transactional.h>
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
|
|
|
|
#include <stasis/bufferManager.h>
|
|
#include <stasis/bufferManager/legacy/legacyBufferManager.h>
|
|
#include <stasis/bufferManager/legacy/pageFile.h>
|
|
#include <stasis/bufferManager/bufferHash.h>
|
|
#include <stasis/bufferManager/concurrentBufferManager.h>
|
|
#include <stasis/truncation.h>
|
|
#include <stasis/logger/logger2.h>
|
|
|
|
#include <stasis/util/time.h>
|
|
#include <stasis/flags.h>
|
|
|
|
/*static stasis_handle_t * memory_factory(lsn_t off, lsn_t len, void * ignored) {
|
|
stasis_handle_t * h = stasis_handle(open_memory)(off);
|
|
//h = stasis_handle(open_debug)(h);
|
|
stasis_write_buffer_t * w = h->append_buffer(h, len);
|
|
w->h->release_write_buffer(w);
|
|
return h;
|
|
}
|
|
typedef struct sf_args {
|
|
char * filename;
|
|
int openMode;
|
|
int filePerm;
|
|
} sf_args;
|
|
static stasis_handle_t * traditional_file_factory(void * argsP) {
|
|
sf_args * args = (sf_args*) argsP;
|
|
stasis_handle_t * h = stasis_handle(open_file)(0, args->filename, args->openMode, args->filePerm);
|
|
//h = stasis_handle(open_debug)(h);
|
|
return h;
|
|
}
|
|
*/
|
|
|
|
static inline long mb_to_page(long mb) {
|
|
return (mb * 1024 * 1024) / PAGE_SIZE;
|
|
}
|
|
static inline long page_to_mb(long page) {
|
|
return (page * PAGE_SIZE) / (1024 * 1024);
|
|
}
|
|
const char * usage = "./sequentialThroughput [--direct] [--mb mb] [--stake mb]\n [--deprecatedBM|--deprecatedFH|--log_safe_writes|--log_memory|--log_file_pool|--nb|--file|--pfile|--nb_pfile|--nb_file] [--read]\n";
|
|
|
|
int main(int argc, char ** argv) {
|
|
int direct = 0;
|
|
int legacyBM = 0;
|
|
int legacyFH = 0;
|
|
int stake = 0;
|
|
int log_mode = 0;
|
|
int read_mode = 0;
|
|
long page_count = mb_to_page(100);
|
|
for(int i = 1; i < argc; i++) {
|
|
if(!strcmp(argv[i], "--direct")) {
|
|
direct = 1;
|
|
#ifdef HAVE_O_DIRECT
|
|
stasis_buffer_manager_io_handle_flags |= O_DIRECT;
|
|
#else
|
|
printf("O_DIRECT not supported by this build.");
|
|
return -1;
|
|
#endif
|
|
} else if(!strcmp(argv[i], "--log_safe_writes")) {
|
|
stasis_log_type = LOG_TO_FILE;
|
|
log_mode = 1;
|
|
} else if(!strcmp(argv[i], "--log_memory")) {
|
|
stasis_log_type = LOG_TO_MEMORY;
|
|
log_mode = 1;
|
|
} else if(!strcmp(argv[i], "--log_file_pool")) {
|
|
stasis_log_type = LOG_TO_DIR;
|
|
log_mode = 1;
|
|
} else if(!strcmp(argv[i], "--deprecatedBM")) {
|
|
stasis_buffer_manager_factory = stasis_buffer_manager_deprecated_factory;
|
|
legacyBM = 1;
|
|
} else if(!strcmp(argv[i], "--deprecatedFH")) {
|
|
stasis_page_handle_factory = stasis_page_handle_deprecated_factory;
|
|
legacyFH = 1;
|
|
} else if(!strcmp(argv[i], "--nb")) {
|
|
printf("XXX unsupported at the moment!\n");
|
|
legacyBM = 0;
|
|
legacyFH = 0;
|
|
} else if(!strcmp(argv[i], "--file")) {
|
|
stasis_handle_file_factory = stasis_handle_open_file;
|
|
legacyBM = 0;
|
|
legacyFH = 0;
|
|
} else if(!strcmp(argv[i], "--pfile")) {
|
|
stasis_handle_file_factory = stasis_handle_open_pfile;
|
|
legacyBM = 0;
|
|
legacyFH = 0;
|
|
} else if(!strcmp(argv[i], "--nb_pfile")) {
|
|
stasis_non_blocking_handle_file_factory = stasis_handle_open_pfile;
|
|
} else if(!strcmp(argv[i], "--nb_file")) {
|
|
stasis_non_blocking_handle_file_factory = stasis_handle_open_file;
|
|
} else if(!strcmp(argv[i], "--mb")) {
|
|
i++;
|
|
page_count = mb_to_page(atoll(argv[i]));
|
|
} else if(!strcmp(argv[i], "--stake")) {
|
|
i++;
|
|
stake = mb_to_page(atoll(argv[i]));
|
|
} else if(!strcmp(argv[i], "--read")) {
|
|
read_mode = 1;
|
|
} else if(!strcmp(argv[i], "--hint-sequential-writes")) {
|
|
stasis_buffer_manager_hint_writes_are_sequential = 1;
|
|
stasis_replacement_policy_concurrent_wrapper_exponential_backoff = 1;
|
|
} else {
|
|
printf("Unknown argument: %s\nUsage: %s\n", argv[i], usage);
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
if(legacyFH && direct) {
|
|
printf("--direct and --deprecatedFH are incompatible with each other\n");
|
|
return 1;
|
|
}
|
|
|
|
struct timeval start;
|
|
|
|
gettimeofday(&start,0);
|
|
|
|
Tinit();
|
|
|
|
if(read_mode) {
|
|
if(log_mode) {
|
|
printf("read mode for the log is unimplemented\n");
|
|
abort();
|
|
} else {
|
|
for(long i = 0; i < page_count; i++) {
|
|
Page * p = loadPage(-1, i);
|
|
releasePage(p);
|
|
}
|
|
}
|
|
} else {
|
|
if(log_mode) {
|
|
lsn_t prevLSN = -1;
|
|
byte * arg = calloc(PAGE_SIZE, 1);
|
|
stasis_log_t * l = stasis_log();
|
|
|
|
for(long i = 0; i < page_count; i++) {
|
|
LogEntry * e = allocUpdateLogEntry(l, prevLSN, -1, OPERATION_NOOP,
|
|
0, PAGE_SIZE);
|
|
l->write_entry(l, e);
|
|
l->write_entry_done(l, e);
|
|
}
|
|
free(arg);
|
|
} else {
|
|
if(stake) {
|
|
Page * p = loadPage(-1, stake);
|
|
writelock(p->rwlatch,0);
|
|
stasis_dirty_page_table_set_dirty(stasis_runtime_dirty_page_table(), p);
|
|
unlock(p->rwlatch);
|
|
releasePage(p);
|
|
}
|
|
|
|
for(long i =0; i < page_count; i++) {
|
|
Page * p = loadUninitializedPage(-1, i);
|
|
stasis_dirty_page_table_set_dirty(stasis_runtime_dirty_page_table(), p);
|
|
releasePage(p);
|
|
}
|
|
}
|
|
}
|
|
Tdeinit();
|
|
|
|
struct timeval stop;
|
|
gettimeofday(&stop, 0);
|
|
|
|
double elapsed = stasis_timeval_to_double(
|
|
stasis_subtract_timeval(stop,start));
|
|
|
|
printf("Elasped = %f seconds, %s %ld mb, throughput %f MB/sec\n",
|
|
elapsed,
|
|
read_mode ? "read": "wrote",
|
|
page_to_mb(page_count),
|
|
((double)page_to_mb(page_count)) / elapsed);
|
|
return 0;
|
|
}
|