提交 8286b580 创建 作者: Austin Clements's avatar Austin Clements

Remove my lame start sync and start recording before setup

Turns out mscan deals just fine with the benchmark setup
上级 a036c823
...@@ -22,10 +22,15 @@ static const bool pinit = true; ...@@ -22,10 +22,15 @@ static const bool pinit = true;
enum { nfile = MTRACE ? 2 : 10 }; enum { nfile = MTRACE ? 2 : 10 };
enum { nlookup = MTRACE ? 2 : 100 }; enum { nlookup = MTRACE ? 2 : 100 };
// XXX(austin) Totally lame. Put this buffer in the BSS so we don't
// have to COW fault the stack.
static char pn[32]
__attribute__((aligned(4096)));
void void
bench(u32 tid, int nloop, const char* path) bench(u32 tid, int nloop, const char* path)
{ {
char pn[32]; // char pn[32];
if (pinit) if (pinit)
setaffinity(tid); setaffinity(tid);
...@@ -85,29 +90,17 @@ main(int ac, char** av) ...@@ -85,29 +90,17 @@ main(int ac, char** av)
xmkdir(path); xmkdir(path);
int start[2]; mtenable_type(mtrace_record_ascope, "xv6-dirbench");
if (pipe(start) < 0)
die("pipe");
u64 t0 = rdtsc(); u64 t0 = rdtsc();
for(u32 i = 0; i < nthread; i++) { for(u32 i = 0; i < nthread; i++) {
int pid = xfork(); int pid = xfork();
if (pid == 0) { if (pid == 0) {
close(start[1]);
char token;
if (read(start[0], &token, 1) < 1)
die("read");
bench(i, nloop, path); bench(i, nloop, path);
} else if (pid < 0) } else if (pid < 0)
die("fork"); die("fork");
} }
mtenable_type(mtrace_record_ascope, "xv6-dirbench");
const char wakeup[256] = {};
if (write(start[1], wakeup, nthread) < nthread)
die("write");
for (u32 i = 0; i < nthread; i++) for (u32 i = 0; i < nthread; i++)
xwait(); xwait();
u64 t1 = rdtsc(); u64 t1 = rdtsc();
......
...@@ -74,6 +74,8 @@ main(int ac, char **av) ...@@ -74,6 +74,8 @@ main(int ac, char **av)
if (ac > 3) if (ac > 3)
path = av[3]; path = av[3];
mtenable_type(mtrace_record_ascope, "xv6-filebench");
// Setup shared file // Setup shared file
unlink(path); unlink(path);
int fd = xcreat(path); int fd = xcreat(path);
...@@ -86,31 +88,17 @@ main(int ac, char **av) ...@@ -86,31 +88,17 @@ main(int ac, char **av)
} }
close(fd); close(fd);
int start[2];
if (pipe(start) < 0)
die("pipe");
//mtenable("xv6-filebench"); //mtenable("xv6-filebench");
u64 t0 = rdtsc(); u64 t0 = rdtsc();
for (int i = 0; i < nthread; i++) { for (int i = 0; i < nthread; i++) {
int pid = xfork(); int pid = xfork();
if (pid == 0) { if (pid == 0) {
close(start[1]);
char token;
if (read(start[0], &token, 1) < 1)
die("read");
bench(i, nloop, path); bench(i, nloop, path);
} }
else if (pid < 0) else if (pid < 0)
die("fork"); die("fork");
} }
mtenable_type(mtrace_record_ascope, "xv6-filebench");
const char wakeup[256] = {};
if (write(start[1], wakeup, nthread) < nthread)
die("write");
for (int i = 0; i < nthread; i++) for (int i = 0; i < nthread; i++)
xwait(); xwait();
u64 t1 = rdtsc(); u64 t1 = rdtsc();
......
...@@ -37,8 +37,8 @@ thr(void *arg) ...@@ -37,8 +37,8 @@ thr(void *arg)
pthread_barrier_wait(&bar); pthread_barrier_wait(&bar);
if (tid == 0) // if (tid == 0)
mtenable_type(mtrace_record_ascope, "xv6-asharing"); // mtenable_type(mtrace_record_ascope, "xv6-asharing");
pthread_barrier_wait(&bar2); pthread_barrier_wait(&bar2);
...@@ -75,6 +75,8 @@ main(int ac, char **av) ...@@ -75,6 +75,8 @@ main(int ac, char **av)
if (ac > 2) if (ac > 2)
niter = atoi(av[2]); niter = atoi(av[2]);
mtenable_type(mtrace_record_ascope, "xv6-asharing");
pthread_t* tid = (pthread_t*) malloc(sizeof(*tid)*nthread); pthread_t* tid = (pthread_t*) malloc(sizeof(*tid)*nthread);
pthread_barrier_init(&bar, 0, nthread); pthread_barrier_init(&bar, 0, nthread);
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论