File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change 2828#include < geode/basic/common.hpp>
2929#include < geode/basic/pimpl.hpp>
3030
31+ namespace absl
32+ {
33+ class Duration ;
34+ } // namespace absl
35+
3136namespace geode
3237{
3338 class opengeode_basic_api ProgressLogger
@@ -44,6 +49,8 @@ namespace geode
4449
4550 index_t increment_nb_steps ( index_t nb_steps );
4651
52+ void set_refresh_interval ( absl::Duration refresh_interval );
53+
4754 private:
4855 IMPLEMENTATION_MEMBER ( impl_ );
4956 };
Original file line number Diff line number Diff line change 3232#include < geode/basic/progress_logger_manager.hpp>
3333#include < geode/basic/uuid.hpp>
3434
35- namespace
36- {
37- constexpr absl::Duration SLEEP = absl::Seconds( 1 );
38- } // namespace
39-
4035namespace geode
4136{
4237 class ProgressLogger ::Impl
@@ -65,7 +60,7 @@ namespace geode
6560 const std::lock_guard< std::mutex > locking{ lock_ };
6661 current_ += nb_increments;
6762 auto now = absl::Now ();
68- if ( now - current_time_ > SLEEP )
63+ if ( now - current_time_ > refresh_interval_ )
6964 {
7065 current_time_ = now;
7166 ProgressLoggerManager::update ( id_, current_, nb_steps_ );
@@ -80,12 +75,18 @@ namespace geode
8075 return nb_steps_;
8176 }
8277
78+ void set_refresh_interval ( absl::Duration refresh_interval )
79+ {
80+ refresh_interval_ = std::move ( refresh_interval );
81+ }
82+
8383 private:
8484 uuid id_;
8585 index_t nb_steps_;
8686 index_t current_{ 0 };
8787 absl::Time current_time_;
8888 std::mutex lock_;
89+ absl::Duration refresh_interval_{ absl::Seconds ( 1 ) };
8990 };
9091
9192 ProgressLogger::ProgressLogger (
@@ -115,4 +116,9 @@ namespace geode
115116 {
116117 return impl_->increment_nb_steps ( nb_steps );
117118 }
119+
120+ void ProgressLogger::set_refresh_interval ( absl::Duration refresh_interval )
121+ {
122+ impl_->set_refresh_interval ( std::move ( refresh_interval ) );
123+ }
118124} // namespace geode
You can’t perform that action at this time.
0 commit comments