Skip to content

Commit bc16f9a

Browse files
committed
bench: 同步测例
Signed-off-by: YdrMaster <[email protected]>
1 parent 6edd5a4 commit bc16f9a

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

bench-kernel/src/main.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,17 @@ extern "C" fn rust_main(hartid: usize, _dtb_pa: usize) -> ! {
4343
// 测试调用延迟
4444
let t0 = time::read();
4545

46-
for _ in 0..0x20000 {
46+
for _ in 0..100_0000 {
47+
let _ = sbi_rt::get_spec_version();
48+
}
49+
50+
let t1 = time::read();
51+
log::info!("spec_version duration = {}", t1 - t0);
52+
53+
// 测试调用延迟
54+
let t0 = time::read();
55+
56+
for _ in 0..100_0000 {
4757
let _ = sbi_rt::get_marchid();
4858
}
4959

@@ -54,7 +64,7 @@ extern "C" fn rust_main(hartid: usize, _dtb_pa: usize) -> ! {
5464
unsafe { sie::set_ssoft() };
5565
// 测试中断响应延迟
5666
let t0 = time::read();
57-
for _ in 0..0x20000 {
67+
for _ in 0..100_0000 {
5868
unsafe {
5969
sstatus::set_sie();
6070
core::arch::asm!(

0 commit comments

Comments
 (0)