add a few simple multicore scalability tests
This commit is contained in:
parent
0e93a577c9
commit
0f2ab3c37c
11 changed files with 401 additions and 0 deletions
|
@ -1,3 +1,5 @@
|
|||
SUBDIRS(multicore)
|
||||
|
||||
IF(HAVE_GETLINE)
|
||||
ADD_EXECUTABLE(rose rose.cpp)
|
||||
TARGET_LINK_LIBRARIES(rose ${COMMON_LIBRARIES})
|
||||
|
@ -31,6 +33,7 @@ CREATE_EXECUTABLE(sequentialThroughput)
|
|||
CREATE_EXECUTABLE(qos)
|
||||
CREATE_EXECUTABLE(writeBack)
|
||||
CREATE_EXECUTABLE(distributedLsnFree)
|
||||
|
||||
IF(CHECK_LIBRARY)
|
||||
ADD_TEST(rose rose)
|
||||
ENDIF(CHECK_LIBRARY)
|
||||
|
|
8
benchmarks/multicore/CMakeLists.txt
Normal file
8
benchmarks/multicore/CMakeLists.txt
Normal file
|
@ -0,0 +1,8 @@
|
|||
CREATE_EXECUTABLE(smallLogEntry)
|
||||
CREATE_EXECUTABLE(noopTransactions)
|
||||
CREATE_EXECUTABLE(pinSamePage)
|
||||
CREATE_EXECUTABLE(pinDifferentPages)
|
||||
CREATE_EXECUTABLE(readLatch)
|
||||
CREATE_EXECUTABLE(readLatches)
|
||||
CREATE_EXECUTABLE(writeLatch)
|
||||
CREATE_EXECUTABLE(writeLatches)
|
22
benchmarks/multicore/make-scripts.pl
Executable file
22
benchmarks/multicore/make-scripts.pl
Executable file
|
@ -0,0 +1,22 @@
|
|||
#!/usr/bin/perl -w
|
||||
|
||||
use strict;
|
||||
|
||||
my @in = `cd $ARGV[0]; ls *.c`;
|
||||
my $out = $ARGV[1];
|
||||
my $N = $ARGV[2];
|
||||
|
||||
chomp $out;
|
||||
|
||||
foreach my $line (@in) {
|
||||
chomp $line;
|
||||
$line =~ s/\..+//g;
|
||||
|
||||
open OUT, "> $out/$line.script";
|
||||
print OUT "#!/usr/bin/env timer.pl\n";
|
||||
for my $i (qw(1 2 4 8 16)) {
|
||||
print OUT "./$line $i $N\n";
|
||||
`chmod +x $out/$line.script`;
|
||||
}
|
||||
close OUT;
|
||||
}
|
43
benchmarks/multicore/noopTransactions.c
Normal file
43
benchmarks/multicore/noopTransactions.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
/*
|
||||
* noopTransactions.c
|
||||
*
|
||||
* Created on: Oct 12, 2009
|
||||
* Author: sears
|
||||
*/
|
||||
|
||||
#include <stasis/transactional.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char * usage = "%s numthreads numops\n";
|
||||
|
||||
static void* noopWorker(void* arg) {
|
||||
unsigned long numops = *(unsigned long*) arg;
|
||||
for(unsigned long i = 0; i < numops; i++) {
|
||||
int xid = Tbegin();
|
||||
TsoftCommit(xid);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
if(argc != 3) { printf(usage, argv[0]); abort(); }
|
||||
char * endptr;
|
||||
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
|
||||
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
|
||||
unsigned long numops= strtoul(argv[2], &endptr, 10) / numthreads;
|
||||
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
|
||||
|
||||
pthread_t workers[numthreads];
|
||||
|
||||
Tinit();
|
||||
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_create(&workers[i], 0, noopWorker, &numops);
|
||||
}
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_join(workers[i], 0);
|
||||
}
|
||||
|
||||
Tdeinit();
|
||||
}
|
51
benchmarks/multicore/pinDifferentPages.c
Normal file
51
benchmarks/multicore/pinDifferentPages.c
Normal file
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
* pinDifferentPages.c
|
||||
*
|
||||
* Created on: Oct 12, 2009
|
||||
* Author: sears
|
||||
*/
|
||||
|
||||
#include <stasis/transactional.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
char * usage = "%s numthreads numops\n";
|
||||
|
||||
unsigned long numops;
|
||||
|
||||
static void* worker(void* arg) {
|
||||
pageid_t pid = *(pageid_t*)arg;
|
||||
for(unsigned long i = 0; i < numops; i++) {
|
||||
Page * p = loadPage(-1, pid);
|
||||
releasePage(p);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
if(argc != 3) { printf(usage, argv[0]); abort(); }
|
||||
char * endptr;
|
||||
unsigned long 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];
|
||||
pageid_t pids[numthreads];
|
||||
|
||||
Tinit();
|
||||
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pids[i] = i;
|
||||
pthread_create(&workers[i], 0, worker, &pids[i]);
|
||||
}
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_join(workers[i], 0);
|
||||
}
|
||||
|
||||
Tdeinit();
|
||||
|
||||
}
|
49
benchmarks/multicore/pinSamePage.c
Normal file
49
benchmarks/multicore/pinSamePage.c
Normal file
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* pinSamePage.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_log_t * l;
|
||||
|
||||
static void* worker(void* arg) {
|
||||
unsigned long numops = *(unsigned long*) arg;
|
||||
|
||||
for(unsigned long i = 0; i < numops; i++) {
|
||||
Page * p = loadPage(-1, 0);
|
||||
releasePage(p);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
if(argc != 3) { printf(usage, argv[0]); abort(); }
|
||||
char * endptr;
|
||||
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
|
||||
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
|
||||
unsigned long numops= strtoul(argv[2], &endptr, 10) / numthreads;
|
||||
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
|
||||
|
||||
pthread_t workers[numthreads];
|
||||
|
||||
Tinit();
|
||||
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_create(&workers[i], 0, worker, &numops);
|
||||
}
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_join(workers[i], 0);
|
||||
}
|
||||
|
||||
Tdeinit();
|
||||
|
||||
}
|
38
benchmarks/multicore/readLatch.c
Normal file
38
benchmarks/multicore/readLatch.c
Normal file
|
@ -0,0 +1,38 @@
|
|||
#include <stasis/rw.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char * usage = "%s numthreads numops\n";
|
||||
|
||||
rwl * l;
|
||||
|
||||
static void* worker(void* arg) {
|
||||
unsigned long numops = *(unsigned long*) arg;
|
||||
|
||||
for(unsigned long i = 0; i < numops; i++) {
|
||||
readlock(l, 0);
|
||||
unlock(l);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
if(argc != 3) { printf(usage, argv[0]); abort(); }
|
||||
char * endptr;
|
||||
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
|
||||
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
|
||||
unsigned long numops= strtoul(argv[2], &endptr, 10) / numthreads;
|
||||
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
|
||||
|
||||
pthread_t workers[numthreads];
|
||||
|
||||
l = initlock();
|
||||
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_create(&workers[i], 0, worker, &numops);
|
||||
}
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_join(workers[i], 0);
|
||||
}
|
||||
}
|
44
benchmarks/multicore/readLatches.c
Normal file
44
benchmarks/multicore/readLatches.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* uncontestedReadLatches.c
|
||||
*
|
||||
* Created on: Oct 12, 2009
|
||||
* Author: sears
|
||||
*/
|
||||
#include <stasis/rw.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char * usage = "%s numthreads numops\n";
|
||||
|
||||
unsigned long numops;
|
||||
|
||||
static void* worker(void* arg) {
|
||||
rwl * l = arg;
|
||||
|
||||
for(unsigned long i = 0; i < numops; i++) {
|
||||
readlock(l, 0);
|
||||
unlock(l);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
if(argc != 3) { printf(usage, argv[0]); abort(); }
|
||||
char * endptr;
|
||||
unsigned long 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];
|
||||
rwl * l[numthreads];
|
||||
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
l[i] = initlock();
|
||||
pthread_create(&workers[i], 0, worker, l[i]);
|
||||
}
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_join(workers[i], 0);
|
||||
}
|
||||
}
|
55
benchmarks/multicore/smallLogEntry.c
Normal file
55
benchmarks/multicore/smallLogEntry.c
Normal file
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* smallLogEntry.c
|
||||
*
|
||||
* Created on: Oct 12, 2009
|
||||
* Author: sears
|
||||
*/
|
||||
|
||||
#include <stasis/logger/logger2.h>
|
||||
#include <stasis/logger/safeWrites.h>
|
||||
#include <stasis/flags.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
|
||||
char * usage = "%s numthreads numops\n";
|
||||
|
||||
stasis_log_t * l;
|
||||
|
||||
static void* worker(void* arg) {
|
||||
unsigned long numops = *(unsigned long*) arg;
|
||||
LogEntry e;
|
||||
e.LSN = 0;
|
||||
e.prevLSN = 0;
|
||||
e.type = UPDATELOG;
|
||||
e.xid = 0;
|
||||
e.update.arg_size = 0;
|
||||
e.update.funcID = 0;
|
||||
e.update.page = INVALID_PAGE;
|
||||
|
||||
for(unsigned long i = 0; i < numops; i++) {
|
||||
l->write_entry(l, &e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
if(argc != 3) { printf(usage, argv[0]); abort(); }
|
||||
char * endptr;
|
||||
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
|
||||
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
|
||||
unsigned long numops= strtoul(argv[2], &endptr, 10) / numthreads;
|
||||
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);
|
||||
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_create(&workers[i], 0, worker, &numops);
|
||||
}
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_join(workers[i], 0);
|
||||
}
|
||||
}
|
44
benchmarks/multicore/writeLatch.c
Normal file
44
benchmarks/multicore/writeLatch.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* writeLatch.c
|
||||
*
|
||||
* Created on: Oct 12, 2009
|
||||
* Author: sears
|
||||
*/
|
||||
#include <stasis/rw.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char * usage = "%s numthreads numops\n";
|
||||
|
||||
rwl * l;
|
||||
|
||||
static void* worker(void* arg) {
|
||||
unsigned long numops = *(unsigned long*) arg;
|
||||
|
||||
for(unsigned long i = 0; i < numops; i++) {
|
||||
writelock(l, 0);
|
||||
unlock(l);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
if(argc != 3) { printf(usage, argv[0]); abort(); }
|
||||
char * endptr;
|
||||
unsigned long numthreads = strtoul(argv[1], &endptr, 10);
|
||||
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
|
||||
unsigned long numops= strtoul(argv[2], &endptr, 10) / numthreads;
|
||||
if(*endptr != 0) { printf(usage, argv[0]); abort(); }
|
||||
|
||||
pthread_t workers[numthreads];
|
||||
|
||||
l = initlock();
|
||||
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_create(&workers[i], 0, worker, &numops);
|
||||
}
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_join(workers[i], 0);
|
||||
}
|
||||
}
|
44
benchmarks/multicore/writeLatches.c
Normal file
44
benchmarks/multicore/writeLatches.c
Normal file
|
@ -0,0 +1,44 @@
|
|||
/*
|
||||
* writeLatches.c
|
||||
*
|
||||
* Created on: Oct 12, 2009
|
||||
* Author: sears
|
||||
*/
|
||||
#include <stasis/rw.h>
|
||||
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
|
||||
char * usage = "%s numthreads numops\n";
|
||||
|
||||
unsigned long numops;
|
||||
|
||||
static void* worker(void* arg) {
|
||||
rwl * l = arg;
|
||||
|
||||
for(unsigned long i = 0; i < numops; i++) {
|
||||
writelock(l, 0);
|
||||
unlock(l);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char * argv[]) {
|
||||
if(argc != 3) { printf(usage, argv[0]); abort(); }
|
||||
char * endptr;
|
||||
unsigned long 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];
|
||||
rwl * l[numthreads];
|
||||
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
l[i] = initlock();
|
||||
pthread_create(&workers[i], 0, worker, l[i]);
|
||||
}
|
||||
for(int i = 0; i < numthreads; i++) {
|
||||
pthread_join(workers[i], 0);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue