- double lat_bound = kernel::resource::NetworkModel::cfg_tcp_gamma / (2.0 * lat_current);
- XBT_DEBUG("action (%p) : lat_bound = %g", this, lat_bound);
- if ((latency_ <= 0.0) && is_running()) {
+ if (lat_current > 0) {
+ lat_bound = NetworkModel::cfg_tcp_gamma / (2.0 * lat_current);
+ }
+ return lat_bound;
+}
+
+double L07Action::calculate_cpu_bound() const
+{
+ double cpu_bound = std::numeric_limits<double>::max();
+
+ if (computation_amount_ == nullptr) {
+ return cpu_bound;
+ }
+
+ for (size_t i = 0; i < host_list_.size(); i++) {
+ if (computation_amount_[i] > 0) {
+ cpu_bound = std::min(cpu_bound, host_list_[i]->get_cpu()->get_speed(1.0) *
+ host_list_[i]->get_cpu()->get_speed_ratio() / computation_amount_[i]);
+ }
+ }
+ return cpu_bound;
+}
+
+void L07Action::update_bound() const
+{
+ double bound = std::min(calculate_network_bound(), calculate_cpu_bound());
+
+ XBT_DEBUG("action (%p) : bound = %g", this, bound);
+
+ /* latency has been paid (or no latency), we can set the appropriate bound for multicore or network limit */
+ if ((bound < std::numeric_limits<double>::max()) && (latency_ <= 0.0)) {