mtenable/mtdisable for filebench

上级 4d59fb8a
...@@ -69,7 +69,7 @@ main(int ac, char** av) ...@@ -69,7 +69,7 @@ main(int ac, char** av)
mkdir("/dbx"); mkdir("/dbx");
mtenable("xv6-schedbench"); mtenable("xv6-dirbench");
u64 t0 = rdtsc(); u64 t0 = rdtsc();
for(u32 i = 0; i < nthread; i++) { for(u32 i = 0; i < nthread; i++) {
int pid = fork(0); int pid = fork(0);
...@@ -82,7 +82,7 @@ main(int ac, char** av) ...@@ -82,7 +82,7 @@ main(int ac, char** av)
for (u32 i = 0; i < nthread; i++) for (u32 i = 0; i < nthread; i++)
wait(); wait();
u64 t1 = rdtsc(); u64 t1 = rdtsc();
mtdisable("xv6-schedbench"); mtdisable("xv6-dirbench");
printf("dirbench: %lu\n", t1-t0); printf("dirbench: %lu\n", t1-t0);
return 0; return 0;
......
...@@ -7,12 +7,15 @@ ...@@ -7,12 +7,15 @@
#define xfork() fork() #define xfork() fork()
#define xexit() exit(EXIT_SUCCESS) #define xexit() exit(EXIT_SUCCESS)
#define xcreat(name) open((name), O_CREATE|O_WRONLY, S_IRUSR|S_IWUSR) #define xcreat(name) open((name), O_CREATE|O_WRONLY, S_IRUSR|S_IWUSR)
#define mtenable(x) do { } while(0)
#define mtdisable(x) do { } while(0)
typedef uint64_t u64; typedef uint64_t u64;
#else #else
#include "types.h" #include "types.h"
#include "user.h" #include "user.h"
#include "fcntl.h" #include "fcntl.h"
#include "amd64.h" #include "amd64.h"
#include "mtrace.h"
#define xfork() fork(0) #define xfork() fork(0)
#define xexit() exit() #define xexit() exit()
#define xcreat(name) open((name), O_CREATE|O_WRONLY) #define xcreat(name) open((name), O_CREATE|O_WRONLY)
...@@ -78,6 +81,7 @@ main(int ac, char **av) ...@@ -78,6 +81,7 @@ main(int ac, char **av)
} }
close(fd); close(fd);
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();
...@@ -90,6 +94,7 @@ main(int ac, char **av) ...@@ -90,6 +94,7 @@ main(int ac, char **av)
for (int i = 0; i < nthread; i++) for (int i = 0; i < nthread; i++)
wait(); wait();
u64 t1 = rdtsc(); u64 t1 = rdtsc();
mtdisable("xv6-filebench");
printf("filebench: %lu\n", t1-t0); printf("filebench: %lu\n", t1-t0);
return 0; return 0;
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论