surf_cpu_model_vm = new CpuCas01Model();
cpu_define_callbacks();
- ModelPtr model_pm = static_cast<ModelPtr>(surf_cpu_model_pm);
- ModelPtr model_vm = static_cast<ModelPtr>(surf_cpu_model_vm);
+ ModelPtr model_pm = surf_cpu_model_pm;
+ ModelPtr model_vm = surf_cpu_model_vm;
xbt_dynar_push(model_list, &model_pm);
xbt_dynar_push(model_list, &model_vm);
}
xbt_assert(core > 0, "Invalid number of cores %d", core);
cpu = new CpuCas01(this, name, power_peak, pstate, power_scale, power_trace, core, state_initial, state_trace, cpu_properties);
- xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, static_cast<ResourcePtr>(cpu));
+ xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
return cpu;
}
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
- host->setStateEvent(tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(host)));
+ host->setStateEvent(tmgr_history_add_trace(history, trace, 0.0, 0, host));
}
xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
- host->setPowerEvent(tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(host)));
+ host->setPowerEvent(tmgr_history_add_trace(history, trace, 0.0, 0, host));
}
}
m_core = core;
setState(stateInitial);
if (powerTrace)
- p_powerEvent = tmgr_history_add_trace(history, powerTrace, 0.0, 0, static_cast<ResourcePtr>(this));
+ p_powerEvent = tmgr_history_add_trace(history, powerTrace, 0.0, 0, this);
if (stateTrace)
- p_stateEvent = tmgr_history_add_trace(history, stateTrace, 0.0, 0, static_cast<ResourcePtr>(this));
+ p_stateEvent = tmgr_history_add_trace(history, stateTrace, 0.0, 0, this);
}
CpuCas01::~CpuCas01(){
#endif
while ((var = lmm_get_var_from_cnst
(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
- CpuCas01ActionPtr action = static_cast<CpuCas01ActionPtr>(static_cast<ActionPtr>(lmm_variable_id(var)));
+ CpuCas01ActionPtr action = static_cast<CpuCas01ActionPtr>(lmm_variable_id(var));
lmm_update_variable_bound(getModel()->getMaxminSystem(),
action->getVariable(),
CpuCas01Action::CpuCas01Action(ModelPtr model, double cost, bool failed, double power, lmm_constraint_t constraint)
: CpuAction(model, cost, failed,
- lmm_variable_new(model->getMaxminSystem(), static_cast<ActionPtr>(this),
+ lmm_variable_new(model->getMaxminSystem(), this,
1.0, power, 1))
{
m_suspended = 0;
CpuActionPtr action;
while ((xbt_heap_size(getActionHeap()) > 0)
&& (double_equals(xbt_heap_maxkey(getActionHeap()), now, sg_surf_precision))) {
- action = static_cast<CpuActionPtr>(static_cast<ActionPtr>(xbt_heap_pop(getActionHeap())));
+ action = static_cast<CpuActionPtr>(xbt_heap_pop(getActionHeap()));
XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
#ifdef HAVE_TRACING
if (TRACE_is_enabled()) {
continue;
}
XBT_DEBUG("Add state trace: %s to CPU(%s)", trace_name, elm);
- cpu->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(cpu));
+ cpu->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, cpu);
}
xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
empty_trace = tmgr_empty_trace_new();
cpu->p_powerEvent =
tmgr_history_add_trace(history, empty_trace,
- cpu->p_availTrace->m_lastTime, 0, static_cast<ResourcePtr>(cpu));
+ cpu->p_availTrace->m_lastTime, 0, cpu);
}
}
}
p_modifiedCpuHookup.next = 0;
if (stateTrace)
- p_stateEvent = tmgr_history_add_trace(history, stateTrace, 0.0, 0, static_cast<ResourcePtr>(this));
+ p_stateEvent = tmgr_history_add_trace(history, stateTrace, 0.0, 0, this);
if (powerTrace && xbt_dynar_length(powerTrace->s_list.event_list) > 1) {
// add a fake trace event if periodicity == 0
xbt_dynar_get_cpy(powerTrace->s_list.event_list,
empty_trace = tmgr_empty_trace_new();
p_powerEvent =
tmgr_history_add_trace(history, empty_trace,
- p_availTrace->m_lastTime, 0, static_cast<ResourcePtr>(this));
+ p_availTrace->m_lastTime, 0, this);
}
}
};
value, date);
/* update remaining of actions and put in modified cpu swag */
updateRemainingAmount(date);
- xbt_swag_insert(this, reinterpret_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
+ xbt_swag_insert(this, static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
power_trace = p_availTrace->p_powerTrace;
xbt_dynar_get_cpy(power_trace->s_list.event_list,
action->setState(SURF_ACTION_FAILED);
if (action->m_indexHeap >= 0) {
CpuTiActionPtr heap_act = (CpuTiActionPtr)
- xbt_heap_remove(reinterpret_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action->m_indexHeap);
+ xbt_heap_remove(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action->m_indexHeap);
if (heap_act != action)
DIE_IMPOSSIBLE;
}
XBT_DEBUG("action(%p) index %d", action, action->m_indexHeap);
if (action->m_indexHeap >= 0) {
CpuTiActionPtr heap_act = (CpuTiActionPtr)
- xbt_heap_remove(reinterpret_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action->m_indexHeap);
+ xbt_heap_remove(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action->m_indexHeap);
if (heap_act != action)
DIE_IMPOSSIBLE;
}
if (min_finish != NO_MAX_DURATION)
- xbt_heap_push(reinterpret_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action, min_finish);
+ xbt_heap_push(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action, min_finish);
XBT_DEBUG
("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f",
action->getMaxDuration());
}
/* remove from modified cpu */
- xbt_swag_remove(this, reinterpret_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
+ xbt_swag_remove(this, static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
}
bool CpuTi::isUsed()
/* Move to the *end* of the corresponding action set. This convention
is used to speed up update_resource_state */
action->getStateSet()->erase(action->getStateSet()->iterator_to(*action));
- action->p_stateSet = reinterpret_cast<CpuTiModelPtr>(getModel())->p_runningActionSetThatDoesNotNeedBeingChecked;
- action->getStateSet()->push_back(*static_cast<ActionPtr>(action));
+ action->p_stateSet = static_cast<CpuTiModelPtr>(getModel())->p_runningActionSetThatDoesNotNeedBeingChecked;
+ action->getStateSet()->push_back(*action);
}
xbt_swag_insert(action, p_actionSet);
calloc but it seems to help valgrind... */
p_cpu = cpu;
m_indexHeap = -1;
- xbt_swag_insert(cpu, reinterpret_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
+ xbt_swag_insert(cpu, static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
}
void CpuTiAction::updateIndexHeap(int i)
void CpuTiAction::setState(e_surf_action_state_t state)
{
CpuAction::setState(state);
- xbt_swag_insert(p_cpu, reinterpret_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
+ xbt_swag_insert(p_cpu, static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
}
int CpuTiAction::unref()
/* remove from action_set */
xbt_swag_remove(this, p_cpu->p_actionSet);
/* remove from heap */
- xbt_heap_remove(reinterpret_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, this->m_indexHeap);
- xbt_swag_insert(p_cpu, reinterpret_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
+ xbt_heap_remove(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, this->m_indexHeap);
+ xbt_swag_insert(p_cpu, static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
delete this;
return 1;
}
{
this->setState(SURF_ACTION_FAILED);
xbt_heap_remove(getModel()->getActionHeap(), this->m_indexHeap);
- xbt_swag_insert(p_cpu, reinterpret_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
+ xbt_swag_insert(p_cpu, static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
return;
}
if (m_suspended != 2) {
m_suspended = 1;
xbt_heap_remove(getModel()->getActionHeap(), m_indexHeap);
- xbt_swag_insert(p_cpu, reinterpret_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
+ xbt_swag_insert(p_cpu, static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
}
XBT_OUT();
}
XBT_IN("(%p)", this);
if (m_suspended != 2) {
m_suspended = 0;
- xbt_swag_insert(p_cpu, reinterpret_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
+ xbt_swag_insert(p_cpu, static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
}
XBT_OUT();
}
{
XBT_IN("(%p,%g)", this, priority);
m_priority = priority;
- xbt_swag_insert(p_cpu, reinterpret_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
+ xbt_swag_insert(p_cpu, static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu);
XBT_OUT();
}
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
- ModelPtr model = static_cast<ModelPtr>(surf_network_model);
+ ModelPtr model = surf_network_model;
xbt_dynar_push(model_list, &model);
xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
- ModelPtr model = static_cast<ModelPtr>(surf_network_model);
+ ModelPtr model = surf_network_model;
xbt_dynar_push(model_list, &model);
xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 1.0);
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
- ModelPtr model = static_cast<ModelPtr>(surf_network_model);
+ ModelPtr model = surf_network_model;
xbt_dynar_push(model_list, &model);
lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
func_reno_fpi);
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
- ModelPtr model = static_cast<ModelPtr>(surf_network_model);
+ ModelPtr model = surf_network_model;
xbt_dynar_push(model_list, &model);
lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp,
func_reno2_fpi);
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
- ModelPtr model = static_cast<ModelPtr>(surf_network_model);
+ ModelPtr model = surf_network_model;
xbt_dynar_push(model_list, &model);
lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp,
func_vegas_fpi);
p_maxminSystem = lmm_system_new(m_selectiveUpdate);
const char* lb_name = "__loopback__";
- routing_model_create(static_cast<ResourcePtr>(createNetworkLink(lb_name,
+ routing_model_create(createNetworkLink(lb_name,
498000000, NULL, 0.000015, NULL,
SURF_RESOURCE_ON, NULL,
- SURF_LINK_FATPIPE, NULL)));
+ SURF_LINK_FATPIPE, NULL));
if (p_updateMechanism == UM_LAZY) {
p_actionHeap = xbt_heap_new(8, NULL);
state_initial, state_trace, bw_initial, bw_trace, lat_initial, lat_trace, policy);
- xbt_lib_set(link_lib, name, SURF_LINK_LEVEL, static_cast<ResourcePtr>(nw_link));
+ xbt_lib_set(link_lib, name, SURF_LINK_LEVEL, nw_link);
XBT_DEBUG("Create link '%s'",name);
return nw_link;
constraints_per_variable += xbt_dynar_length(back_route);
if (action->m_latency > 0) {
- action->p_variable = lmm_variable_new(p_maxminSystem, static_cast<ActionPtr>(action), 0.0, -1.0,
+ action->p_variable = lmm_variable_new(p_maxminSystem, action, 0.0, -1.0,
constraints_per_variable);
if (p_updateMechanism == UM_LAZY) {
// add to the heap the event when the latency is payed
action->heapInsert(p_actionHeap, action->m_latency + action->m_lastUpdate, xbt_dynar_is_empty(route) ? NORMAL : LATENCY);
}
} else
- action->p_variable = lmm_variable_new(p_maxminSystem, static_cast<ActionPtr>(action), 1.0, -1.0, constraints_per_variable);
+ action->p_variable = lmm_variable_new(p_maxminSystem, action, 1.0, -1.0, constraints_per_variable);
if (action->m_rate < 0) {
lmm_update_variable_bound(p_maxminSystem, action->getVariable(), (action->m_latCurrent > 0) ? sg_tcp_gamma / (2.0 * action->m_latCurrent) : -1.0);
"Cannot connect trace %s to link %s: trace undefined",
trace_name, elm);
- link->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(link));
+ link->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link);
}
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
"Cannot connect trace %s to link %s: trace undefined",
trace_name, elm);
- link->p_power.event = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(link));
+ link->p_power.event = tmgr_history_add_trace(history, trace, 0.0, 0, link);
}
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
"Cannot connect trace %s to link %s: trace undefined",
trace_name, elm);
- link->p_latEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(link));
+ link->p_latEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link);
}
}
p_power.scale = 1.0;
p_power.peak = metric_peak;
if (metric_trace)
- p_power.event = tmgr_history_add_trace(history, metric_trace, 0.0, 0, static_cast<ResourcePtr>(this));
+ p_power.event = tmgr_history_add_trace(history, metric_trace, 0.0, 0, this);
else
p_power.event = NULL;
m_latCurrent = lat_initial;
if (lat_trace)
- p_latEvent = tmgr_history_add_trace(history, lat_trace, 0.0, 0, static_cast<ResourcePtr>(this));
+ p_latEvent = tmgr_history_add_trace(history, lat_trace, 0.0, 0, this);
if (policy == SURF_LINK_FATPIPE)
lmm_constraint_shared(getConstraint());
sg_platf_host_add_cb(netcste_count_hosts);
- ModelPtr model = static_cast<ModelPtr>(surf_network_model);
+ ModelPtr model = surf_network_model;
xbt_dynar_push(model_list, &model);
}
{
surf_callback_emit(networkLinkCreatedCallbacks, this);
if (state_trace)
- p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, static_cast<ResourcePtr>(this));
+ p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, this);
}
NetworkLink::~NetworkLink()
* @brief Callbacks handler which emit the callbacks after Storage creation *
* @details Callback functions have the following signature: `void(StoragePtr)`
*/
-extern surf_callback(void, StoragePtr) storageCreatedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, StoragePtr)) storageCreatedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Storage destruction *
* @details Callback functions have the following signature: `void(StoragePtr)`
*/
-extern surf_callback(void, StoragePtr) storageDestructedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, StoragePtr)) storageDestructedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Storage State changed *
* @details Callback functions have the following signature: `void(StorageActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
*/
-extern surf_callback(void, StoragePtr, e_surf_resource_state_t, e_surf_resource_state_t) storageStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, StoragePtr, e_surf_resource_state_t, e_surf_resource_state_t)) storageStateChangedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after StorageAction State changed *
* @details Callback functions have the following signature: `void(StorageActionPtr action, e_surf_action_state_t old, e_surf_action_state_t current)`
*/
-extern surf_callback(void, StorageActionPtr, e_surf_action_state_t, e_surf_action_state_t) storageActionStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, StorageActionPtr, e_surf_action_state_t, e_surf_action_state_t)) storageActionStateChangedCallbacks;
/*********
* Model *
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, static_cast<ResourcePtr>(storage));
+ xbt_lib_set(storage_lib, id, SURF_STORAGE_LEVEL, storage);
XBT_DEBUG("SURF storage create resource\n\t\tid '%s'\n\t\ttype '%s'\n\t\tproperties '%p'\n\t\tBread '%f'\n",
id,
StorageActionPtr write_action;
unsigned int i;
xbt_dynar_foreach(p_writeActions, i, _write_action) {
- write_action = static_cast<StorageActionPtr>(static_cast<ActionPtr>(_write_action));
+ write_action = static_cast<StorageActionPtr>(_write_action);
if ((write_action->p_file) == fd) {
xbt_dynar_cursor_rm(p_writeActions, &i);
write_action->unref();
{
double delta = 0.0;
- if(getModel() == static_cast<ModelPtr>(surf_network_model))
+ if(getModel() == surf_network_model)
{
if (m_suspended != 0)
return;
double_update(&m_remains, m_lastValue * delta, sg_surf_precision*sg_maxmin_precision);
#ifdef HAVE_TRACING
- if (getModel() == static_cast<ModelPtr>(surf_cpu_model_pm) && TRACE_is_enabled()) {
+ if (getModel() == surf_cpu_model_pm && TRACE_is_enabled()) {
ResourcePtr cpu = static_cast<ResourcePtr>(lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0)));
TRACE_surf_host_set_utilization(cpu->getName(), getCategory(), m_lastValue, m_lastUpdate, now - m_lastUpdate);
}
XBT_DEBUG("Updating action(%p): remains is now %f", this, m_remains);
}
- if(getModel() == static_cast<ModelPtr>(surf_network_model))
+ if(getModel() == surf_network_model)
{
if (m_maxDuration != NO_MAX_DURATION)
double_update(&m_maxDuration, delta, sg_surf_precision);
void surf_vm_workstation_model_init_HL13(void){
if (surf_cpu_model_vm) {
surf_vm_workstation_model = new WorkstationVMHL13Model();
- ModelPtr model = static_cast<ModelPtr>(surf_vm_workstation_model);
+ ModelPtr model = surf_vm_workstation_model;
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
{
WorkstationVMHL13Ptr ws = new WorkstationVMHL13(this, name, NULL, ind_phys_workstation);
- xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, static_cast<ResourcePtr>(ws));
+ xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, ws);
/* TODO:
* - check how network requests are scheduled between distinct processes competing for the same card.
/* 0. Make sure that we already calculated the resource share at the physical
* machine layer. */
{
- ModelPtr ws_model = static_cast<ModelPtr>(surf_workstation_model);
- ModelPtr vm_ws_model = static_cast<ModelPtr>(surf_vm_workstation_model);
+ ModelPtr ws_model = surf_workstation_model;
+ ModelPtr vm_ws_model = surf_vm_workstation_model;
unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, &ws_model);
unsigned int index_of_vm_ws_model = xbt_dynar_search(model_list_invoke, &vm_ws_model);
xbt_assert((index_of_pm_ws_model < index_of_vm_ws_model), "Cannot assume surf_workstation_model comes before");
iter != WorkstationVMModel::ws_vms.end(); ++iter) {
WorkstationVMPtr ws_vm = &*iter;
- CpuPtr cpu = static_cast<CpuPtr>(ws_vm->p_cpu);
+ CpuPtr cpu = ws_vm->p_cpu;
xbt_assert(cpu, "cpu-less workstation");
- double solved_value = get_solved_value(static_cast<CpuActionPtr>(ws_vm->p_action));
+ double solved_value = get_solved_value(ws_vm->p_action);
XBT_DEBUG("assign %f to vm %s @ pm %s", solved_value,
ws_vm->getName(), ws_vm->p_subWs->getName());
// TODO: check lmm_update_constraint_bound() works fine instead of the below manual substitution.
// cpu_cas01->constraint->bound = solved_value;
- xbt_assert(cpu->getModel() == static_cast<ModelPtr>(surf_cpu_model_vm));
+ xbt_assert(cpu->getModel() == surf_cpu_model_vm);
lmm_system_t vcpu_system = cpu->getModel()->getMaxminSystem();
lmm_update_constraint_bound(vcpu_system, cpu->getConstraint(), virt_overhead * solved_value);
}
/* We can assume one core and cas01 cpu for the first step.
* Do xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu) if you get the resource. */
- p_cpu = static_cast<CpuCas01ModelPtr>(surf_cpu_model_vm)->createCpu(name, // name
+ p_cpu = surf_cpu_model_vm->createCpu(name, // name
sub_cpu->getPowerPeakList(), // host->power_peak,
sub_cpu->getPState(),
1, // host->power_scale,
/* We create cpu_action corresponding to a VM process on the host operating system. */
/* FIXME: TODO: we have to peridocally input GUESTOS_NOISE to the system? how ? */
// vm_ws->cpu_action = surf_cpu_model_pm->extension.cpu.execute(ind_phys_workstation, GUESTOS_NOISE);
- p_action = static_cast<CpuActionPtr>(sub_cpu->execute(0));
+ p_action = sub_cpu->execute(0);
/* The SURF_WKS_LEVEL at host_lib saves workstation_CLM03 objects. Please
* note workstation_VM2013 objects, inheriting the workstation_CLM03
surf_network_model_init_LegrandVelho();
surf_workstation_model->p_cpuModel = surf_cpu_model_pm;
- ModelPtr model = static_cast<ModelPtr>(surf_workstation_model);
+ ModelPtr model = surf_workstation_model;
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(workstation_parse_init);
xbt_assert(surf_network_model, "No network model defined yet!");
surf_workstation_model = new WorkstationCLM03Model();
- ModelPtr model = static_cast<ModelPtr>(surf_workstation_model);
+ ModelPtr model = surf_workstation_model;
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(workstation_parse_init);
(RoutingEdgePtr)xbt_lib_get_or_null(host_lib, name, ROUTING_HOST_LEVEL),
static_cast<CpuPtr>(xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL)));
XBT_DEBUG("Create workstation %s with %ld mounted disks", name, xbt_dynar_length(workstation->p_storage));
- xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, static_cast<ResourcePtr>(workstation));
+ xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, workstation);
return workstation;
}
if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) {
StoragePtr storage = static_cast<StoragePtr>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
if(!strcmp((const char*)storage->p_attach,this->getName())){
- xbt_dynar_push_as(result, void *,(void *)static_cast<ResourcePtr>(storage)->getName());
+ xbt_dynar_push_as(result, void *, (void*)storage->getName());
}
}
}
* @brief Callbacks handler which emit the callbacks after Workstation creation *
* @details Callback functions have the following signature: `void(WorkstationPtr)`
*/
-extern surf_callback(void, WorkstationPtr) workstationCreatedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, WorkstationPtr)) workstationCreatedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Workstation destruction *
* @details Callback functions have the following signature: `void(WorkstationPtr)`
*/
-extern surf_callback(void, WorkstationPtr) workstationDestructedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, WorkstationPtr)) workstationDestructedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Workstation State changed *
* @details Callback functions have the following signature: `void(WorkstationActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
*/
-extern surf_callback(void, WorkstationPtr, e_surf_resource_state_t, e_surf_resource_state_t) workstationStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, WorkstationPtr, e_surf_resource_state_t, e_surf_resource_state_t)) workstationStateChangedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after WorkstationAction State changed *
* @details Callback functions have the following signature: `void(WorkstationActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
*/
-extern surf_callback(void, WorkstationActionPtr, e_surf_action_state_t, e_surf_action_state_t) workstationActionStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, WorkstationActionPtr, e_surf_action_state_t, e_surf_action_state_t)) workstationActionStateChangedCallbacks;
/*********
* Tools *
*********/
-extern WorkstationModelPtr surf_workstation_model;
+XBT_PUBLIC_DATA(WorkstationModelPtr) surf_workstation_model;
XBT_PUBLIC(void) workstation_parse_init(sg_platf_host_cbarg_t host);
XBT_PUBLIC(void) workstation_add_traces();
surf_workstation_model = NULL;
surf_network_model = new NetworkL07Model();
surf_cpu_model_pm = new CpuL07Model();
- routing_model_create(static_cast<ResourcePtr>(surf_network_model->createNetworkLink("__loopback__",
+ routing_model_create(surf_network_model->createNetworkLink("__loopback__",
498000000, NULL,
0.000015, NULL,
SURF_RESOURCE_ON, NULL,
- SURF_LINK_FATPIPE, NULL)));
+ SURF_LINK_FATPIPE, NULL));
p_cpuModel = surf_cpu_model_pm;
}
for (i = 0; i < workstation_nb; i++)
lmm_expand(ptask_maxmin_system,
- static_cast<CpuPtr>(static_cast<WorkstationL07Ptr>(workstation_list[i])->p_cpu)->getConstraint(),
+ static_cast<WorkstationL07Ptr>(workstation_list[i])->p_cpu->getConstraint(),
action->getVariable(), computation_amount[i]);
for (i = 0; i < workstation_nb; i++) {
action->setRemains(0.0);
}
- return static_cast<ActionPtr>(action);
+ return action;
}
WorkstationPtr WorkstationL07Model::createWorkstation(const char *name)
static_cast<RoutingEdgePtr>(xbt_lib_get_or_null(host_lib, name, ROUTING_HOST_LEVEL)),
static_cast<CpuPtr>(xbt_lib_get_or_null(host_lib, name, SURF_CPU_LEVEL)));
- xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, static_cast<ResourcePtr>(wk));
+ xbt_lib_set(host_lib, name, SURF_WKS_LEVEL, wk);
return wk;//FIXME:xbt_lib_get_elm_or_null(host_lib, name);
}
double *communication_amount = xbt_new0(double, 4);
ActionPtr res = NULL;
- workstation_list[0] = static_cast<ResourcePtr>(src);
- workstation_list[1] = static_cast<ResourcePtr>(dst);
+ workstation_list[0] = src;
+ workstation_list[1] = dst;
communication_amount[1] = size;
res = executeParallelTask(2, workstation_list,
power_initial, power_scale, power_trace,
core, state_initial, state_trace);
- xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, static_cast<ResourcePtr>(cpu));
+ xbt_lib_set(host_lib, name, SURF_CPU_LEVEL, cpu);
- return cpu;//FIXME:xbt_lib_get_elm_or_null(host_lib, name);
+ return cpu;
}
NetworkLinkPtr NetworkL07Model::createNetworkLink(const char *name,
state_initial, state_trace,
policy);
- xbt_lib_set(link_lib, name, SURF_LINK_LEVEL, static_cast<ResourcePtr>(nw_link));
+ xbt_lib_set(link_lib, name, SURF_LINK_LEVEL, nw_link);
return nw_link;
}
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
- host->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(host));
+ host->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, host);
}
xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
- host->p_powerEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(host));
+ host->p_powerEvent = tmgr_history_add_trace(history, trace, 0.0, 0, host);
}
/* Connect traces relative to network */
xbt_assert(link, "Link %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
- link->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(link));
+ link->p_stateEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link);
}
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
xbt_assert(link, "Link %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
- link->p_bwEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(link));
+ link->p_bwEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link);
}
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
xbt_assert(link, "Link %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
- link->p_latEvent = tmgr_history_add_trace(history, trace, 0.0, 0, static_cast<ResourcePtr>(link));
+ link->p_latEvent = tmgr_history_add_trace(history, trace, 0.0, 0, link);
}
}
xbt_assert(m_powerScale > 0, "Power has to be >0");
if (power_trace)
- p_powerEvent = tmgr_history_add_trace(history, power_trace, 0.0, 0,
- static_cast<ResourcePtr>(this));
+ p_powerEvent = tmgr_history_add_trace(history, power_trace, 0.0, 0, this);
else
p_powerEvent = NULL;
setState(state_initial);
if (state_trace)
- p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, static_cast<ResourcePtr>(this));
+ p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, this);
}
LinkL07::LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props,
{
m_bwCurrent = bw_initial;
if (bw_trace)
- p_bwEvent = tmgr_history_add_trace(history, bw_trace, 0.0, 0, static_cast<ResourcePtr>(this));
+ p_bwEvent = tmgr_history_add_trace(history, bw_trace, 0.0, 0, this);
setState(state_initial);
m_latCurrent = lat_initial;
if (lat_trace)
- p_latEvent = tmgr_history_add_trace(history, lat_trace, 0.0, 0, static_cast<ResourcePtr>(this));
+ p_latEvent = tmgr_history_add_trace(history, lat_trace, 0.0, 0, this);
if (policy == SURF_LINK_FATPIPE)
lmm_constraint_shared(getConstraint());
double *computation_amount = xbt_new0(double, 1);
double *communication_amount = xbt_new0(double, 1);
- workstation_list[0] = static_cast<ResourcePtr>(this);
+ workstation_list[0] = this;
communication_amount[0] = 0.0;
computation_amount[0] = size;