more benchmarks, add support for in memory log to the smallLogEntry benchmark

This commit is contained in:
Sears Russell 2009-10-13 01:50:35 +00:00
parent 20ef74b104
commit fbdc0f0499
4 changed files with 124 additions and 3 deletions

View file

@ -1,3 +1,5 @@
CREATE_EXECUTABLE(dirtyPages)
CREATE_EXECUTABLE(dirtyPage)
CREATE_EXECUTABLE(smallLogEntry)
CREATE_EXECUTABLE(noopTransactions)
CREATE_EXECUTABLE(pinSamePage)

View file

@ -0,0 +1,55 @@
/*
* dirtyPage.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/transactional.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
stasis_dirty_page_table_t * dpt;
unsigned long numops;
unsigned long numthreads;
Page ** p;
static void* worker(void* arg) {
Page * p = arg;
for(unsigned long i = 0; i < numops; i++) {
stasis_dirty_page_table_set_dirty(dpt, p);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
Page * p;
Tinit();
dpt = stasis_runtime_dirty_page_table();
p = loadPage(-1,0);
for(int i = 0; i < numthreads; i++) {
pthread_create(&workers[i], 0, worker, p);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
releasePage(p);
Tdeinit();
}

View file

@ -0,0 +1,61 @@
/*
* dirtyPages.c
*
* Created on: Oct 12, 2009
* Author: sears
*/
#include <stasis/transactional.h>
#include <pthread.h>
#include <stdio.h>
char * usage = "%s numthreads numops\n";
stasis_dirty_page_table_t * dpt;
unsigned long numops;
unsigned long numthreads;
Page ** p;
static void* worker(void* arg) {
Page * p = arg;
for(unsigned long i = 0; i < numops; i++) {
stasis_dirty_page_table_set_dirty(dpt, p);
}
return 0;
}
int main(int argc, char * argv[]) {
if(argc != 3) { printf(usage, argv[0]); abort(); }
char * endptr;
numthreads = strtoul(argv[1], &endptr, 10);
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
numops= strtoul(argv[2], &endptr, 10) / numthreads;
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
p = malloc(sizeof(Page *) * numthreads);
Tinit();
dpt = stasis_runtime_dirty_page_table();
for(int i = 0; i < numthreads; i++) {
p[i] = loadPage(-1, i);
}
for(int i = 0; i < numthreads; i++) {
pthread_create(&workers[i], 0, worker, p[i]);
}
for(int i = 0; i < numthreads; i++) {
pthread_join(workers[i], 0);
}
for(int i = 0; i < numthreads; i++) {
releasePage(p[i]);
}
Tdeinit();
}

View file

@ -7,6 +7,7 @@
#include <stasis/logger/logger2.h>
#include <stasis/logger/safeWrites.h>
#include <stasis/logger/inMemoryLog.h>
#include <stasis/flags.h>
#include <pthread.h>
@ -43,9 +44,11 @@ int main(int argc, char * argv[]) {
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
pthread_t workers[numthreads];
l = stasis_log_safe_writes_open(stasis_log_file_name, stasis_log_file_mode, stasis_log_file_permissions, 0);
if(stasis_log_type == LOG_TO_FILE) {
l = stasis_log_safe_writes_open(stasis_log_file_name, stasis_log_file_mode, stasis_log_file_permissions, 0);
} else {
l = stasis_log_impl_in_memory_open();
}
for(int i = 0; i < numthreads; i++) {
pthread_create(&workers[i], 0, worker, &numops);
}