Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
e1944711
提交
e1944711
4月 27, 2012
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Start of another microbenchmark
上级
2c057f08
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
115 行增加
和
1 行删除
+115
-1
Makefrag
bin/Makefrag
+2
-1
filebench.cc
bin/filebench.cc
+85
-0
Makefrag.bench
user/Makefrag.bench
+26
-0
util.h
user/util.h
+2
-0
没有找到文件。
bin/Makefrag
浏览文件 @
e1944711
...
@@ -38,7 +38,8 @@ UPROGS= \
...
@@ -38,7 +38,8 @@ UPROGS= \
wqtest \
wqtest \
rm \
rm \
avar \
avar \
schedbench
schedbench \
filebench
ifeq ($(HAVE_LWIP),y)
ifeq ($(HAVE_LWIP),y)
UPROGS += \
UPROGS += \
...
...
bin/filebench.cc
0 → 100644
浏览文件 @
e1944711
#if defined(LINUX)
#include "user/util.h"
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#define O_CREATE O_CREAT
#define xfork() fork()
#define xexit() exit(EXIT_SUCCESS)
#else
#include "types.h"
#include "user.h"
#include "fcntl.h"
#define xfork() fork(0)
#define xexit() exit()
#endif
#define CHUNKSZ 512
#define FILESZ (NCPU*CHUNKSZ)
static
const
bool
pinit
=
true
;
static
char
chunkbuf
[
CHUNKSZ
];
static
void
bench
(
int
tid
,
int
nloop
)
{
if
(
pinit
)
setaffinity
(
tid
);
int
fd
=
open
(
"filebenchx"
,
O_RDONLY
);
if
(
fd
<
0
)
die
(
"open"
);
for
(
int
i
=
0
;
i
<
nloop
;
i
++
)
{
ssize_t
r
;
r
=
pread
(
fd
,
chunkbuf
,
CHUNKSZ
,
CHUNKSZ
*
tid
);
if
(
r
!=
CHUNKSZ
)
die
(
"pread"
);
}
close
(
fd
);
xexit
();
}
int
main
(
int
ac
,
char
**
av
)
{
int
nthread
;
int
nloop
;
#ifdef HW_qemu
nloop
=
50
;
#else
nloop
=
1000
;
#endif
if
(
ac
<
2
)
die
(
"usage: %s nthreads [nloop]"
,
av
[
0
]);
nthread
=
atoi
(
av
[
1
]);
if
(
ac
>
2
)
nloop
=
atoi
(
av
[
2
]);
// Setup shared file
int
fd
=
open
(
"filebenchx"
,
O_CREATE
|
O_WRONLY
);
if
(
fd
<
0
)
die
(
"open O_CREAT failed"
);
for
(
int
i
=
0
;
i
<
FILESZ
;
i
+=
CHUNKSZ
)
{
int
r
=
write
(
fd
,
chunkbuf
,
CHUNKSZ
);
if
(
r
<
CHUNKSZ
)
die
(
"write"
);
}
close
(
fd
);
for
(
int
i
=
0
;
i
<
nthread
;
i
++
)
{
int
pid
=
xfork
();
if
(
pid
==
0
)
bench
(
i
,
nloop
);
else
if
(
pid
<
0
)
die
(
"fork"
);
}
return
0
;
}
user/Makefrag.bench
0 → 100644
浏览文件 @
e1944711
NCXXFLAGS = -static -g -MD -m64 -O3 -Wall -Werror -DHW_$(HW) \
-fno-builtin -fno-strict-aliasing -fno-omit-frame-pointer \
-fms-extensions -mcx16 -mno-red-zone -std=c++0x \
-Wno-sign-compare -fno-exceptions -fno-rtti -fcheck-new \
-iquote . -iquote include \
-include param.h -include include/compiler.h
$(O)/user/%.o: user/%.cc
@echo " CXX $@"
$(Q)mkdir -p $(@D)
$(Q)$(CXX) -DLINUX $(NCXXFLAGS) -c -o $@ $<
$(O)/user/%.o: bin/%.cc
@echo " CXX $@"
$(Q)mkdir -p $(@D)
$(Q)$(CXX) -DLINUX $(NCXXFLAGS) -c -o $@ $<
$(O)/%: $(O)/user/%.o
@echo " LD $@"
$(Q)mkdir -p $(@D)
$(Q)$(CXX) -o $@ $^ -lpthread
.PRECIOUS: $(O)/user/%.o
-include $(O)/user/*.d
ALL := $(O)/filebench
user/util.h
浏览文件 @
e1944711
#include <stdio.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdint.h>
#include <errno.h>
#include <errno.h>
#include <string.h>
#include <string.h>
#include <sched.h>
#include <sched.h>
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论