WorkstationModelPtr surf_workstation_model = NULL;
-//FIXME:Faire hériter ou composer de cup et network
-
/*************
* CallBacks *
*************/
xbt_cfg_setdefault_boolean(_sg_cfg_set, "network/crosstraffic", "yes");
surf_cpu_model_init_Cas01();
surf_network_model_init_LegrandVelho();
+ surf_workstation_model->p_cpuModel = surf_cpu_model_pm;
ModelPtr model = static_cast<ModelPtr>(surf_workstation_model);
xbt_dynar_push(model_list, &model);
double min_by_cpu = p_cpuModel->shareResources(now);
double min_by_net = surf_network_model->shareResources(now);
-
- XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f",
- this, surf_cpu_model_pm->m_name.c_str(), min_by_cpu, surf_network_model->m_name.c_str(), min_by_net);
-
- if (min_by_cpu >= 0.0 && min_by_net >= 0.0)
- return min(min_by_cpu, min_by_net);
- else if (min_by_cpu >= 0.0)
- return min_by_cpu;
- else if (min_by_net >= 0.0)
- return min_by_net;
- else
- return min_by_cpu; /* probably min_by_cpu == min_by_net == -1 */
-}
-
-void WorkstationModel::updateActionsState(double now, double delta){
+ double min_by_sto = -1;
+ if (p_cpuModel == surf_cpu_model_pm)
+ min_by_sto = surf_storage_model->shareResources(now);
+
+ XBT_DEBUG("model %p, %s min_by_cpu %f, %s min_by_net %f, %s min_by_sto %f",
+ this, surf_cpu_model_pm->m_name.c_str(), min_by_cpu,
+ surf_network_model->m_name.c_str(), min_by_net,
+ surf_storage_model->m_name.c_str(), min_by_sto);
+
+ double res = max(max(min_by_cpu, min_by_net), min_by_sto);
+ if (min_by_cpu >= 0.0 && min_by_cpu < res)
+ res = min_by_cpu;
+ if (min_by_net >= 0.0 && min_by_net < res)
+ res = min_by_net;
+ if (min_by_sto >= 0.0 && min_by_sto < res)
+ res = min_by_sto;
+ return res;
+}
+
+void WorkstationModel::updateActionsState(double /*now*/, double /*delta*/){
return;
}
return -1;
}
-void WorkstationCLM03::updateState(tmgr_trace_event_t event_type, double value, double date){
+void WorkstationCLM03::updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/){
THROW_IMPOSSIBLE; /* This model does not implement parallel tasks */
}
return info;
}
+sg_size_t WorkstationCLM03::fileTell(surf_file_t fd){
+ return fd->current_position;
+}
+
+int WorkstationCLM03::fileSeek(surf_file_t fd, sg_size_t offset, int origin){
+
+ switch (origin) {
+ case SEEK_SET:
+ fd->current_position = 0;
+ return MSG_OK;
+ case SEEK_CUR:
+ if(offset > fd->size)
+ offset = fd->size;
+ fd->current_position = offset;
+ return MSG_OK;
+ case SEEK_END:
+ fd->current_position = fd->size;
+ return MSG_OK;
+ default:
+ return MSG_TASK_CANCELED;
+ }
+}
+
sg_size_t WorkstationCLM03::getFreeSize(const char* name)
{
StoragePtr st = findStorageOnMountList(name);