Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
X
xv6-public
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
问题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
银宸时代
OS Lab Group
奖励实验
xv6-public
提交
8f88035a
提交
8f88035a
3月 31, 2012
创建
作者:
Silas Boyd-Wickizer
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
A hack to help filter idle time from perf-report
上级
60503d75
隐藏空白字符变更
内嵌
并排
正在显示
6 个修改的文件
包含
20 行增加
和
3 行删除
+20
-3
kernel.hh
include/kernel.hh
+1
-0
sampler.h
include/sampler.h
+1
-0
idle.cc
kernel/idle.cc
+2
-0
sampler.cc
kernel/sampler.cc
+8
-0
sched.cc
kernel/sched.cc
+2
-0
perf-report.cc
tools/perf-report.cc
+6
-3
没有找到文件。
include/kernel.hh
浏览文件 @
8f88035a
...
@@ -185,6 +185,7 @@ void sampstart(void);
...
@@ -185,6 +185,7 @@ void sampstart(void);
int
sampintr
(
struct
trapframe
*
);
int
sampintr
(
struct
trapframe
*
);
void
sampdump
(
void
);
void
sampdump
(
void
);
void
sampconf
(
void
);
void
sampconf
(
void
);
void
sampidle
(
bool
);
// sched.cc
// sched.cc
void
addrun
(
struct
proc
*
);
void
addrun
(
struct
proc
*
);
...
...
include/sampler.h
浏览文件 @
8f88035a
...
@@ -9,6 +9,7 @@ struct sampconf {
...
@@ -9,6 +9,7 @@ struct sampconf {
#define NTRACE 4
#define NTRACE 4
struct
pmuevent
{
struct
pmuevent
{
u8
idle
:
1
;
u64
rip
;
u64
rip
;
uptr
trace
[
NTRACE
];
uptr
trace
[
NTRACE
];
};
};
...
...
kernel/idle.cc
浏览文件 @
8f88035a
...
@@ -93,10 +93,12 @@ idleloop(void)
...
@@ -93,10 +93,12 @@ idleloop(void)
mtstart
(
idleloop
,
myproc
());
mtstart
(
idleloop
,
myproc
());
sti
();
sti
();
sampidle
(
true
);
for
(;;)
{
for
(;;)
{
acquire
(
&
myproc
()
->
lock
);
acquire
(
&
myproc
()
->
lock
);
myproc
()
->
set_state
(
RUNNABLE
);
myproc
()
->
set_state
(
RUNNABLE
);
sched
();
sched
();
sampidle
(
true
);
finishzombies
();
finishzombies
();
...
...
kernel/sampler.cc
浏览文件 @
8f88035a
...
@@ -26,6 +26,7 @@ struct pmu pmu;
...
@@ -26,6 +26,7 @@ struct pmu pmu;
struct
pmulog
{
struct
pmulog
{
u64
count
;
u64
count
;
u64
capacity
;
u64
capacity
;
u8
idle
:
1
;
// Currently idle?
struct
pmuevent
*
event
;
struct
pmuevent
*
event
;
__padout__
;
__padout__
;
}
__mpalign__
;
}
__mpalign__
;
...
@@ -71,6 +72,12 @@ sampdump(void)
...
@@ -71,6 +72,12 @@ sampdump(void)
}
}
void
void
sampidle
(
bool
b
)
{
pmulog
[
myid
()].
idle
=
b
;
}
void
sampconf
(
void
)
sampconf
(
void
)
{
{
pushcli
();
pushcli
();
...
@@ -105,6 +112,7 @@ samplog(struct trapframe *tf)
...
@@ -105,6 +112,7 @@ samplog(struct trapframe *tf)
e
=
&
l
->
event
[
l
->
count
];
e
=
&
l
->
event
[
l
->
count
];
e
->
idle
=
l
->
idle
;
e
->
rip
=
tf
->
rip
;
e
->
rip
=
tf
->
rip
;
getcallerpcs
((
void
*
)
tf
->
rbp
,
e
->
trace
,
NELEM
(
e
->
trace
));
getcallerpcs
((
void
*
)
tf
->
rbp
,
e
->
trace
,
NELEM
(
e
->
trace
));
l
->
count
++
;
l
->
count
++
;
...
...
kernel/sched.cc
浏览文件 @
8f88035a
...
@@ -71,6 +71,8 @@ sched(void)
...
@@ -71,6 +71,8 @@ sched(void)
release
(
&
myproc
()
->
lock
);
release
(
&
myproc
()
->
lock
);
return
;
return
;
}
}
}
else
{
sampidle
(
false
);
}
}
if
(
next
->
get_state
()
!=
RUNNABLE
)
if
(
next
->
get_state
()
!=
RUNNABLE
)
...
...
tools/perf-report.cc
浏览文件 @
8f88035a
...
@@ -19,6 +19,7 @@
...
@@ -19,6 +19,7 @@
#include "include/sampler.h"
#include "include/sampler.h"
static
bool
stacktrace_mode
=
true
;
static
bool
stacktrace_mode
=
true
;
static
bool
ignoreidle_mode
=
false
;
static
void
__attribute__
((
noreturn
))
static
void
__attribute__
((
noreturn
))
edie
(
const
char
*
errstr
,
...)
edie
(
const
char
*
errstr
,
...)
...
@@ -199,8 +200,8 @@ print_entry(Addr2line &addr2line, int count, struct pmuevent *e)
...
@@ -199,8 +200,8 @@ print_entry(Addr2line &addr2line, int count, struct pmuevent *e)
char
*
file
;
char
*
file
;
int
line
;
int
line
;
addr2line
.
lookup
(
e
->
rip
,
&
func
,
&
file
,
&
line
);
addr2line
.
lookup
(
e
->
rip
,
&
func
,
&
file
,
&
line
);
printf
(
"%-
10u
%016"
PRIx64
" %s:%u %s
\n
"
,
printf
(
"%-
8u %4s
%016"
PRIx64
" %s:%u %s
\n
"
,
count
,
e
->
rip
,
file
,
line
,
func
);
count
,
e
->
idle
?
"idle"
:
""
,
e
->
rip
,
file
,
line
,
func
);
free
(
func
);
free
(
func
);
free
(
file
);
free
(
file
);
...
@@ -211,7 +212,7 @@ print_entry(Addr2line &addr2line, int count, struct pmuevent *e)
...
@@ -211,7 +212,7 @@ print_entry(Addr2line &addr2line, int count, struct pmuevent *e)
if
(
e
->
trace
[
i
]
==
0
)
if
(
e
->
trace
[
i
]
==
0
)
break
;
break
;
addr2line
.
lookup
(
e
->
trace
[
i
],
&
func
,
&
file
,
&
line
);
addr2line
.
lookup
(
e
->
trace
[
i
],
&
func
,
&
file
,
&
line
);
printf
(
" %016"
PRIx64
" %s:%u %s
\n
"
,
printf
(
"
%016"
PRIx64
" %s:%u %s
\n
"
,
e
->
trace
[
i
],
file
,
line
,
func
);
e
->
trace
[
i
],
file
,
line
,
func
);
free
(
func
);
free
(
func
);
free
(
file
);
free
(
file
);
...
@@ -264,6 +265,8 @@ main(int ac, char **av)
...
@@ -264,6 +265,8 @@ main(int ac, char **av)
p
=
(
struct
pmuevent
*
)(
x
+
header
->
cpu
[
i
].
offset
);
p
=
(
struct
pmuevent
*
)(
x
+
header
->
cpu
[
i
].
offset
);
q
=
(
struct
pmuevent
*
)(
x
+
header
->
cpu
[
i
].
offset
+
header
->
cpu
[
i
].
size
);
q
=
(
struct
pmuevent
*
)(
x
+
header
->
cpu
[
i
].
offset
+
header
->
cpu
[
i
].
size
);
for
(;
p
<
q
;
p
++
)
{
for
(;
p
<
q
;
p
++
)
{
if
(
ignoreidle_mode
&&
p
->
idle
)
continue
;
auto
it
=
map
.
find
(
p
);
auto
it
=
map
.
find
(
p
);
if
(
it
==
map
.
end
())
if
(
it
==
map
.
end
())
map
[
p
]
=
1
;
map
[
p
]
=
1
;
...
...
编写
预览
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论