From a0476481fdd1e0e97f9ca888d494257a83ba56cc Mon Sep 17 00:00:00 2001 From: KunoiSayami Date: Thu, 11 May 2023 01:47:05 +0800 Subject: feat(exp): Add new experimental for save memory and test Signed-off-by: KunoiSayami --- normal_distribution.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'normal_distribution.cpp') diff --git a/normal_distribution.cpp b/normal_distribution.cpp index 20ef61c..211721a 100644 --- a/normal_distribution.cpp +++ b/normal_distribution.cpp @@ -40,13 +40,14 @@ void checkFileValid(const std::string &name, size_t length) { } void progress_bar(const std::set &v, size_t length) { + constexpr auto sleep_time = std::chrono::seconds(1); size_t previous_rate = 0; while (v.size() < length) { fprintf(stderr, "\rProgress %.02f%%(%lu) rate: %lu/s", (double)v.size() * 100 / (double)length, v.size(), v.size() - previous_rate); previous_rate = v.size(); - std::this_thread::sleep_for(std::chrono::seconds(1)); + std::this_thread::sleep_for(sleep_time); } fputs("", stderr); } -- cgit v1.3.1