************/
Storage::Storage(ModelPtr model, const char *name, xbt_dict_t props,
- const char* type_id, char *content_name, char *content_type, sg_size_t size)
+ const char* type_id, char *content_name, char *content_type,
+ sg_size_t size)
: Resource(model, name, props)
, p_contentType(content_type)
, m_size(size), m_usedSize(0)
}
Storage::Storage(ModelPtr model, const char *name, xbt_dict_t props,
- lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
- const char* type_id, char *content_name, char *content_type, sg_size_t size, char *attach)
+ lmm_system_t maxminSystem, double bread, double bwrite,
+ double bconnection, const char* type_id, char *content_name,
+ char *content_type, sg_size_t size, char *attach)
: Resource(model, name, props, lmm_constraint_new(maxminSystem, this, bconnection))
, p_contentType(content_type)
, m_size(size), m_usedSize(0)
* @param storage The Storage associated to this StorageAction
* @param type [description]
*/
- StorageAction(ModelPtr model, double cost, bool failed,
- StoragePtr storage, e_surf_action_storage_type_t type);
+ StorageAction(ModelPtr model, double cost, bool failed, StoragePtr storage,
+ e_surf_action_storage_type_t type);
/**
* @brief StorageAction constructor
* @param type [description]
*/
StorageAction(ModelPtr model, double cost, bool failed, lmm_variable_t var,
- StoragePtr storage, e_surf_action_storage_type_t type);
+ StoragePtr storage, e_surf_action_storage_type_t type);
void setState(e_surf_action_state_t state);
}
StoragePtr StorageN11Model::createStorage(const char* id, const char* type_id,
- const char* content_name, const char* content_type, xbt_dict_t properties, const char* attach)
+ const char* content_name, const char* content_type, xbt_dict_t properties,
+ const char* attach)
{
xbt_assert(!surf_storage_resource_priv(surf_storage_resource_by_name(id)),
double Bconnection = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bconnection"));
StoragePtr storage = new StorageN11(this, id, properties, p_maxminSystem,
- Bread, Bwrite, Bconnection,
- type_id, (char *)content_name, xbt_strdup(content_type), storage_type->size, (char *) attach);
+ Bread, Bwrite, Bconnection, type_id, (char *)content_name,
+ xbt_strdup(content_type), storage_type->size, (char *) attach);
xbt_lib_set(storage_lib, id, SURF_STORAGE_LEVEL, storage);
Bread);
if(!p_storageList)
- p_storageList = xbt_dynar_new(sizeof(char *),NULL);
+ p_storageList = xbt_dynar_new(sizeof(char *),NULL);
xbt_dynar_push(p_storageList, &storage);
return storage;
* Resource *
************/
-StorageN11::StorageN11(StorageModelPtr model, const char* name, xbt_dict_t properties,
- lmm_system_t maxminSystem, double bread, double bwrite, double bconnection,
- const char* type_id, char *content_name, char *content_type, sg_size_t size, char *attach)
+StorageN11::StorageN11(StorageModelPtr model, const char* name,
+ xbt_dict_t properties, lmm_system_t maxminSystem, double bread,
+ double bwrite, double bconnection, const char* type_id, char *content_name,
+ char *content_type, sg_size_t size, char *attach)
: Storage(model, name, properties,
maxminSystem, bread, bwrite, bconnection, type_id, content_name, content_type, size, attach) {
XBT_DEBUG("Create resource with Bconnection '%f' Bread '%f' Bwrite '%f' and Size '%llu'", bconnection, bread, bwrite, size);
surf_callback(void, void) surfExitCallbacks;
s_surf_model_description_t surf_plugin_description[] = {
- {"Energy",
- "Cpu energy consumption.",
- sg_energy_plugin_init},
- {NULL, NULL, NULL} /* this array must be NULL terminated */
+ {"Energy",
+ "Cpu energy consumption.",
+ sg_energy_plugin_init},
+ {NULL, NULL, NULL} /* this array must be NULL terminated */
};
/* Don't forget to update the option description in smx_config when you change this */
{
//FIXME: set the good function once and for all
if (p_updateMechanism == UM_LAZY)
- return shareResourcesLazy(now);
+ return shareResourcesLazy(now);
else if (p_updateMechanism == UM_FULL)
- return shareResourcesFull(now);
+ return shareResourcesFull(now);
else
- xbt_die("Invalid cpu update mechanism!");
+ xbt_die("Invalid cpu update mechanism!");
}
double Model::shareResourcesLazy(double now)
ActionList::iterator it(running_actions->begin()), itend(running_actions->end());
for(; it != itend ; ++it) {
- action = &*it;
+ action = &*it;
value = lmm_variable_getvalue(action->getVariable());
if ((value > 0) || (action->getMaxDuration() >= 0))
break;
xbt_dict_t Resource::getProperties() {
if (p_properties==NULL)
- p_properties = xbt_dict_new();
+ p_properties = xbt_dict_new();
return p_properties;
}
p_stateSet = NULL;
if (p_stateSet)
- p_stateSet->push_back(*this);
+ p_stateSet->push_back(*this);
XBT_OUT();
}
lmm_update_variable_bound(getModel()->getMaxminSystem(), getVariable(), bound);
if (getModel()->getUpdateMechanism() == UM_LAZY && getLastUpdate()!=surf_get_clock())
- heapRemove(getModel()->getActionHeap());
+ heapRemove(getModel()->getActionHeap());
XBT_OUT();
}
void Action::cancel(){
setState(SURF_ACTION_FAILED);
if (getModel()->getUpdateMechanism() == UM_LAZY) {
- if (actionLmmHook::is_linked())
- getModel()->getModifiedSet()->erase(getModel()->getModifiedSet()->iterator_to(*this));
+ if (actionLmmHook::is_linked())
+ getModel()->getModifiedSet()->erase(getModel()->getModifiedSet()->iterator_to(*this));
heapRemove(getModel()->getActionHeap());
}
}
int Action::unref(){
m_refcount--;
if (!m_refcount) {
- if (actionHook::is_linked())
- p_stateSet->erase(p_stateSet->iterator_to(*this));
- if (getVariable())
- lmm_variable_free(getModel()->getMaxminSystem(), getVariable());
- if (getModel()->getUpdateMechanism() == UM_LAZY) {
- /* remove from heap */
- heapRemove(getModel()->getActionHeap());
+ if (actionHook::is_linked())
+ p_stateSet->erase(p_stateSet->iterator_to(*this));
+ if (getVariable())
+ lmm_variable_free(getModel()->getMaxminSystem(), getVariable());
+ if (getModel()->getUpdateMechanism() == UM_LAZY) {
+ /* remove from heap */
+ heapRemove(getModel()->getActionHeap());
if (actionLmmHook::is_linked())
- getModel()->getModifiedSet()->erase(getModel()->getModifiedSet()->iterator_to(*this));
+ getModel()->getModifiedSet()->erase(getModel()->getModifiedSet()->iterator_to(*this));
}
- delete this;
- return 1;
+ delete this;
+ return 1;
}
return 0;
}
* @param netElm The RoutingEdge associated to this Workstation
* @param cpu The Cpu associated to this Workstation
*/
- Workstation(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
- xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu);
+ Workstation(ModelPtr model, const char *name, xbt_dict_t props,
+ lmm_constraint_t constraint, xbt_dynar_t storage, RoutingEdgePtr netElm,
+ CpuPtr cpu);
/**
* @brief Workstation destructor