diff --git a/runtime/include/runtime.h b/runtime/include/runtime.h index 1610c00..9161de8 100644 --- a/runtime/include/runtime.h +++ b/runtime/include/runtime.h @@ -53,7 +53,7 @@ runtime_uvio(void) { return &uvio; } static unsigned long long int -rdtsc() +rdtsc(void) { unsigned long long int ret = 0; unsigned int cycles_lo; diff --git a/runtime/include/types.h b/runtime/include/types.h index 95a4566..8fdbd61 100644 --- a/runtime/include/types.h +++ b/runtime/include/types.h @@ -122,7 +122,7 @@ typedef enum { #define SBOX_PREOPEN_MAGIC (707707707) // reads lol lol lol upside down #define SOFTINT_TIMER_START_USEC (10*1000) //start timers 10 ms from now. -#define SOFTINT_TIMER_PERIOD_USEC (1000*100) // 100ms timer.. +#define SOFTINT_TIMER_PERIOD_USEC (1000*5) // 100ms timer.. #ifdef DEBUG #ifdef NOSTDIO @@ -148,7 +148,7 @@ typedef enum { #define SBOX_RESP_STRSZ 32 -#define MOD_BACKLOG 10000 +#define MOD_BACKLOG 1000 #define EPOLL_MAX 1024 #define MOD_REQ_RESP_DEFAULT (PAGE_SIZE) #define QUIESCENSE_TIME (1<<20) //cycles! diff --git a/runtime/src/env.c b/runtime/src/env.c index 0dd3d03..905b7d5 100644 --- a/runtime/src/env.c +++ b/runtime/src/env.c @@ -191,3 +191,9 @@ env_cos(double d) { return cos(d); } + +INLINE unsigned long long +env_rdtsc(void) +{ + return rdtsc(); +} diff --git a/runtime/tests/Makefile b/runtime/tests/Makefile index 6f15fbb..7bc4fd7 100644 --- a/runtime/tests/Makefile +++ b/runtime/tests/Makefile @@ -2,7 +2,7 @@ include Makefile.inc BENCH_DIR=../../silverfish/code_benches/ -TESTS=empty +TESTS=empty work #TESTS=forever filesys sockserver sockclient empty TESTSRT=$(TESTS:%=%_rt) BENCHES=adpcm basic_math binarytrees bitcount blowfish crc dijkstra fft function_pointers \ diff --git a/runtime/tests/empty/main.c b/runtime/tests/empty/main.c index 1f0f0db..e86ee47 100644 --- a/runtime/tests/empty/main.c +++ b/runtime/tests/empty/main.c @@ -2,15 +2,10 @@ #include #include -#define MAX_BUF (1024*1024) //1m - int main(int argc, char **argv) { - char *d = malloc(MAX_BUF + 1); - int r = read(0, d, MAX_BUF); - if (r <= 0) printf("%s\n", r == 0 ? "empty" : "error"); - else write(1, d, MAX_BUF); + printf("S\n"); return 0; } diff --git a/runtime/tests/test_armcifar10.json b/runtime/tests/test_armcifar10.json new file mode 100644 index 0000000..5ef8e52 --- /dev/null +++ b/runtime/tests/test_armcifar10.json @@ -0,0 +1,13 @@ +{ + "active" : "yes", + "name" : "cifar10", + "path" : "cifar10_wasm.so", + "port" : 10000, + "argsize" : 1, + "http-req-headers" : [ ], + "http-req-content-type" : "image/png", + "http-req-size": 4096, + "http-resp-headers" : [ ], + "http-resp-size" : 128, + "http-resp-content-type" : "text/plain" +} diff --git a/runtime/tests/test_work.json b/runtime/tests/test_work.json new file mode 100644 index 0000000..bb2c4d9 --- /dev/null +++ b/runtime/tests/test_work.json @@ -0,0 +1,13 @@ +{ + "active" : "yes", + "name" : "work", + "path" : "work_wasm.so", + "port" : 10000, + "argsize" : 1, + "http-req-headers" : [ ], + "http-req-content-type" : "text/plain", + "http-req-size": 10485760, + "http-resp-headers" : [ ], + "http-resp-size" : 10487760, + "http-resp-content-type" : "text/plain" +} diff --git a/runtime/tests/work/main.c b/runtime/tests/work/main.c new file mode 100644 index 0000000..b573847 --- /dev/null +++ b/runtime/tests/work/main.c @@ -0,0 +1,41 @@ +#include +#include +#include + +#define CPU_CYCS 2100 +#define MAX_BUF (1024*1024) //1m + +#define ITERS_15US 125500 +#define MULTIPLE 5 + +#define SPIN_ITERS (ITERS_15US*MULTIPLE) + +__attribute__((optnone)) static void +wrk(void) +{ + unsigned int spin = 0; + + while (spin < SPIN_ITERS) { + //__asm__ __volatile__("nop": : :"memory"); + spin++; + } +} + +//__attribute__((optnone)) int +int +main(void) +{ + char *d = malloc(MAX_BUF + 1); + int r = read(0, d, MAX_BUF); + +// unsigned long long st = rdtsc(), en = 0; +// wrk(); +// en = rdtsc(); + +// if (r <= 0) printf("%llu\n", en > st ? (en - st)/CPU_CYCS : -1); + if (r < 0) printf("E\n"); + else if (r == 0) printf("hello\n"); + else write(1, d, r); + + return 0; +}