提交 703597f4 创建 作者: Nickolai Zeldovich's avatar Nickolai Zeldovich

benchmark 1M map/unmap ops, no PFs

上级 bd01691d
...@@ -7,30 +7,31 @@ ...@@ -7,30 +7,31 @@
static struct uspinlock l; static struct uspinlock l;
static volatile int tcount; static volatile int tcount;
enum { readaccess = 1 }; enum { readaccess = 0 };
enum { verbose = 0 }; enum { verbose = 0 };
enum { npg = 1 };
void void
thr(void *arg) thr(void *arg)
{ {
u64 tid = (u64)arg; u64 tid = (u64)arg;
for (int i = 0; i < 10000; i++) { for (int i = 0; i < 1000000; i++) {
if (verbose && ((i % 100) == 0)) if (verbose && ((i % 100) == 0))
fprintf(1, "%d: %d ops\n", tid, i); fprintf(1, "%d: %d ops\n", tid, i);
volatile char *p = (char*) (0x40000UL + tid * 8 * 4096); volatile char *p = (char*) (0x40000UL + tid * npg * 4096);
if (map((void *) p, 8 * 4096) < 0) { if (map((void *) p, npg * 4096) < 0) {
fprintf(1, "%d: map failed\n", tid); fprintf(1, "%d: map failed\n", tid);
exit(); exit();
} }
if (readaccess) { if (readaccess) {
for (int j = 0; j < 8 * 4096; j++) for (int j = 0; j < npg * 4096; j++)
p[j] = '\0'; p[j] = '\0';
} }
if (unmap((void *) p, 8 * 4096) < 0) { if (unmap((void *) p, npg * 4096) < 0) {
fprintf(1, "%d: unmap failed\n", tid); fprintf(1, "%d: unmap failed\n", tid);
exit(); exit();
} }
......
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论