Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
0d9c2da7
提交
0d9c2da7
3月 21, 2012
创建
作者:
Austin Clements
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
asharing: Some lame tests for VM and FS sharing
上级
a64fdf99
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
78 行增加
和
0 行删除
+78
-0
Makefrag
bin/Makefrag
+1
-0
asharing.cc
bin/asharing.cc
+77
-0
没有找到文件。
bin/Makefrag
浏览文件 @
0d9c2da7
...
@@ -26,6 +26,7 @@ UPROGS= \
...
@@ -26,6 +26,7 @@ UPROGS= \
wqsh \
wqsh \
cp \
cp \
perf \
perf \
asharing \
xls \
xls \
xdu
xdu
# pdu
# pdu
...
...
bin/asharing.cc
0 → 100644
浏览文件 @
0d9c2da7
// Tests to drive abstract sharing analysis
#include "types.h"
#include "user.h"
#include "fcntl.h"
#include "mtrace.h"
static
int
cpu
;
void
next
()
{
if
(
setaffinity
(
cpu
)
<
0
)
{
cpu
=
0
;
if
(
setaffinity
(
cpu
)
<
0
)
die
(
"sys_setaffinity(%d) failed"
,
cpu
);
}
cpu
++
;
}
void
vmsharing
(
void
)
{
for
(
int
i
=
0
;
i
<
8
;
i
++
)
{
next
();
volatile
char
*
p
=
(
char
*
)(
0x40000UL
+
i
*
4096
);
mtenable
(
"xv6-mapsharing"
);
if
(
map
((
void
*
)
p
,
4096
)
<
0
)
die
(
"map failed"
);
mtdisable
(
"xv6-mapsharing"
);
mtenable
(
"xv6-mapsharing"
);
if
(
unmap
((
void
*
)
p
,
4096
)
<
0
)
die
(
"unmap failed"
);
mtdisable
(
"xv6-mapsharing"
);
}
}
void
fssharing
(
void
)
{
// Note that we keep these files open; otherwise all of these
// operations will share the abstract FD object and we won't get any
// results.
next
();
mtenable
(
"xv6-fssharing"
);
open
(
"a"
,
O_CREATE
|
O_RDWR
);
mtdisable
(
"xv6-fssharing"
);
next
();
mtenable
(
"xv6-fssharing"
);
open
(
"b"
,
O_CREATE
|
O_RDWR
);
mtdisable
(
"xv6-fssharing"
);
next
();
mtenable
(
"xv6-fssharing"
);
open
(
"a"
,
O_RDWR
);
mtdisable
(
"xv6-fssharing"
);
next
();
mtenable
(
"xv6-fssharing"
);
open
(
"b"
,
O_RDWR
);
mtdisable
(
"xv6-fssharing"
);
}
int
main
(
int
ac
,
char
**
av
)
{
if
(
ac
==
2
&&
strcmp
(
av
[
1
],
"vm"
)
==
0
)
vmsharing
();
else
if
(
ac
==
2
&&
strcmp
(
av
[
1
],
"fs"
)
==
0
)
fssharing
();
else
fprintf
(
1
,
"usage: %s vm|fs
\n
"
,
av
[
0
]);
}
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论