From 92e37f46762df0541702b2a6eca33f494273f0c5 Mon Sep 17 00:00:00 2001 From: shenjack <3695888@qq.com> Date: Thu, 29 Feb 2024 00:39:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E4=BC=98=E5=8C=96=E7=AE=97?= =?UTF-8?q?=E6=B3=95=E4=BA=86=EF=BC=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index 841709a..adb9297 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,7 +40,7 @@ const allow_d: u32 = 10; const report_interval: u32 = 1_000_0000; fn cacl(max: u64, step: usize, top: u32, id: u64) { - let start_time = std::time::Instant::now(); + let mut start_time = std::time::Instant::now(); let mut k: u64 = 0; let mut top = top; for i in (0+id..max).step_by(step) { @@ -61,6 +61,7 @@ fn cacl(max: u64, step: usize, top: u32, id: u64) { if k > report_interval as u64 { let now = std::time::Instant::now(); info!("{} {} {}/s", k, id, k / now.duration_since(start_time).as_secs()); + start_time = now; k = 0; } }