Activity* set_remaining(double remains);
/** Put some user data onto the Activity */
- Activity* set_user_data(void* data)
- {
- user_data_ = data;
- return this;
- }
- /** Retrieve the user data of the Activity */
- void* get_user_data() { return user_data_; }
- kernel::activity::ActivityImplPtr get_impl() { return pimpl_; }
-
- #ifndef DOXYGEN
- XBT_ATTRIB_DEPRECATED_v324("Please use Activity::wait_for()") virtual void wait(double timeout) = 0;
- XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_state()") Activity::State getState() { return state_; }
- XBT_ATTRIB_DEPRECATED_v323("Please use Activity::get_remaining()") double getRemains() { return get_remaining(); }
- XBT_ATTRIB_DEPRECATED_v323("Please use Activity::set_remaining()") Activity* setRemains(double remains)
- {
- return set_remaining(remains);
- }
- #endif
+ kernel::activity::ActivityImpl* get_impl() const { return pimpl_.get(); }
private:
kernel::activity::ActivityImplPtr pimpl_ = nullptr;
void (*clean_fun_)(void*) = nullptr;
void (*copy_data_function_)(kernel::activity::CommImpl*, void*, size_t) = nullptr;
- Comm() : Activity() {}
+ Comm() = default;
public:
+ #ifndef DOXYGEN
friend XBT_PUBLIC void intrusive_ptr_release(Comm* c);
friend XBT_PUBLIC void intrusive_ptr_add_ref(Comm* c);
friend Mailbox; // Factory of comms
bool test() override;
ExecPtr set_bound(double bound);
- ExecPtr set_name(const std::string& name);
ExecPtr set_priority(double priority);
- ExecPtr set_tracing_category(const std::string& category);
ExecPtr set_timeout(double timeout);
Exec* cancel() override;
-
- XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_priority()") ExecPtr setPriority(double priority)
- {
- return set_priority(priority);
- }
- XBT_ATTRIB_DEPRECATED_v323("Please use Exec::set_bound()") ExecPtr setBound(double bound) { return set_bound(bound); }
- XBT_ATTRIB_DEPRECATED_v324("Please use Exec::wait_for()") void wait(double t) override { wait_for(t); }
+ const std::string& get_name() const { return name_; }
+ const char* get_cname() const { return name_.c_str(); }
+ Host* get_host() const;
+ unsigned int get_host_number() const;
+ double get_start_time() const;
+ double get_finish_time() const;
+ double get_cost() const;
};
class XBT_PUBLIC ExecSeq : public Exec {
/** I/O Activity, representing the asynchronous disk access.
*
- * They are generated from Storage::io_init() or Storage::read() and Storage::write().
+ * They are generated from Disk::io_init(), Disk::read() Disk::read_async(), Disk::write() and Disk::write_async().
*/
-class XBT_PUBLIC Io : public Activity {
+class XBT_PUBLIC Io : public Activity_T<Io> {
public:
enum class OpType { READ, WRITE };
private:
Storage* storage_ = nullptr;
+ Disk* disk_ = nullptr;
sg_size_t size_ = 0;
OpType type_ = OpType::READ;
- std::string name_ = "";
std::atomic_int_fast32_t refcount_{0};
explicit Io(sg_storage_t storage, sg_size_t size, OpType type);
return this;
}
+ CommPtr Comm::set_tracing_category(const std::string& category)
+ {
+ xbt_assert(state_ == State::INITED, "Cannot change the tracing category of an exec after its start");
+ tracing_category_ = category;
+ return this;
+ }
+
Comm* Comm::start()
{
- xbt_assert(state_ == State::INITED, "You cannot use %s() once your communication started (not implemented)",
+ xbt_assert(get_state() == State::INITED, "You cannot use %s() once your communication started (not implemented)",
__FUNCTION__);
if (src_buff_ != nullptr) { // Sender side
return this;
}
-ExecPtr Exec::set_name(const std::string& name)
-{
- xbt_assert(state_ == State::INITED, "Cannot change the name of an exec after its start");
- name_ = name;
- return this;
-}
-
+ Host* Exec::get_host() const
+ {
+ return static_cast<kernel::activity::ExecImpl*>(pimpl_.get())->get_host();
+ }
+ unsigned int Exec::get_host_number() const
+ {
+ return static_cast<kernel::activity::ExecImpl*>(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();
+ }
+ double Exec::get_cost() const
+ {
+ return (pimpl_->surf_action_ == nullptr) ? -1 : pimpl_->surf_action_->get_cost();
+ }
+
/** @brief Change the execution priority, don't you think?
*
* An execution with twice the priority will get twice the amount of flops when the resource is shared.