Use 1st arg of xdu, xls, mktree for nworkers

上级 ab9b29d9
...@@ -63,6 +63,8 @@ struct TimedExec : public Bench ...@@ -63,6 +63,8 @@ struct TimedExec : public Bench
}; };
#define CMD(...) new TimedExec((const char *[]){__VA_ARGS__, 0}) #define CMD(...) new TimedExec((const char *[]){__VA_ARGS__, 0})
#define STR_1(x...) #x
#define STR(x...) STR_1(x)
int int
main(int ac, char **av) main(int ac, char **av)
...@@ -70,9 +72,14 @@ main(int ac, char **av) ...@@ -70,9 +72,14 @@ main(int ac, char **av)
static Bench* the_bench[128]; static Bench* the_bench[128];
int n = 0; int n = 0;
the_bench[n++] = CMD("mktree", "tree.xdu", "4", "4"); the_bench[n++] = CMD("mktree", STR(NCPU), "tree.xdu", "4", "4");
the_bench[n++] = CMD("xdu"); the_bench[n++] = CMD("xdu", "1");
the_bench[n++] = CMD("xls"); the_bench[n++] = CMD("xdu", "4");
the_bench[n++] = CMD("xdu", "8");
the_bench[n++] = CMD("xls", "1");
the_bench[n++] = CMD("xls", "4");
the_bench[n++] = CMD("xls", "8");
the_bench[n++] = CMD("mapbench", "1"); the_bench[n++] = CMD("mapbench", "1");
the_bench[n++] = CMD("mapbench", "2"); the_bench[n++] = CMD("mapbench", "2");
the_bench[n++] = CMD("mapbench", "16"); the_bench[n++] = CMD("mapbench", "16");
......
...@@ -34,14 +34,15 @@ dolevel(int fd, int depth) ...@@ -34,14 +34,15 @@ dolevel(int fd, int depth)
int int
main(int ac, char **av) main(int ac, char **av)
{ {
if (ac < 4) if (ac < 5)
die("usage: %s dir branch depth", av[0]); die("usage: %s nworkers dir branch depth", av[0]);
wq_maxworkers = atoi(av[1])-1;
initwq(); initwq();
const char *dir = av[1]; const char *dir = av[2];
branch = atoi(av[2]); branch = atoi(av[3]);
int depth = atoi(av[3]); int depth = atoi(av[4]);
if (mkdir(dir)) if (mkdir(dir))
die("mkdir"); die("mkdir");
......
...@@ -72,6 +72,11 @@ main(int ac, char **av) ...@@ -72,6 +72,11 @@ main(int ac, char **av)
{ {
size_t s; size_t s;
if (ac < 2)
die("usage: %s nworkers", av[0]);
wq_maxworkers = atoi(av[1])-1;
initwq(); initwq();
perf_start(PERF_SELECTOR, PERF_PERIOD); perf_start(PERF_SELECTOR, PERF_PERIOD);
s = du(open(".", 0)); s = du(open(".", 0));
......
...@@ -80,19 +80,23 @@ ls(const char *path) ...@@ -80,19 +80,23 @@ ls(const char *path)
} }
int int
main(int argc, char *argv[]) main(int ac, char *av[])
{ {
int i; int i;
if (ac < 2)
die("usage: %s nworkers [paths]", av[0]);
wq_maxworkers = atoi(av[1])-1;
initwq(); initwq();
perf_start(PERF_SELECTOR, 10000); perf_start(PERF_SELECTOR, 10000);
if(argc < 2) { if(ac < 3) {
ls("."); ls(".");
} else { } else {
// XXX(sbw) wq_for // XXX(sbw) wq_for
for (i=1; i<argc; i++) for (i=2; i<ac; i++)
ls(argv[i]); ls(av[i]);
} }
perf_stop(); perf_stop();
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论