More benchmarking..

上级 63c51365
...@@ -73,17 +73,18 @@ main(int ac, char **av) ...@@ -73,17 +73,18 @@ main(int ac, char **av)
if (ac > 2) if (ac > 2)
niter = atoi(av[2]); niter = atoi(av[2]);
pthread_t* tid = (pthread_t*) malloc(sizeof(*tid)*nthread);
pthread_barrier_init(&bar, 0, nthread); pthread_barrier_init(&bar, 0, nthread);
pthread_barrier_init(&bar2, 0, nthread); pthread_barrier_init(&bar2, 0, nthread);
for(u64 i = 0; i < nthread; i++) { for(u64 i = 0; i < nthread; i++) {
pthread_t tid; pthread_create(&tid[i], 0, thr, (void*) i);
pthread_create(&tid, 0, thr, (void*) i);
if (0) printf("mapbench[%d]: child %d\n", getpid(), tid); if (0) printf("mapbench[%d]: child %d\n", getpid(), tid);
} }
for(int i = 0; i < nthread; i++) for(int i = 0; i < nthread; i++)
xwait(); xpthread_join(tid[i]);
mtdisable("xv6-asharing"); mtdisable("xv6-asharing");
......
...@@ -16,6 +16,7 @@ static inline void xwait() ...@@ -16,6 +16,7 @@ static inline void xwait()
#define mtenable(x) do { } while(0) #define mtenable(x) do { } while(0)
#define mtenable_type(x, y) do { } while (0) #define mtenable_type(x, y) do { } while (0)
#define mtdisable(x) do { } while(0) #define mtdisable(x) do { } while(0)
#define xpthread_join(tid) pthread_join(tid, nullptr);
#else // Must be xv6 #else // Must be xv6
...@@ -24,5 +25,6 @@ static inline void xwait() ...@@ -24,5 +25,6 @@ static inline void xwait()
#define xmkdir(pathname) mkdir((pathname)) #define xmkdir(pathname) mkdir((pathname))
#define xcreat(name) open((name), O_CREATE|O_RDWR) #define xcreat(name) open((name), O_CREATE|O_RDWR)
#define xwait() wait() #define xwait() wait()
#define xpthread_join(tid) xwait()
#endif #endif
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论