Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
hm12299
RustPerf
提交
fb310486
R
RustPerf
项目概览
hm12299
/
RustPerf
通知
4
Star
1
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
RustPerf
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
fb310486
编写于
9月 15, 2021
作者:
hm12299
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
let cpu utlization work again
上级
6b16e180
变更
9
展开全部
隐藏空白更改
内联
并排
Showing
9 changed file
with
53 addition
and
46 deletion
+53
-46
os/src/task/cpu.rs
os/src/task/cpu.rs
+26
-23
os/src/task/processor.rs
os/src/task/processor.rs
+4
-4
os/target/riscv64gc-unknown-none-elf/debug/.fingerprint/os-1b160dc4522f292b/output-bin-os
...-elf/debug/.fingerprint/os-1b160dc4522f292b/output-bin-os
+2
-11
os/target/riscv64gc-unknown-none-elf/debug/incremental/os-3263pu5ig92uv/s-g2e9wz3gjf-o9i384.lock
...bug/incremental/os-3263pu5ig92uv/s-g2e9wz3gjf-o9i384.lock
+0
-0
os/target/riscv64gc-unknown-none-elf/debug/incremental/os-pjm698brn085/s-g2e9wz4ipa-awnu4i.lock
...ebug/incremental/os-pjm698brn085/s-g2e9wz4ipa-awnu4i.lock
+0
-0
os/target/riscv64gc-unknown-none-elf/release/.fingerprint/os-41ca51d7c7825e66/output-bin-os
...lf/release/.fingerprint/os-41ca51d7c7825e66/output-bin-os
+21
-8
os/target/riscv64gc-unknown-none-elf/release/deps/os-41ca51d7c7825e66
...scv64gc-unknown-none-elf/release/deps/os-41ca51d7c7825e66
+0
-0
os/target/riscv64gc-unknown-none-elf/release/os
os/target/riscv64gc-unknown-none-elf/release/os
+0
-0
os/target/riscv64gc-unknown-none-elf/release/os.bin
os/target/riscv64gc-unknown-none-elf/release/os.bin
+0
-0
未找到文件。
os/src/task/cpu.rs
浏览文件 @
fb310486
...
...
@@ -54,10 +54,10 @@ impl CpuStat{
unimplemented!
()
}
fn
get_cpu_info
(
&
self
)
->
CpuStatInner
{
//
let inner = self.inner.borrow_mut();
//
(inner.cpu_clock, inner.task_clock)
unimplemented!
()
fn
get_cpu_info
(
&
self
)
->
(
usize
,
usize
)
{
let
inner
=
self
.inner
.borrow_mut
();
(
inner
.cpu_clock
,
inner
.task_clock
)
//
unimplemented!()
}
fn
get_cache_reference_info
()
->
usize
{
...
...
@@ -98,6 +98,19 @@ impl CpuStat{
inner
.task_clock
=
inner
.task_clock_temp
;
inner
.task_clock_temp
=
0
;
}
fn
add_task_clock
(
&
self
,
num
:
usize
){
let
mut
inner
=
self
.inner
.borrow_mut
();
inner
.task_clock_temp
+=
num
-
inner
.task_start
;
}
fn
set_time_stamp
(
&
self
,
num
:
usize
){
self
.inner
.borrow_mut
()
.time_stamp
=
num
;
}
fn
get_time_stamp
(
&
self
)
->
usize
{
self
.inner
.borrow
()
.time_stamp
}
}
unsafe
impl
Sync
for
CpuStat
{}
...
...
@@ -107,36 +120,26 @@ lazy_static! {
}
pub
fn
set_
busy
_start
(
num
:
usize
){
pub
fn
set_
task
_start
(
num
:
usize
){
CPUSTAT
.set_task_start
(
num
);
}
pub
fn
set_sample_duration
(
num
:
usize
){
let
mut
inner
=
CPUSTAT
.inner
.borrow_mut
();
inner
.sample_duration
=
num
;
inner
.sample_busy_want
=
inner
.sample_busy_duration
;
inner
.sample_busy_duration
=
0
;
pub
fn
set_cpu_clock
(
num
:
usize
){
CPUSTAT
.set_cpu_clock
(
num
)
}
pub
fn
set_sample_busy_duration
(
num
:
usize
){
//println!("add");
let
mut
inner
=
CPUSTAT
.inner
.borrow_mut
();
inner
.is_input
=
false
;
inner
.sample_busy_duration
+=
num
-
inner
.busy_start
;
//println!("delta: {}", inner.sample_busy_duration);
//println!("sample_busy_duration:{}",inner.sample_duration);
pub
fn
add_task_clock
(
num
:
usize
){
CPUSTAT
.add_task_clock
(
num
);
}
/*
pub fn get_cpu_info() -> (usize, usize){
pub
fn
get_cpu_info
()
->
(
usize
,
usize
){
CPUSTAT
.get_cpu_info
()
}
*/
}
pub
fn
set_time_stamp
(
num
:
usize
){
let
mut
inner
=
CPUSTAT
.inner
.borrow_mut
();
inner
.time_stamp
=
num
;
CPUSTAT
.set_time_stamp
(
num
)
}
pub
fn
get_time_stamp
()
->
usize
{
let
mut
inner
=
CPUSTAT
.inner
.borrow_mut
();
inner
.time_stamp
CPUSTAT
.get_time_stamp
()
}
\ No newline at end of file
os/src/task/processor.rs
浏览文件 @
fb310486
...
...
@@ -7,7 +7,7 @@ use lazy_static::*;
use
super
::{
fetch_task
,
TaskStatus
};
use
super
::
__
switch
;
use
crate
::
trap
::
TrapContext
;
use
super
::
cpu
::{
get_time_stamp
,
is_input
,
set_sample_busy_duration
,
set_busy_start
,
set_sample_duration
,
set_time_stamp
};
use
super
::
cpu
::{
get_time_stamp
,
add_task_clock
,
set_task_start
,
set_cpu_clock
,
set_time_stamp
};
pub
struct
Processor
{
inner
:
RefCell
<
ProcessorInner
>
,
...
...
@@ -56,7 +56,7 @@ impl Processor {
//let mut task_inner = self.inner.borrow().current.unwrap().acquire_inner_lock();
//let inner_lock = self.inner.borrow_mut().current.as_ref().unwrap().acquire_inner_lock();
//let _ = inner_lock.stamp();
set_
busy
_start
(
get_time
());
set_
task
_start
(
get_time
());
//let busy_start = get_time();
//println!("run switch time start");
...
...
@@ -74,7 +74,7 @@ impl Processor {
all
+=
now
-
get_time_stamp
();
set_time_stamp
(
now
);
if
all
>
1250000
{
set_
sample_duration
(
all
);
set_
cpu_clock
(
all
);
all
=
0
;
}
}
...
...
@@ -118,7 +118,7 @@ pub fn current_trap_cx() -> &'static mut TrapContext {
pub
fn
schedule
(
switched_task_cx_ptr2
:
*
const
usize
)
{
let
idle_task_cx_ptr2
=
PROCESSOR
.get_idle_task_cx_ptr2
();
//println!("idle switch start");
set_sample_busy_duration
(
get_time
());
add_task_clock
(
get_time
());
unsafe
{
__
switch
(
switched_task_cx_ptr2
,
...
...
os/target/riscv64gc-unknown-none-elf/debug/.fingerprint/os-1b160dc4522f292b/output-bin-os
浏览文件 @
fb310486
此差异已折叠。
点击以展开。
os/target/riscv64gc-unknown-none-elf/debug/incremental/os-3263pu5ig92uv/s-g2e
74mpbcu-xsrl4d
.lock
→
os/target/riscv64gc-unknown-none-elf/debug/incremental/os-3263pu5ig92uv/s-g2e
9wz3gjf-o9i384
.lock
浏览文件 @
fb310486
文件已移动
os/target/riscv64gc-unknown-none-elf/debug/incremental/os-pjm698brn085/s-g2e
74mq1v7-m00e1h
.lock
→
os/target/riscv64gc-unknown-none-elf/debug/incremental/os-pjm698brn085/s-g2e
9wz4ipa-awnu4i
.lock
浏览文件 @
fb310486
文件已移动
os/target/riscv64gc-unknown-none-elf/release/.fingerprint/os-41ca51d7c7825e66/output-bin-os
浏览文件 @
fb310486
此差异已折叠。
点击以展开。
os/target/riscv64gc-unknown-none-elf/release/deps/os-41ca51d7c7825e66
浏览文件 @
fb310486
无法预览此类型文件
os/target/riscv64gc-unknown-none-elf/release/os
浏览文件 @
fb310486
无法预览此类型文件
os/target/riscv64gc-unknown-none-elf/release/os.bin
浏览文件 @
fb310486
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录