Skip to content

Commit

Permalink
#1938: have scheduler store current time and lb context use it for st…
Browse files Browse the repository at this point in the history
…art time
  • Loading branch information
stmcgovern committed Nov 15, 2022
1 parent 47f6ce2 commit 7f463fa
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/vt/context/runnable_context/lb_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ namespace vt { namespace ctx {
void LBData::begin() {
// record start time
if (should_instrument_) {
lb_data_->startTime();
TimeType current_time = theSched()->getCurrentTimeFromScheduler();
lb_data_->startTime(current_time);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/vt/elm/elm_lb_data.cc
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@

namespace vt { namespace elm {

void ElementLBData::startTime() {
TimeTypeWrapper const start_time = timing::getCurrentTime();
void ElementLBData::startTime(TimeType current_time) {
TimeTypeWrapper const start_time = current_time;
cur_time_ = start_time.seconds();
cur_time_started_ = true;

Expand Down
2 changes: 1 addition & 1 deletion src/vt/elm/elm_lb_data.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ struct ElementLBData {
ElementLBData(ElementLBData const&) = default;
ElementLBData(ElementLBData&&) = default;

void startTime();
void startTime(TimeType current_time);
void stopTime();
void addTime(TimeTypeWrapper const& time);

Expand Down
1 change: 1 addition & 0 deletions src/vt/scheduler/scheduler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,7 @@ void Scheduler::runProgress(bool msg_only, TimeType current_time) {
void Scheduler::runSchedulerOnceImpl(bool msg_only) {
if (special_progress_) {
auto current_time = timing::getCurrentTime();
current_sched_time_ = current_time;
auto time_since_last_progress = current_time - last_progress_time_;
if (shouldCallProgress(processed_after_last_progress_, time_since_last_progress)) {
runProgress(msg_only, current_time);
Expand Down
8 changes: 8 additions & 0 deletions src/vt/scheduler/scheduler.h
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,12 @@ struct Scheduler : runtime::component::Component<Scheduler> {
*/
ThreadManager* getThreadManager();
#endif
/**
* \brief return the time set at last scheduler call to getCurrentTime
*
* \return scheduler's current time
*/
TimeType getCurrentTimeFromScheduler(){ return current_sched_time_; }

template <typename SerializerT>
void serialize(SerializerT& s) {
Expand All @@ -348,6 +354,7 @@ struct Scheduler : runtime::component::Component<Scheduler> {
| event_triggers
| event_triggers_once
| last_progress_time_
| current_sched_time_
| progress_time_enabled_
| processed_after_last_progress_
| last_threshold_memory_usage_
Expand Down Expand Up @@ -417,6 +424,7 @@ struct Scheduler : runtime::component::Component<Scheduler> {
EventTriggerContType event_triggers_once;

TimeType last_progress_time_ = 0.0;
TimeType current_sched_time_ = 0.0;
bool progress_time_enabled_ = false;
int32_t processed_after_last_progress_ = 0;

Expand Down

0 comments on commit 7f463fa

Please sign in to comment.