From eb751b95942cdeafc02915c4289add5232513afb Mon Sep 17 00:00:00 2001 From: Frederic Suter Date: Mon, 8 Feb 2021 23:15:04 +0100 Subject: [PATCH] fix Exec::get_start_time() --- include/simgrid/s4u/Exec.hpp | 4 +++- src/s4u/s4u_Exec.cpp | 5 +---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/simgrid/s4u/Exec.hpp b/include/simgrid/s4u/Exec.hpp index 6cb7870cbb..afc242f094 100644 --- a/include/simgrid/s4u/Exec.hpp +++ b/include/simgrid/s4u/Exec.hpp @@ -37,6 +37,8 @@ class XBT_PUBLIC Exec : public Activity_T { std::vector bytes_amounts_; std::vector hosts_; bool parallel_ = false; + double start_time_ = -1.0; + double finish_time_ = -1.0; Exec(); public: @@ -77,7 +79,7 @@ public: Exec* cancel() override; Host* get_host() const; unsigned int get_host_number() const; - double get_start_time() const; + double get_start_time() const { return start_time_; } double get_finish_time() const; double get_cost() const; bool is_parallel() const { return parallel_; } diff --git a/src/s4u/s4u_Exec.cpp b/src/s4u/s4u_Exec.cpp index bc50765496..731631f901 100644 --- a/src/s4u/s4u_Exec.cpp +++ b/src/s4u/s4u_Exec.cpp @@ -116,10 +116,6 @@ unsigned int Exec::get_host_number() const { return static_cast(pimpl_.get())->get_host_number(); } -double Exec::get_start_time() const -{ - return (pimpl_->surf_action_ == nullptr) ? -1 : pimpl_->surf_action_->get_start_time(); -} double Exec::get_finish_time() const { return (pimpl_->surf_action_ == nullptr) ? -1 : pimpl_->surf_action_->get_finish_time(); @@ -205,6 +201,7 @@ Exec* Exec::start() pimpl_->suspend(); state_ = State::STARTED; + start_time_ = pimpl_->surf_action_->get_start_time(); on_start(*this); return this; } -- 2.20.1