From 43cd467d9fefbf6ea3c266f7cbf24a842f440e42 Mon Sep 17 00:00:00 2001 From: zhangxinyu <840317537@qq.com> Date: Wed, 24 May 2023 16:44:21 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=BA=94=E7=94=A8=E7=A8=8B?= =?UTF-8?q?=E5=BA=8F,=20=E4=BB=A5=E6=BB=A1=E8=B6=B3=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ch3/user/src/bin/00power_3.rs | 4 ++-- ch3/user/src/bin/01power_5.rs | 4 ++-- ch3/user/src/bin/02power_7.rs | 4 ++-- ch3/user/src/bin/04loop.rs | 18 ++++++++++++++++++ 4 files changed, 24 insertions(+), 6 deletions(-) create mode 100644 ch3/user/src/bin/04loop.rs diff --git a/ch3/user/src/bin/00power_3.rs b/ch3/user/src/bin/00power_3.rs index 1a04dc7..f5f5adc 100644 --- a/ch3/user/src/bin/00power_3.rs +++ b/ch3/user/src/bin/00power_3.rs @@ -10,7 +10,7 @@ const LEN: usize = 100; fn main() -> i32 { let p = 3u64; let m = 998244353u64; - let iter: usize = 200000; + let iter: usize = 20000000; let mut s = [0u64; LEN]; let mut cur = 0usize; s[cur] = 1; @@ -18,7 +18,7 @@ fn main() -> i32 { let next = if cur + 1 == LEN { 0 } else { cur + 1 }; s[next] = s[cur] * p % m; cur = next; - if i % 10000 == 0 { + if i % 1000000 == 0 { println!("power_3 [{}/{}]", i, iter); } } diff --git a/ch3/user/src/bin/01power_5.rs b/ch3/user/src/bin/01power_5.rs index e47761b..85edaf1 100644 --- a/ch3/user/src/bin/01power_5.rs +++ b/ch3/user/src/bin/01power_5.rs @@ -10,7 +10,7 @@ const LEN: usize = 100; fn main() -> i32 { let p = 5u64; let m = 998244353u64; - let iter: usize = 140000; + let iter: usize = 14000000; let mut s = [0u64; LEN]; let mut cur = 0usize; s[cur] = 1; @@ -18,7 +18,7 @@ fn main() -> i32 { let next = if cur + 1 == LEN { 0 } else { cur + 1 }; s[next] = s[cur] * p % m; cur = next; - if i % 10000 == 0 { + if i % 1000000 == 0 { println!("power_5 [{}/{}]", i, iter); } } diff --git a/ch3/user/src/bin/02power_7.rs b/ch3/user/src/bin/02power_7.rs index a97d2f5..b4e20af 100644 --- a/ch3/user/src/bin/02power_7.rs +++ b/ch3/user/src/bin/02power_7.rs @@ -10,7 +10,7 @@ const LEN: usize = 100; fn main() -> i32 { let p = 7u64; let m = 998244353u64; - let iter: usize = 160000; + let iter: usize = 16000000; let mut s = [0u64; LEN]; let mut cur = 0usize; s[cur] = 1; @@ -18,7 +18,7 @@ fn main() -> i32 { let next = if cur + 1 == LEN { 0 } else { cur + 1 }; s[next] = s[cur] * p % m; cur = next; - if i % 10000 == 0 { + if i % 1000000 == 0 { println!("power_7 [{}/{}]", i, iter); } } diff --git a/ch3/user/src/bin/04loop.rs b/ch3/user/src/bin/04loop.rs new file mode 100644 index 0000000..094066a --- /dev/null +++ b/ch3/user/src/bin/04loop.rs @@ -0,0 +1,18 @@ +#![no_std] +#![no_main] + +#[macro_use] +extern crate user_lib; + +use user_lib::syscall::{sys_get_time, sys_yield}; + +#[no_mangle] +fn main() -> i32 { + let current_timer = sys_get_time(); + let wait_for = current_timer + 3000; + loop { + + } + println!("Test sleep OK!"); + 0 +}