forked from haiwan/sledge
parent
ae392fdfe3
commit
611ec2257a
@ -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"
|
||||
}
|
@ -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"
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#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;
|
||||
}
|
Loading…
Reference in new issue