summaryrefslogtreecommitdiff
path: root/normal_distribution.cpp
diff options
context:
space:
mode:
authorKunoiSayami <[email protected]>2023-05-11 01:47:05 +0800
committerKunoiSayami <[email protected]>2023-05-11 01:47:18 +0800
commita0476481fdd1e0e97f9ca888d494257a83ba56cc (patch)
treec10f0eabd3714b254fd8d7c5110e50fb6322011d /normal_distribution.cpp
parentc748e1ed7c9693931ae9ee61cf7c45aee2305728 (diff)
feat(exp): Add new experimental for save memory and test
Signed-off-by: KunoiSayami <[email protected]>
Diffstat (limited to 'normal_distribution.cpp')
-rw-r--r--normal_distribution.cpp3
1 files changed, 2 insertions, 1 deletions
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<long long> &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);
}