Making pointers explicit is not what we did in C so far, but what we
did was a bad idea. It's easier to code when you know what is a
pointer and what is not.
Also:
- Convert a bunch of C-typecast into static_cast
- Kill some dead or dupplicated code
64 files changed:
// ========== SURF CPU ============
DEFINE_EXTERNAL_CLASS(Cpu);
typedef Cpu *surf_cpu_t;
// ========== SURF CPU ============
DEFINE_EXTERNAL_CLASS(Cpu);
typedef Cpu *surf_cpu_t;
XBT_PUBLIC(surf_cpu_t) sg_host_surfcpu(sg_host_t host);
XBT_PUBLIC(void) sg_host_surfcpu_set(sg_host_t host, surf_cpu_t cpu);
XBT_PUBLIC(void) sg_host_surfcpu_destroy(sg_host_t host);
// ========== RoutingEdge ============
XBT_PUBLIC(surf_cpu_t) sg_host_surfcpu(sg_host_t host);
XBT_PUBLIC(void) sg_host_surfcpu_set(sg_host_t host, surf_cpu_t cpu);
XBT_PUBLIC(void) sg_host_surfcpu_destroy(sg_host_t host);
// ========== RoutingEdge ============
-typedef struct RoutingEdge *RoutingEdgePtr;
-XBT_PUBLIC(RoutingEdgePtr) sg_host_edge(sg_host_t host);
-XBT_PUBLIC(void) sg_host_edge_set(sg_host_t host, RoutingEdgePtr edge);
+DEFINE_EXTERNAL_CLASS(RoutingEdge);
+XBT_PUBLIC(RoutingEdge*) sg_host_edge(sg_host_t host);
+XBT_PUBLIC(void) sg_host_edge_set(sg_host_t host, RoutingEdge* edge);
XBT_PUBLIC(void) sg_host_edge_destroy(sg_host_t host, int do_callback);
XBT_PUBLIC(void) sg_host_edge_destroy(sg_host_t host, int do_callback);
jlong *elts = jenv->GetLongArrayElements(jresult, NULL);
l = 0;
for(ActionList::iterator it(result->begin()), itend(result->end()); it != itend ; ++it) {
jlong *elts = jenv->GetLongArrayElements(jresult, NULL);
l = 0;
for(ActionList::iterator it(result->begin()), itend(result->end()); it != itend ; ++it) {
- elts[l++] = (jlong)static_cast<ActionPtr>(&*it);
+ elts[l++] = (jlong)static_cast<Action*>(&*it);
}
jenv->ReleaseLongArrayElements(jresult, elts, 0);
}
}
jenv->ReleaseLongArrayElements(jresult, elts, 0);
}
jlong *elts = jenv->GetLongArrayElements($result, NULL);
l = 0;
for(ActionList::iterator it($1->begin()), itend($1->end()); it != itend ; ++it) {
jlong *elts = jenv->GetLongArrayElements($result, NULL);
l = 0;
for(ActionList::iterator it($1->begin()), itend($1->end()); it != itend ; ++it) {
- elts[l++] = (jlong)static_cast<ActionPtr>(&*it);
+ elts[l++] = (jlong)static_cast<Action*>(&*it);
}
jenv->ReleaseLongArrayElements($result, elts, 0);
}
}
jenv->ReleaseLongArrayElements($result, elts, 0);
}
RoutingEdge *dst = sg_host_edge(sg_host_by_name(dstName));
xbt_assert(src,"Cannot get the route from a NULL source");
xbt_assert(dst,"Cannot get the route to a NULL destination");
RoutingEdge *dst = sg_host_edge(sg_host_by_name(dstName));
xbt_assert(src,"Cannot get the route from a NULL source");
xbt_assert(dst,"Cannot get the route to a NULL destination");
- xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdgePtr), NULL);
+ xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdge*), NULL);
routing_platf->getRouteAndLatency(src, dst, &route, NULL);
return route;
}
routing_platf->getRouteAndLatency(src, dst, &route, NULL);
return route;
}
#include "surf/surf_routing.hpp"
static XBT_INLINE void surf_cpu_free(void *r) {
#include "surf/surf_routing.hpp"
static XBT_INLINE void surf_cpu_free(void *r) {
- delete static_cast<CpuPtr>(r);
+ delete static_cast<Cpu*>(r);
}
static XBT_INLINE void routing_asr_host_free(void *p) {
}
static XBT_INLINE void routing_asr_host_free(void *p) {
- delete static_cast<RoutingEdgePtr>(p);
+ delete static_cast<RoutingEdge*>(p);
xbt_lib_unset(host_lib,host->key,SURF_CPU_LEVEL,1);
}
// ========== RoutingEdge ============
xbt_lib_unset(host_lib,host->key,SURF_CPU_LEVEL,1);
}
// ========== RoutingEdge ============
-RoutingEdgePtr sg_host_edge(sg_host_t host) {
- return (RoutingEdgePtr) xbt_lib_get_level(host, ROUTING_HOST_LEVEL);
+RoutingEdge *sg_host_edge(sg_host_t host) {
+ return (RoutingEdge*) xbt_lib_get_level(host, ROUTING_HOST_LEVEL);
-void sg_host_edge_set(sg_host_t host, RoutingEdgePtr edge) {
+void sg_host_edge_set(sg_host_t host, RoutingEdge *edge) {
xbt_lib_set(host_lib, host->key, ROUTING_HOST_LEVEL, edge);
}
void sg_host_edge_destroy(sg_host_t host, int do_callback) {
xbt_lib_set(host_lib, host->key, ROUTING_HOST_LEVEL, edge);
}
void sg_host_edge_destroy(sg_host_t host, int do_callback) {
sg_platf_host_add_cb(cpu_parse_init);
sg_platf_postparse_add_cb(cpu_add_traces);
sg_platf_host_add_cb(cpu_parse_init);
sg_platf_postparse_add_cb(cpu_add_traces);
- ModelPtr model_pm = surf_cpu_model_pm;
- ModelPtr model_vm = surf_cpu_model_vm;
+ Model *model_pm = surf_cpu_model_pm;
+ Model *model_vm = surf_cpu_model_vm;
xbt_dynar_push(model_list, &model_pm);
xbt_dynar_push(model_list, &model_vm);
}
xbt_dynar_push(model_list, &model_pm);
xbt_dynar_push(model_list, &model_vm);
}
delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
}
delete p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
}
-CpuPtr CpuCas01Model::createCpu(const char *name, xbt_dynar_t power_peak,
+Cpu *CpuCas01Model::createCpu(const char *name, xbt_dynar_t power_peak,
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
tmgr_trace_t state_trace,
xbt_dict_t cpu_properties)
{
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
tmgr_trace_t state_trace,
xbt_dict_t cpu_properties)
{
sg_host_t host = sg_host_by_name(name);
xbt_assert(!sg_host_surfcpu(host),
"Host '%s' declared several times in the platform file",
sg_host_t host = sg_host_by_name(name);
xbt_assert(!sg_host_surfcpu(host),
"Host '%s' declared several times in the platform file",
/* connect all traces relative to hosts */
xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
/* connect all traces relative to hosts */
xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- CpuCas01Ptr host = static_cast<CpuCas01Ptr>(sg_host_surfcpu(sg_host_by_name(elm)));
+ CpuCas01 *host = static_cast<CpuCas01*>(sg_host_surfcpu(sg_host_by_name(elm)));
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- CpuCas01Ptr host = static_cast<CpuCas01Ptr>(sg_host_surfcpu(sg_host_by_name(elm)));
+ CpuCas01 *host = static_cast<CpuCas01*>(sg_host_surfcpu(sg_host_by_name(elm)));
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
/************
* Resource *
************/
/************
* Resource *
************/
-CpuCas01::CpuCas01(CpuCas01ModelPtr model, const char *name, xbt_dynar_t powerPeak,
+CpuCas01::CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t powerPeak,
int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
xbt_dict_t properties)
int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
xbt_dict_t properties)
m_powerPeak);
while ((var = lmm_get_var_from_cnst
(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
m_powerPeak);
while ((var = lmm_get_var_from_cnst
(getModel()->getMaxminSystem(), getConstraint(), &elem))) {
- CpuCas01ActionPtr action = static_cast<CpuCas01ActionPtr>(lmm_variable_id(var));
+ CpuCas01Action *action = static_cast<CpuCas01Action*>(lmm_variable_id(var));
lmm_update_variable_bound(getModel()->getMaxminSystem(),
action->getVariable(),
lmm_update_variable_bound(getModel()->getMaxminSystem(),
action->getVariable(),
setState(SURF_RESOURCE_OFF);
while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), cnst, &elem))) {
setState(SURF_RESOURCE_OFF);
while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), cnst, &elem))) {
- ActionPtr action = static_cast<ActionPtr>(lmm_variable_id(var));
+ Action *action = static_cast<Action*>(lmm_variable_id(var));
if (action->getState() == SURF_ACTION_RUNNING ||
action->getState() == SURF_ACTION_READY ||
if (action->getState() == SURF_ACTION_RUNNING ||
action->getState() == SURF_ACTION_READY ||
-CpuActionPtr CpuCas01::execute(double size)
+CpuAction *CpuCas01::execute(double size)
{
XBT_IN("(%s,%g)", getName(), size);
{
XBT_IN("(%s,%g)", getName(), size);
- CpuCas01ActionPtr action = new CpuCas01Action(getModel(), size, getState() != SURF_RESOURCE_ON,
+ CpuCas01Action *action = new CpuCas01Action(getModel(), size, getState() != SURF_RESOURCE_ON,
m_powerScale * m_powerPeak, getConstraint());
XBT_OUT();
return action;
}
m_powerScale * m_powerPeak, getConstraint());
XBT_OUT();
return action;
}
-CpuActionPtr CpuCas01::sleep(double duration)
+CpuAction *CpuCas01::sleep(double duration)
{
if (duration > 0)
duration = MAX(duration, sg_surf_precision);
XBT_IN("(%s,%g)", getName(), duration);
{
if (duration > 0)
duration = MAX(duration, sg_surf_precision);
XBT_IN("(%s,%g)", getName(), duration);
- CpuCas01ActionPtr action = new CpuCas01Action(getModel(), 1.0, getState() != SURF_RESOURCE_ON,
+ CpuCas01Action *action = new CpuCas01Action(getModel(), 1.0, getState() != SURF_RESOURCE_ON,
m_powerScale * m_powerPeak, getConstraint());
m_powerScale * m_powerPeak, getConstraint());
/* 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));
/* 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 = static_cast<CpuCas01ModelPtr>(getModel())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
+ action->p_stateSet = static_cast<CpuCas01Model*>(getModel())->p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
action->getStateSet()->push_back(*action);
}
action->getStateSet()->push_back(*action);
}
-CpuCas01Action::CpuCas01Action(ModelPtr model, double cost, bool failed, double power, lmm_constraint_t constraint)
+CpuCas01Action::CpuCas01Action(Model *model, double cost, bool failed, double power, lmm_constraint_t constraint)
: CpuAction(model, cost, failed,
lmm_variable_new(model->getMaxminSystem(), this,
1.0, power, 1))
: CpuAction(model, cost, failed,
lmm_variable_new(model->getMaxminSystem(), this,
1.0, power, 1))
* Classes *
***********/
class CpuCas01Model;
* Classes *
***********/
class CpuCas01Model;
-typedef CpuCas01Model *CpuCas01ModelPtr;
-
-typedef CpuCas01 *CpuCas01Ptr;
-
-typedef CpuCas01Action *CpuCas01ActionPtr;
double (CpuCas01Model::*shareResources)(double now);
void (CpuCas01Model::*updateActionsState)(double now, double delta);
double (CpuCas01Model::*shareResources)(double now);
void (CpuCas01Model::*updateActionsState)(double now, double delta);
- CpuPtr createCpu(const char *name, xbt_dynar_t power_peak, int pstate,
+ Cpu *createCpu(const char *name, xbt_dynar_t power_peak, int pstate,
double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
xbt_dict_t cpu_properties);
double shareResourcesFull(double now);
void addTraces();
xbt_dict_t cpu_properties);
double shareResourcesFull(double now);
void addTraces();
- ActionListPtr p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
+ ActionList *p_cpuRunningActionSetThatDoesNotNeedBeingChecked;
class CpuCas01 : public Cpu {
public:
class CpuCas01 : public Cpu {
public:
- CpuCas01(CpuCas01ModelPtr model, const char *name, xbt_dynar_t power_peak,
+ CpuCas01(CpuCas01Model *model, const char *name, xbt_dynar_t power_peak,
int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
xbt_dict_t properties) ;
~CpuCas01();
void updateState(tmgr_trace_event_t event_type, double value, double date);
int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
xbt_dict_t properties) ;
~CpuCas01();
void updateState(tmgr_trace_event_t event_type, double value, double date);
- CpuActionPtr execute(double size);
- CpuActionPtr sleep(double duration);
+ CpuAction *execute(double size);
+ CpuAction *sleep(double duration);
double getCurrentPowerPeak();
double getPowerPeakAt(int pstate_index);
double getCurrentPowerPeak();
double getPowerPeakAt(int pstate_index);
* Action *
**********/
class CpuCas01Action: public CpuAction {
* Action *
**********/
class CpuCas01Action: public CpuAction {
- friend CpuActionPtr CpuCas01::execute(double size);
- friend CpuActionPtr CpuCas01::sleep(double duration);
+ friend CpuAction *CpuCas01::execute(double size);
+ friend CpuAction *CpuCas01::sleep(double duration);
- CpuCas01Action(ModelPtr model, double cost, bool failed, double power,
+ CpuCas01Action(Model *model, double cost, bool failed, double power,
lmm_constraint_t constraint);
~CpuCas01Action() {};
lmm_constraint_t constraint);
~CpuCas01Action() {};
int autoload_surf_cpu_model = 1;
void_f_void_t surf_cpu_model_init_preparse = NULL;
int autoload_surf_cpu_model = 1;
void_f_void_t surf_cpu_model_init_preparse = NULL;
-CpuModelPtr surf_cpu_model_pm;
-CpuModelPtr surf_cpu_model_vm;
+CpuModel *surf_cpu_model_pm;
+CpuModel *surf_cpu_model_vm;
/*************
* Callbacks *
*************/
/*************
* Callbacks *
*************/
-CpuPtr getActionCpu(CpuActionPtr action) {
- return static_cast<CpuPtr>(lmm_constraint_id(lmm_get_cnst_from_var
+Cpu *getActionCpu(CpuAction *action) {
+ return static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var
(action->getModel()->getMaxminSystem(),
action->getVariable(), 0)));
}
(action->getModel()->getMaxminSystem(),
action->getVariable(), 0)));
}
-surf_callback(void, CpuPtr) cpuCreatedCallbacks;
-surf_callback(void, CpuPtr) cpuDestructedCallbacks;
-surf_callback(void, CpuPtr, e_surf_resource_state_t, e_surf_resource_state_t) cpuStateChangedCallbacks;
-surf_callback(void, CpuActionPtr, e_surf_action_state_t, e_surf_action_state_t) cpuActionStateChangedCallbacks;
+surf_callback(void, Cpu*) cpuCreatedCallbacks;
+surf_callback(void, Cpu*) cpuDestructedCallbacks;
+surf_callback(void, Cpu*, e_surf_resource_state_t, e_surf_resource_state_t) cpuStateChangedCallbacks;
+surf_callback(void, CpuAction*, e_surf_action_state_t, e_surf_action_state_t) cpuActionStateChangedCallbacks;
void cpu_parse_init(sg_platf_host_cbarg_t host){
surf_cpu_model_pm->createCpu(
void cpu_parse_init(sg_platf_host_cbarg_t host){
surf_cpu_model_pm->createCpu(
*********/
void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
{
*********/
void CpuModel::updateActionsStateLazy(double now, double /*delta*/)
{
while ((xbt_heap_size(getActionHeap()) > 0)
&& (double_equals(xbt_heap_maxkey(getActionHeap()), now, sg_surf_precision))) {
while ((xbt_heap_size(getActionHeap()) > 0)
&& (double_equals(xbt_heap_maxkey(getActionHeap()), now, sg_surf_precision))) {
- action = static_cast<CpuActionPtr>(xbt_heap_pop(getActionHeap()));
+ action = static_cast<CpuAction*>(xbt_heap_pop(getActionHeap()));
XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
if (TRACE_is_enabled()) {
XBT_CDEBUG(surf_kernel, "Something happened to action %p", action);
if (TRACE_is_enabled()) {
- CpuPtr cpu = static_cast<CpuPtr>(lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)));
+ Cpu *cpu = static_cast<Cpu*>(lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)));
TRACE_surf_host_set_utilization(cpu->getName(), action->getCategory(),
lmm_variable_getvalue(action->getVariable()),
action->getLastUpdate(),
TRACE_surf_host_set_utilization(cpu->getName(), action->getCategory(),
lmm_variable_getvalue(action->getVariable()),
action->getLastUpdate(),
//defining the last timestamp that we can safely dump to trace file
//without losing the event ascending order (considering all CPU's)
double smaller = -1;
//defining the last timestamp that we can safely dump to trace file
//without losing the event ascending order (considering all CPU's)
double smaller = -1;
- ActionListPtr actionSet = getRunningActionSet();
+ ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itend(actionSet->end())
; it != itend ; ++it) {
for(ActionList::iterator it(actionSet->begin()), itend(actionSet->end())
; it != itend ; ++it) {
- action = static_cast<CpuActionPtr>(&*it);
+ action = static_cast<CpuAction*>(&*it);
if (smaller < 0) {
smaller = action->getLastUpdate();
continue;
if (smaller < 0) {
smaller = action->getLastUpdate();
continue;
void CpuModel::updateActionsStateFull(double now, double delta)
{
void CpuModel::updateActionsStateFull(double now, double delta)
{
- CpuActionPtr action = NULL;
- ActionListPtr running_actions = getRunningActionSet();
+ CpuAction *action = NULL;
+ ActionList *running_actions = getRunningActionSet();
for(ActionList::iterator it(running_actions->begin()), itNext=it, itend(running_actions->end())
; it != itend ; it=itNext) {
++itNext;
for(ActionList::iterator it(running_actions->begin()), itNext=it, itend(running_actions->end())
; it != itend ; it=itNext) {
++itNext;
- action = static_cast<CpuActionPtr>(&*it);
+ action = static_cast<CpuAction*>(&*it);
if (TRACE_is_enabled()) {
if (TRACE_is_enabled()) {
- CpuPtr x = (CpuPtr) lmm_constraint_id(lmm_get_cnst_from_var
- (getMaxminSystem(), action->getVariable(), 0));
+ Cpu *x = static_cast<Cpu*> (lmm_constraint_id(lmm_get_cnst_from_var(getMaxminSystem(), action->getVariable(), 0)) );
TRACE_surf_host_set_utilization(x->getName(),
action->getCategory(),
TRACE_surf_host_set_utilization(x->getName(),
action->getCategory(),
surf_callback_emit(cpuCreatedCallbacks, this);
}
surf_callback_emit(cpuCreatedCallbacks, this);
}
-Cpu::Cpu(ModelPtr model, const char *name, xbt_dict_t props,
+Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
int core, double powerPeak, double powerScale)
: Resource(model, name, props)
, m_core(core)
int core, double powerPeak, double powerScale)
: Resource(model, name, props)
, m_core(core)
surf_callback_emit(cpuCreatedCallbacks, this);
}
surf_callback_emit(cpuCreatedCallbacks, this);
}
-Cpu::Cpu(ModelPtr model, const char *name, xbt_dict_t props,
+Cpu::Cpu(Model *model, const char *name, xbt_dict_t props,
lmm_constraint_t constraint, int core, double powerPeak, double powerScale)
: Resource(model, name, props, constraint)
, m_core(core)
lmm_constraint_t constraint, int core, double powerPeak, double powerScale)
: Resource(model, name, props, constraint)
, m_core(core)
double_update(&(m_remains), m_lastValue * delta, sg_maxmin_precision*sg_surf_precision);
if (TRACE_is_enabled()) {
double_update(&(m_remains), m_lastValue * delta, sg_maxmin_precision*sg_surf_precision);
if (TRACE_is_enabled()) {
- CpuPtr cpu = static_cast<CpuPtr>(lmm_constraint_id(lmm_get_cnst_from_var(getModel()->getMaxminSystem(), getVariable(), 0)));
+ Cpu *cpu = static_cast<Cpu*>(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_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, m_remains);
TRACE_surf_host_set_utilization(cpu->getName(), getCategory(), m_lastValue, m_lastUpdate, now - m_lastUpdate);
}
XBT_CDEBUG(surf_kernel, "Updating action(%p): remains is now %f", this, m_remains);
* action object does not have the information about the location where the
* action is being executed.
*/
* action object does not have the information about the location where the
* action is being executed.
*/
-void CpuAction::setAffinity(CpuPtr cpu, unsigned long mask)
+void CpuAction::setAffinity(Cpu *cpu, unsigned long mask)
{
lmm_variable_t var_obj = getVariable();
XBT_IN("(%p,%lx)", this, mask);
{
lmm_variable_t var_obj = getVariable();
XBT_IN("(%p,%lx)", this, mask);
* Classes *
***********/
class CpuModel;
* Classes *
***********/
class CpuModel;
-typedef CpuModel *CpuModelPtr;
-
-typedef CpuAction *CpuActionPtr;
-
-typedef CpuPlugin *CpuPluginPtr;
/*************
* Callbacks *
*************/
/*************
* Callbacks *
*************/
-XBT_PUBLIC(CpuPtr) getActionCpu(CpuActionPtr action);
+XBT_PUBLIC(Cpu*) getActionCpu(CpuAction *action);
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Cpu creation *
* @details Callback functions have the following signature: `void(CpuPtr)`
*/
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Cpu creation *
* @details Callback functions have the following signature: `void(CpuPtr)`
*/
-XBT_PUBLIC_DATA( surf_callback(void, CpuPtr)) cpuCreatedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, Cpu*)) cpuCreatedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Cpu destruction *
* @details Callback functions have the following signature: `void(CpuPtr)`
*/
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Cpu destruction *
* @details Callback functions have the following signature: `void(CpuPtr)`
*/
-XBT_PUBLIC_DATA( surf_callback(void, CpuPtr)) cpuDestructedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, Cpu*)) cpuDestructedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Cpu State changed *
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Cpu State changed *
- * @details Callback functions have the following signature: `void(CpuActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
+ * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
-XBT_PUBLIC_DATA( surf_callback(void, CpuPtr, e_surf_resource_state_t, e_surf_resource_state_t)) cpuStateChangedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, Cpu*, e_surf_resource_state_t, e_surf_resource_state_t)) cpuStateChangedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after CpuAction State changed *
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after CpuAction State changed *
- * @details Callback functions have the following signature: `void(CpuActionPtr action, e_surf_action_state_t old, e_surf_action_state_t current)`
+ * @details Callback functions have the following signature: `void(CpuAction *action, e_surf_action_state_t old, e_surf_action_state_t current)`
-XBT_PUBLIC_DATA( surf_callback(void, CpuActionPtr, e_surf_action_state_t, e_surf_action_state_t)) cpuActionStateChangedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, CpuAction*, e_surf_action_state_t, e_surf_action_state_t)) cpuActionStateChangedCallbacks;
XBT_PUBLIC(void) cpu_parse_init(sg_platf_host_cbarg_t host);
XBT_PUBLIC(void) cpu_parse_init(sg_platf_host_cbarg_t host);
* @param state_trace [TODO]
* @param cpu_properties Dictionary of properties associated to this Cpu
*/
* @param state_trace [TODO]
* @param cpu_properties Dictionary of properties associated to this Cpu
*/
- virtual CpuPtr createCpu(const char *name, xbt_dynar_t power_peak,
+ virtual Cpu *createCpu(const char *name, xbt_dynar_t power_peak,
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
* @param powerPeak The power peak of this Cpu
* @param powerScale The power scale of this Cpu
*/
* @param powerPeak The power peak of this Cpu
* @param powerScale The power scale of this Cpu
*/
- Cpu(ModelPtr model, const char *name, xbt_dict_t props,
+ Cpu(Model *model, const char *name, xbt_dict_t props,
lmm_constraint_t constraint, int core, double powerPeak, double powerScale);
/**
lmm_constraint_t constraint, int core, double powerPeak, double powerScale);
/**
* @param powerPeak The power peak of this Cpu in [TODO]
* @param powerScale The power scale of this Cpu in [TODO]
*/
* @param powerPeak The power peak of this Cpu in [TODO]
* @param powerScale The power scale of this Cpu in [TODO]
*/
- Cpu(ModelPtr model, const char *name, xbt_dict_t props,
+ Cpu(Model *model, const char *name, xbt_dict_t props,
int core, double powerPeak, double powerScale);
/**
int core, double powerPeak, double powerScale);
/**
* @param size The value of the processing amount (in flop) needed to process
* @return The CpuAction corresponding to the processing
*/
* @param size The value of the processing amount (in flop) needed to process
* @return The CpuAction corresponding to the processing
*/
- virtual CpuActionPtr execute(double size)=0;
+ virtual CpuAction *execute(double size)=0;
/**
* @brief Make a process sleep for duration (in seconds)
/**
* @brief Make a process sleep for duration (in seconds)
* @param duration The number of seconds to sleep
* @return The CpuAction corresponding to the sleeping
*/
* @param duration The number of seconds to sleep
* @return The CpuAction corresponding to the sleeping
*/
- virtual CpuActionPtr sleep(double duration)=0;
+ virtual CpuAction *sleep(double duration)=0;
/**
* @brief Get the number of cores of the current Cpu
/**
* @brief Get the number of cores of the current Cpu
* @details A CpuAction represent the execution of code on a Cpu
*/
XBT_PUBLIC_CLASS CpuAction : public Action {
* @details A CpuAction represent the execution of code on a Cpu
*/
XBT_PUBLIC_CLASS CpuAction : public Action {
-friend XBT_PUBLIC(CpuPtr) getActionCpu(CpuActionPtr action);
+friend XBT_PUBLIC(Cpu*) getActionCpu(CpuAction *action);
public:
/**
* @brief CpuAction constructor
public:
/**
* @brief CpuAction constructor
* @param cost [TODO]
* @param failed [TODO]
*/
* @param cost [TODO]
* @param failed [TODO]
*/
- CpuAction(ModelPtr model, double cost, bool failed)
+ CpuAction(Model *model, double cost, bool failed)
: Action(model, cost, failed) {} //FIXME:REMOVE
/**
: Action(model, cost, failed) {} //FIXME:REMOVE
/**
* @param failed [TODO]
* @param var The lmm variable associated to this CpuAction if it is part of a LMM component
*/
* @param failed [TODO]
* @param var The lmm variable associated to this CpuAction if it is part of a LMM component
*/
- CpuAction(ModelPtr model, double cost, bool failed, lmm_variable_t var)
+ CpuAction(Model *model, double cost, bool failed, lmm_variable_t var)
: Action(model, cost, failed, var) {}
/**
: Action(model, cost, failed, var) {}
/**
* @param cpu [TODO]
* @param mask [TODO]
*/
* @param cpu [TODO]
* @param mask [TODO]
*/
- virtual void setAffinity(CpuPtr cpu, unsigned long mask);
+ virtual void setAffinity(Cpu *cpu, unsigned long mask);
void setState(e_surf_action_state_t state);
void setState(e_surf_action_state_t state);
xbt_assert(!surf_cpu_model_vm,"CPU model already initialized. This should not happen.");
surf_cpu_model_pm = new CpuTiModel();
xbt_assert(!surf_cpu_model_vm,"CPU model already initialized. This should not happen.");
surf_cpu_model_pm = new CpuTiModel();
- surf_cpu_model_vm = new CpuTiModel();
+ surf_cpu_model_vm = new CpuTiModel();
cpu_ti_define_callbacks();
cpu_ti_define_callbacks();
- ModelPtr model_pm = static_cast<ModelPtr>(surf_cpu_model_pm);
- ModelPtr model_vm = static_cast<ModelPtr>(surf_cpu_model_vm);
+ Model *model_pm = static_cast<Model*>(surf_cpu_model_pm);
+ Model *model_vm = static_cast<Model*>(surf_cpu_model_vm);
xbt_dynar_push(model_list, &model_pm);
xbt_dynar_push(model_list, &model_vm);
}
xbt_dynar_push(model_list, &model_pm);
xbt_dynar_push(model_list, &model_vm);
}
xbt_heap_free(p_tiActionHeap);
}
xbt_heap_free(p_tiActionHeap);
}
-CpuPtr CpuTiModel::createCpu(const char *name,
+Cpu *CpuTiModel::createCpu(const char *name,
xbt_dynar_t powerPeak,
int pstate,
double powerScale,
xbt_dynar_t powerPeak,
int pstate,
double powerScale,
name);
xbt_assert(xbt_dynar_getfirst_as(powerPeak, double) > 0.0,
"Power has to be >0.0. Did you forget to specify the mandatory power attribute?");
name);
xbt_assert(xbt_dynar_getfirst_as(powerPeak, double) > 0.0,
"Power has to be >0.0. Did you forget to specify the mandatory power attribute?");
- CpuTiPtr cpu = new CpuTi(this, name, powerPeak, pstate, powerScale, powerTrace,
+ CpuTi *cpu = new CpuTi(this, name, powerPeak, pstate, powerScale, powerTrace,
core, stateInitial, stateTrace, cpuProperties);
sg_host_surfcpu_set(host, cpu);
return cpu;
core, stateInitial, stateTrace, cpuProperties);
sg_host_surfcpu_set(host, cpu);
return cpu;
/* iterates over modified cpus to update share resources */
for(CpuTiList::iterator it(p_modifiedCpu->begin()), itend(p_modifiedCpu->end())
; it != itend ;) {
/* iterates over modified cpus to update share resources */
for(CpuTiList::iterator it(p_modifiedCpu->begin()), itend(p_modifiedCpu->end())
; it != itend ;) {
++it;
ti->updateActionsFinishTime(now);
}
++it;
ti->updateActionsFinishTime(now);
}
{
while ((xbt_heap_size(p_tiActionHeap) > 0)
&& (xbt_heap_maxkey(p_tiActionHeap) <= now)) {
{
while ((xbt_heap_size(p_tiActionHeap) > 0)
&& (xbt_heap_maxkey(p_tiActionHeap) <= now)) {
- CpuTiActionPtr action = (CpuTiActionPtr) xbt_heap_pop(p_tiActionHeap);
+ CpuTiAction *action = (CpuTiAction*) xbt_heap_pop(p_tiActionHeap);
XBT_DEBUG("Action %p: finish", action);
action->finish();
/* set the remains to 0 due to precision problems when updating the remaining amount */
XBT_DEBUG("Action %p: finish", action);
action->finish();
/* set the remains to 0 due to precision problems when updating the remaining amount */
/* connect all traces relative to hosts */
xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
/* connect all traces relative to hosts */
xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- CpuTiPtr cpu = static_cast<CpuTiPtr>(sg_host_surfcpu(sg_host_by_name(elm)));
+ CpuTi *cpu = static_cast<CpuTi*>(sg_host_surfcpu(sg_host_by_name(elm)));
xbt_assert(cpu, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_assert(cpu, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- CpuTiPtr cpu = static_cast<CpuTiPtr>(sg_host_surfcpu(sg_host_by_name(elm)));
+ CpuTi *cpu = static_cast<CpuTi*>(sg_host_surfcpu(sg_host_by_name(elm)));
xbt_assert(cpu, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_assert(cpu, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
/************
* Resource *
************/
/************
* Resource *
************/
-CpuTi::CpuTi(CpuTiModelPtr model, const char *name, xbt_dynar_t powerPeak,
+CpuTi::CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t powerPeak,
int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
xbt_dict_t properties)
int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
xbt_dict_t properties)
void CpuTi::updateState(tmgr_trace_event_t event_type,
double value, double date)
{
void CpuTi::updateState(tmgr_trace_event_t event_type,
double value, double date)
{
if (event_type == p_powerEvent) {
tmgr_trace_t power_trace;
if (event_type == p_powerEvent) {
tmgr_trace_t power_trace;
s_tmgr_event_t val;
XBT_DEBUG("Finish trace date: %f value %f date %f", surf_get_clock(),
s_tmgr_event_t val;
XBT_DEBUG("Finish trace date: %f value %f date %f", surf_get_clock(),
action->setFinishTime(date);
action->setState(SURF_ACTION_FAILED);
if (action->m_indexHeap >= 0) {
action->setFinishTime(date);
action->setState(SURF_ACTION_FAILED);
if (action->m_indexHeap >= 0) {
- CpuTiActionPtr heap_act = (CpuTiActionPtr)
- xbt_heap_remove(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action->m_indexHeap);
+ CpuTiAction *heap_act = (CpuTiAction*)
+ xbt_heap_remove(static_cast<CpuTiModel*>(getModel())->p_tiActionHeap, action->m_indexHeap);
if (heap_act != action)
DIE_IMPOSSIBLE;
}
if (heap_act != action)
DIE_IMPOSSIBLE;
}
void CpuTi::updateActionsFinishTime(double now)
{
void CpuTi::updateActionsFinishTime(double now)
{
double sum_priority = 0.0, total_area, min_finish = -1;
/* update remaning amount of actions */
double sum_priority = 0.0, total_area, min_finish = -1;
/* update remaning amount of actions */
/* add in action heap */
XBT_DEBUG("action(%p) index %d", action, action->m_indexHeap);
if (action->m_indexHeap >= 0) {
/* add in action heap */
XBT_DEBUG("action(%p) index %d", action, action->m_indexHeap);
if (action->m_indexHeap >= 0) {
- CpuTiActionPtr heap_act = (CpuTiActionPtr)
- xbt_heap_remove(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action->m_indexHeap);
+ CpuTiAction *heap_act = (CpuTiAction*)
+ xbt_heap_remove(static_cast<CpuTiModel*>(getModel())->p_tiActionHeap, action->m_indexHeap);
if (heap_act != action)
DIE_IMPOSSIBLE;
}
if (min_finish != NO_MAX_DURATION)
if (heap_act != action)
DIE_IMPOSSIBLE;
}
if (min_finish != NO_MAX_DURATION)
- xbt_heap_push(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, action, min_finish);
+ xbt_heap_push(static_cast<CpuTiModel*>(getModel())->p_tiActionHeap, action, min_finish);
XBT_DEBUG
("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f",
XBT_DEBUG
("Update finish time: Cpu(%s) Action: %p, Start Time: %f Finish Time: %f Max duration %f",
void CpuTi::updateRemainingAmount(double now)
{
double area_total;
void CpuTi::updateRemainingAmount(double now)
{
double area_total;
/* already updated */
if (m_lastUpdate >= now)
/* already updated */
if (m_lastUpdate >= now)
-CpuActionPtr CpuTi::execute(double size)
+CpuAction *CpuTi::execute(double size)
{
XBT_IN("(%s,%g)", getName(), size);
{
XBT_IN("(%s,%g)", getName(), size);
- CpuTiActionPtr action = new CpuTiAction(static_cast<CpuTiModelPtr>(getModel()), size, getState() != SURF_RESOURCE_ON, this);
+ CpuTiAction *action = new CpuTiAction(static_cast<CpuTiModel*>(getModel()), size, getState() != SURF_RESOURCE_ON, this);
p_actionSet->push_back(*action);
p_actionSet->push_back(*action);
-CpuActionPtr CpuTi::sleep(double duration)
+CpuAction *CpuTi::sleep(double duration)
{
if (duration > 0)
duration = MAX(duration, sg_surf_precision);
XBT_IN("(%s,%g)", getName(), duration);
{
if (duration > 0)
duration = MAX(duration, sg_surf_precision);
XBT_IN("(%s,%g)", getName(), duration);
- CpuTiActionPtr action = new CpuTiAction(static_cast<CpuTiModelPtr>(getModel()), 1.0, getState() != SURF_RESOURCE_ON, this);
+ CpuTiAction *action = new CpuTiAction(static_cast<CpuTiModel*>(getModel()), 1.0, getState() != SURF_RESOURCE_ON, this);
action->m_maxDuration = duration;
action->m_suspended = 2;
action->m_maxDuration = duration;
action->m_suspended = 2;
/* 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));
/* 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 = static_cast<CpuTiModelPtr>(getModel())->p_runningActionSetThatDoesNotNeedBeingChecked;
+ action->p_stateSet = static_cast<CpuTiModel*>(getModel())->p_runningActionSetThatDoesNotNeedBeingChecked;
action->getStateSet()->push_back(*action);
}
action->getStateSet()->push_back(*action);
}
}
void CpuTi::modified(bool modified){
}
void CpuTi::modified(bool modified){
- CpuTiListPtr modifiedCpu = static_cast<CpuTiModelPtr>(getModel())->p_modifiedCpu;
+ CpuTiList *modifiedCpu = static_cast<CpuTiModel*>(getModel())->p_modifiedCpu;
if (modified) {
if (!is_linked()) {
modifiedCpu->push_back(*this);
if (modified) {
if (!is_linked()) {
modifiedCpu->push_back(*this);
static void cpu_ti_action_update_index_heap(void *action, int i)
{
static void cpu_ti_action_update_index_heap(void *action, int i)
{
-((CpuTiActionPtr)action)->updateIndexHeap(i);
+((CpuTiAction*)action)->updateIndexHeap(i);
-CpuTiAction::CpuTiAction(CpuTiModelPtr model_, double cost, bool failed,
- CpuTiPtr cpu)
+CpuTiAction::CpuTiAction(CpuTiModel *model_, double cost, bool failed,
+ CpuTi *cpu)
: CpuAction(model_, cost, failed)
{
m_suspended = 0; /* Should be useless because of the
: CpuAction(model_, cost, failed)
{
m_suspended = 0; /* Should be useless because of the
if (actionTiHook::is_linked())
p_cpu->p_actionSet->erase(p_cpu->p_actionSet->iterator_to(*this));
/* remove from heap */
if (actionTiHook::is_linked())
p_cpu->p_actionSet->erase(p_cpu->p_actionSet->iterator_to(*this));
/* remove from heap */
- xbt_heap_remove(static_cast<CpuTiModelPtr>(getModel())->p_tiActionHeap, this->m_indexHeap);
+ xbt_heap_remove(static_cast<CpuTiModel*>(getModel())->p_tiActionHeap, this->m_indexHeap);
p_cpu->modified(true);
delete this;
return 1;
p_cpu->modified(true);
delete this;
return 1;
/* add in action heap */
if (m_indexHeap >= 0) {
/* add in action heap */
if (m_indexHeap >= 0) {
- CpuTiActionPtr heap_act = (CpuTiActionPtr)
+ CpuTiAction *heap_act = (CpuTiAction*)
xbt_heap_remove(getModel()->getActionHeap(), m_indexHeap);
if (heap_act != this)
DIE_IMPOSSIBLE;
xbt_heap_remove(getModel()->getActionHeap(), m_indexHeap);
if (heap_act != this)
DIE_IMPOSSIBLE;
* Classes *
***********/
class CpuTiTrace;
* Classes *
***********/
class CpuTiTrace;
-typedef CpuTiTrace *CpuTiTracePtr;
-
-typedef CpuTiTgmr *CpuTiTgmrPtr;
-
-typedef CpuTiModel *CpuTiModelPtr;
-
-typedef CpuTi *CpuTiPtr;
-
-typedef CpuTiAction *CpuTiActionPtr;
typedef boost::intrusive::list<CpuTi> CpuTiList;
typedef boost::intrusive::list<CpuTi> CpuTiList;
-typedef CpuTiList* CpuTiListPtr;
typedef boost::intrusive::list_base_hook<> cpuTiHook;
struct tiTag;
typedef boost::intrusive::list<CpuTiAction, boost::intrusive::base_hook<boost::intrusive::list_base_hook<boost::intrusive::tag<tiTag> > > > ActionTiList;
typedef boost::intrusive::list_base_hook<> cpuTiHook;
struct tiTag;
typedef boost::intrusive::list<CpuTiAction, boost::intrusive::base_hook<boost::intrusive::list_base_hook<boost::intrusive::tag<tiTag> > > > ActionTiList;
-typedef ActionTiList* ActionTiListPtr;
typedef boost::intrusive::list_base_hook<boost::intrusive::tag<tiTag> > actionTiHook;
/*********
typedef boost::intrusive::list_base_hook<boost::intrusive::tag<tiTag> > actionTiHook;
/*********
double m_lastTime; /*< Integral interval last point (discret time) */
double m_total; /*< Integral total between 0 and last_pointn */
double m_lastTime; /*< Integral interval last point (discret time) */
double m_total; /*< Integral total between 0 and last_pointn */
tmgr_trace_t p_powerTrace;
};
tmgr_trace_t p_powerTrace;
};
public:
CpuTiModel();
~CpuTiModel();
public:
CpuTiModel();
~CpuTiModel();
- CpuPtr createCpu(const char *name, xbt_dynar_t powerPeak,
+ Cpu *createCpu(const char *name, xbt_dynar_t powerPeak,
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
void updateActionsState(double now, double delta);
void addTraces();
void updateActionsState(double now, double delta);
void addTraces();
- ActionListPtr p_runningActionSetThatDoesNotNeedBeingChecked;
- CpuTiListPtr p_modifiedCpu;
+ ActionList *p_runningActionSetThatDoesNotNeedBeingChecked;
+ CpuTiList *p_modifiedCpu;
xbt_heap_t p_tiActionHeap;
protected:
xbt_heap_t p_tiActionHeap;
protected:
- void NotifyResourceTurnedOn(ResourcePtr){};
- void NotifyResourceTurnedOff(ResourcePtr){};
+ void NotifyResourceTurnedOn(Resource*){};
+ void NotifyResourceTurnedOff(Resource*){};
- void NotifyActionCancel(ActionPtr){};
- void NotifyActionResume(ActionPtr){};
- void NotifyActionSuspend(ActionPtr){};
+ void NotifyActionCancel(Action*){};
+ void NotifyActionResume(Action*){};
+ void NotifyActionSuspend(Action*){};
class CpuTi : public cpuTiHook, public Cpu {
public:
CpuTi() {};
class CpuTi : public cpuTiHook, public Cpu {
public:
CpuTi() {};
- CpuTi(CpuTiModelPtr model, const char *name, xbt_dynar_t powerPeak,
+ CpuTi(CpuTiModel *model, const char *name, xbt_dynar_t powerPeak,
int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
xbt_dict_t properties) ;
int pstate, double powerScale, tmgr_trace_t powerTrace, int core,
e_surf_resource_state_t stateInitial, tmgr_trace_t stateTrace,
xbt_dict_t properties) ;
void updateActionsFinishTime(double now);
bool isUsed();
void printCpuTiModel();
void updateActionsFinishTime(double now);
bool isUsed();
void printCpuTiModel();
- CpuActionPtr execute(double size);
- CpuActionPtr sleep(double duration);
+ CpuAction *execute(double size);
+ CpuAction *sleep(double duration);
double getAvailableSpeed();
double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
double getAvailableSpeed();
double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
int getPstate() { THROW_UNIMPLEMENTED;}
void modified(bool modified);
int getPstate() { THROW_UNIMPLEMENTED;}
void modified(bool modified);
- CpuTiTgmrPtr p_availTrace; /*< Structure with data needed to integrate trace file */
+ CpuTiTgmr *p_availTrace; /*< Structure with data needed to integrate trace file */
tmgr_trace_event_t p_stateEvent; /*< trace file with states events (ON or OFF) */
tmgr_trace_event_t p_powerEvent; /*< trace file with availability events */
tmgr_trace_event_t p_stateEvent; /*< trace file with states events (ON or OFF) */
tmgr_trace_event_t p_powerEvent; /*< trace file with availability events */
- ActionTiListPtr p_actionSet; /*< set with all actions running on cpu */
+ ActionTiList *p_actionSet; /*< set with all actions running on cpu */
double m_sumPriority; /*< the sum of actions' priority that are running on cpu */
double m_lastUpdate; /*< last update of actions' remaining amount done */
double m_sumPriority; /*< the sum of actions' priority that are running on cpu */
double m_lastUpdate; /*< last update of actions' remaining amount done */
**********/
class CpuTiAction: public actionTiHook, public CpuAction {
**********/
class CpuTiAction: public actionTiHook, public CpuAction {
- friend CpuActionPtr CpuTi::execute(double size);
- friend CpuActionPtr CpuTi::sleep(double duration);
+ friend CpuAction *CpuTi::execute(double size);
+ friend CpuAction *CpuTi::sleep(double duration);
friend void CpuTi::updateActionsFinishTime(double now);//FIXME
friend void CpuTi::updateRemainingAmount(double now);//FIXME
public:
friend void CpuTi::updateActionsFinishTime(double now);//FIXME
friend void CpuTi::updateRemainingAmount(double now);//FIXME
public:
- CpuTiAction(CpuTiModelPtr model, double cost, bool failed,
- CpuTiPtr cpu);
+ CpuTiAction(CpuTiModel *model, double cost, bool failed,
+ CpuTi *cpu);
void setState(e_surf_action_state_t state);
int unref();
void setState(e_surf_action_state_t state);
int unref();
void setMaxDuration(double duration);
void setPriority(double priority);
double getRemains();
void setMaxDuration(double duration);
void setPriority(double priority);
double getRemains();
- void setAffinity(CpuPtr /*cpu*/, unsigned long /*mask*/) {};
+ void setAffinity(Cpu */*cpu*/, unsigned long /*mask*/) {};
int m_indexHeap;
int m_suspended;
private:
int m_indexHeap;
int m_suspended;
private:
surf_network_model_init_LegrandVelho();
surf_host_model->p_cpuModel = surf_cpu_model_pm;
surf_network_model_init_LegrandVelho();
surf_host_model->p_cpuModel = surf_cpu_model_pm;
- ModelPtr model = surf_host_model;
+ Model *model = surf_host_model;
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(host_parse_init);
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(host_parse_init);
xbt_assert(surf_network_model, "No network model defined yet!");
surf_host_model = new HostCLM03Model();
xbt_assert(surf_network_model, "No network model defined yet!");
surf_host_model = new HostCLM03Model();
- ModelPtr model = surf_host_model;
+ Model *model = surf_host_model;
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(host_parse_init);
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
sg_platf_host_add_cb(host_parse_init);
HostCLM03Model::~HostCLM03Model()
{}
HostCLM03Model::~HostCLM03Model()
{}
-HostPtr HostCLM03Model::createHost(const char *name){
+Host *HostCLM03Model::createHost(const char *name){
sg_host_t sg_host = sg_host_by_name(name);
sg_host_t sg_host = sg_host_by_name(name);
- HostPtr host = new HostCLM03(surf_host_model, name, NULL,
+ Host *host = new HostCLM03(surf_host_model, name, NULL,
(xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL),
sg_host_edge(sg_host),
sg_host_surfcpu(sg_host));
(xbt_dynar_t)xbt_lib_get_or_null(storage_lib, name, ROUTING_STORAGE_HOST_LEVEL),
sg_host_edge(sg_host),
sg_host_surfcpu(sg_host));
-ActionPtr HostCLM03Model::executeParallelTask(int host_nb,
+Action *HostCLM03Model::executeParallelTask(int host_nb,
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate){
#define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate){
#define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
- ActionPtr action =NULL;
if ((host_nb == 1)
&& (cost_or_zero(bytes_amount, 0) == 0.0)){
if ((host_nb == 1)
&& (cost_or_zero(bytes_amount, 0) == 0.0)){
- action = ((HostCLM03Ptr)host_list[0])->execute(flops_amount[0]);
+ action = static_cast<HostCLM03*>(host_list[0])->execute(flops_amount[0]);
} else if ((host_nb == 1)
&& (cost_or_zero(flops_amount, 0) == 0.0)) {
} else if ((host_nb == 1)
&& (cost_or_zero(flops_amount, 0) == 0.0)) {
- action = communicate((HostCLM03Ptr)host_list[0],
- (HostCLM03Ptr)host_list[0],bytes_amount[0], rate);
+ action = communicate(static_cast<HostCLM03*>(host_list[0]),
+ static_cast<HostCLM03*>(host_list[0]),bytes_amount[0], rate);
} else if ((host_nb == 2)
&& (cost_or_zero(flops_amount, 0) == 0.0)
&& (cost_or_zero(flops_amount, 1) == 0.0)) {
} else if ((host_nb == 2)
&& (cost_or_zero(flops_amount, 0) == 0.0)
&& (cost_or_zero(flops_amount, 1) == 0.0)) {
- action = communicate((HostCLM03Ptr)host_list[0],
- (HostCLM03Ptr)host_list[1],value, rate);
+ action = communicate(static_cast<HostCLM03*>(host_list[0]),
+ static_cast<HostCLM03*>(host_list[1]),value, rate);
}
} else
THROW_UNIMPLEMENTED; /* This model does not implement parallel tasks */
#undef cost_or_zero
}
} else
THROW_UNIMPLEMENTED; /* This model does not implement parallel tasks */
#undef cost_or_zero
- xbt_free((HostCLM03Ptr)host_list);
-ActionPtr HostCLM03Model::communicate(HostPtr src, HostPtr dst, double size, double rate){
+Action *HostCLM03Model::communicate(Host *src, Host *dst, double size, double rate){
return surf_network_model->communicate(src->p_netElm, dst->p_netElm, size, rate);
}
return surf_network_model->communicate(src->p_netElm, dst->p_netElm, size, rate);
}
/************
* Resource *
************/
/************
* Resource *
************/
-HostCLM03::HostCLM03(HostModelPtr model, const char* name, xbt_dict_t properties, xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu)
+HostCLM03::HostCLM03(HostModel *model, const char* name, xbt_dict_t properties, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu)
: Host(model, name, properties, storage, netElm, cpu) {}
bool HostCLM03::isUsed(){
: Host(model, name, properties, storage, netElm, cpu) {}
bool HostCLM03::isUsed(){
THROW_IMPOSSIBLE; /* This model does not implement parallel tasks */
}
THROW_IMPOSSIBLE; /* This model does not implement parallel tasks */
}
-ActionPtr HostCLM03::execute(double size) {
+Action *HostCLM03::execute(double size) {
return p_cpu->execute(size);
}
return p_cpu->execute(size);
}
-ActionPtr HostCLM03::sleep(double duration) {
+Action *HostCLM03::sleep(double duration) {
return p_cpu->sleep(duration);
}
return p_cpu->sleep(duration);
}
***********/
class HostCLM03Model;
***********/
class HostCLM03Model;
-typedef HostCLM03Model *HostCLM03ModelPtr;
-
-typedef HostCLM03 *HostCLM03Ptr;
-
-typedef HostCLM03Action *HostCLM03ActionPtr;
public:
HostCLM03Model();
~HostCLM03Model();
public:
HostCLM03Model();
~HostCLM03Model();
- HostPtr createHost(const char *name);
+ Host *createHost(const char *name);
double shareResources(double now);
void updateActionsState(double now, double delta);
double shareResources(double now);
void updateActionsState(double now, double delta);
- ActionPtr executeParallelTask(int host_nb,
+ Action *executeParallelTask(int host_nb,
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate);
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate);
- ActionPtr communicate(HostPtr src, HostPtr dst, double size, double rate);
+ Action *communicate(Host *src, Host *dst, double size, double rate);
class HostCLM03 : public Host {
public:
class HostCLM03 : public Host {
public:
- HostCLM03(HostModelPtr model, const char* name, xbt_dict_t properties, xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu);
+ HostCLM03(HostModel *model, const char* name, xbt_dict_t properties, xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu);
void updateState(tmgr_trace_event_t event_type, double value, double date);
void updateState(tmgr_trace_event_t event_type, double value, double date);
- virtual ActionPtr execute(double size);
- virtual ActionPtr sleep(double duration);
+ virtual Action *execute(double size);
+ virtual Action *sleep(double duration);
e_surf_resource_state_t getState();
bool isUsed();
e_surf_resource_state_t getState();
bool isUsed();
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_host, surf,
"Logging specific to the SURF host module");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_host, surf,
"Logging specific to the SURF host module");
-HostModelPtr surf_host_model = NULL;
+HostModel *surf_host_model = NULL;
/*************
* Callbacks *
*************/
/*************
* Callbacks *
*************/
-surf_callback(void, HostPtr) hostCreatedCallbacks;
-surf_callback(void, HostPtr) hostDestructedCallbacks;
-surf_callback(void, HostPtr, e_surf_resource_state_t, e_surf_resource_state_t) hostStateChangedCallbacks;
-surf_callback(void, HostActionPtr, e_surf_action_state_t, e_surf_action_state_t) hostActionStateChangedCallbacks;
+surf_callback(void, Host*) hostCreatedCallbacks;
+surf_callback(void, Host*) hostDestructedCallbacks;
+surf_callback(void, Host*, e_surf_resource_state_t, e_surf_resource_state_t) hostStateChangedCallbacks;
+surf_callback(void, HostAction*, e_surf_action_state_t, e_surf_action_state_t) hostActionStateChangedCallbacks;
void host_parse_init(sg_platf_host_cbarg_t host)
{
void host_parse_init(sg_platf_host_cbarg_t host)
{
VMModel::ws_vms.begin();
iter != VMModel::ws_vms.end(); ++iter) {
VMModel::ws_vms.begin();
iter != VMModel::ws_vms.end(); ++iter) {
- VMPtr ws_vm = &*iter;
- CpuCas01Ptr cpu_cas01 = static_cast<CpuCas01Ptr>(ws_vm->p_cpu);
+ VM *ws_vm = &*iter;
+ CpuCas01 *cpu_cas01 = static_cast<CpuCas01*>(ws_vm->p_cpu);
xbt_assert(cpu_cas01, "cpu-less host");
int is_active = lmm_constraint_used(cpu_cas01->getModel()->getMaxminSystem(), cpu_cas01->getConstraint());
xbt_assert(cpu_cas01, "cpu-less host");
int is_active = lmm_constraint_used(cpu_cas01->getModel()->getMaxminSystem(), cpu_cas01->getConstraint());
/************
* Resource *
************/
/************
* Resource *
************/
-Host::Host(ModelPtr model, const char *name, xbt_dict_t props,
- xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu)
+Host::Host(Model *model, const char *name, xbt_dict_t props,
+ xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu)
: Resource(model, name, props)
, p_storage(storage), p_netElm(netElm), p_cpu(cpu)
{
: Resource(model, name, props)
, p_storage(storage), p_netElm(netElm), p_cpu(cpu)
{
surf_callback_emit(hostCreatedCallbacks, this);
}
surf_callback_emit(hostCreatedCallbacks, this);
}
-Host::Host(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
- xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu)
+Host::Host(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint,
+ xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu)
: Resource(model, name, props, constraint)
, p_storage(storage), p_netElm(netElm), p_cpu(cpu)
{
: Resource(model, name, props, constraint)
, p_storage(storage), p_netElm(netElm), p_cpu(cpu)
{
return p_cpu->getProperties();
}
return p_cpu->getProperties();
}
-StoragePtr Host::findStorageOnMountList(const char* mount)
+Storage *Host::findStorageOnMountList(const char* mount)
s_mount_t mnt;
unsigned int cursor;
s_mount_t mnt;
unsigned int cursor;
{
XBT_DEBUG("See '%s'",mnt.name);
if(!strcmp(mount,mnt.name)){
{
XBT_DEBUG("See '%s'",mnt.name);
if(!strcmp(mount,mnt.name)){
- st = static_cast<StoragePtr>(mnt.storage);
+ st = static_cast<Storage*>(mnt.storage);
char *storage_name = NULL;
xbt_dynar_foreach(p_storage,i,mnt){
char *storage_name = NULL;
xbt_dynar_foreach(p_storage,i,mnt){
- storage_name = (char *)static_cast<StoragePtr>(mnt.storage)->getName();
+ storage_name = (char *)static_cast<Storage*>(mnt.storage)->getName();
xbt_dict_set(storage_list,mnt.name,storage_name,NULL);
}
return storage_list;
xbt_dict_set(storage_list,mnt.name,storage_name,NULL);
}
return storage_list;
xbt_dynar_t result = xbt_dynar_new(sizeof(void*), NULL);
xbt_lib_foreach(storage_lib, cursor, key, data) {
if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) {
xbt_dynar_t result = xbt_dynar_new(sizeof(void*), NULL);
xbt_lib_foreach(storage_lib, cursor, key, data) {
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));
+ Storage *storage = static_cast<Storage*>(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*)storage->getName());
}
if(!strcmp((const char*)storage->p_attach,this->getName())){
xbt_dynar_push_as(result, void *, (void*)storage->getName());
}
-ActionPtr Host::open(const char* fullpath) {
+Action *Host::open(const char* fullpath) {
s_mount_t mnt;
unsigned int cursor;
size_t longest_prefix_length = 0;
s_mount_t mnt;
unsigned int cursor;
size_t longest_prefix_length = 0;
if(!strcmp(file_mount_name,mnt.name) && strlen(mnt.name)>longest_prefix_length)
{/* The current mount name is found in the full path and is bigger than the previous*/
longest_prefix_length = strlen(mnt.name);
if(!strcmp(file_mount_name,mnt.name) && strlen(mnt.name)>longest_prefix_length)
{/* The current mount name is found in the full path and is bigger than the previous*/
longest_prefix_length = strlen(mnt.name);
- st = static_cast<StoragePtr>(mnt.storage);
+ st = static_cast<Storage*>(mnt.storage);
}
free(file_mount_name);
}
}
free(file_mount_name);
}
xbt_die("Can't find mount point for '%s' on '%s'", fullpath, getName());
XBT_DEBUG("OPEN %s on disk '%s'",path, st->getName());
xbt_die("Can't find mount point for '%s' on '%s'", fullpath, getName());
XBT_DEBUG("OPEN %s on disk '%s'",path, st->getName());
- ActionPtr action = st->open((const char*)mount_name, (const char*)path);
+ Action *action = st->open((const char*)mount_name, (const char*)path);
free((char*)path);
free((char*)mount_name);
return action;
}
free((char*)path);
free((char*)mount_name);
return action;
}
-ActionPtr Host::close(surf_file_t fd) {
- StoragePtr st = findStorageOnMountList(fd->mount);
+Action *Host::close(surf_file_t fd) {
+ Storage *st = findStorageOnMountList(fd->mount);
XBT_DEBUG("CLOSE %s on disk '%s'",fd->name, st->getName());
return st->close(fd);
}
XBT_DEBUG("CLOSE %s on disk '%s'",fd->name, st->getName());
return st->close(fd);
}
-ActionPtr Host::read(surf_file_t fd, sg_size_t size) {
- StoragePtr st = findStorageOnMountList(fd->mount);
+Action *Host::read(surf_file_t fd, sg_size_t size) {
+ Storage *st = findStorageOnMountList(fd->mount);
XBT_DEBUG("READ %s on disk '%s'",fd->name, st->getName());
return st->read(fd, size);
}
XBT_DEBUG("READ %s on disk '%s'",fd->name, st->getName());
return st->read(fd, size);
}
-ActionPtr Host::write(surf_file_t fd, sg_size_t size) {
- StoragePtr st = findStorageOnMountList(fd->mount);
+Action *Host::write(surf_file_t fd, sg_size_t size) {
+ Storage *st = findStorageOnMountList(fd->mount);
XBT_DEBUG("WRITE %s on disk '%s'",fd->name, st->getName());
return st->write(fd, size);
}
XBT_DEBUG("WRITE %s on disk '%s'",fd->name, st->getName());
return st->write(fd, size);
}
- StoragePtr st = findStorageOnMountList(fd->mount);
+ Storage *st = findStorageOnMountList(fd->mount);
/* Check if the file is on this storage */
if (!xbt_dict_get_or_null(st->p_content, fd->name)){
XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name,
/* Check if the file is on this storage */
if (!xbt_dict_get_or_null(st->p_content, fd->name)){
XBT_WARN("File %s is not on disk %s. Impossible to unlink", fd->name,
xbt_dynar_t Host::getInfo( surf_file_t fd)
{
xbt_dynar_t Host::getInfo( surf_file_t fd)
{
- StoragePtr st = findStorageOnMountList(fd->mount);
+ Storage *st = findStorageOnMountList(fd->mount);
sg_size_t *psize = xbt_new(sg_size_t, 1);
*psize = fd->size;
xbt_dynar_t info = xbt_dynar_new(sizeof(void*), NULL);
sg_size_t *psize = xbt_new(sg_size_t, 1);
*psize = fd->size;
xbt_dynar_t info = xbt_dynar_new(sizeof(void*), NULL);
xbt_dynar_t Host::getVms()
{
xbt_dynar_t Host::getVms()
{
- xbt_dynar_t dyn = xbt_dynar_new(sizeof(VMPtr), NULL);
+ xbt_dynar_t dyn = xbt_dynar_new(sizeof(VM*), NULL);
/* iterate for all virtual machines */
for (VMModel::vm_list_t::iterator iter =
VMModel::ws_vms.begin();
iter != VMModel::ws_vms.end(); ++iter) {
/* iterate for all virtual machines */
for (VMModel::vm_list_t::iterator iter =
VMModel::ws_vms.begin();
iter != VMModel::ws_vms.end(); ++iter) {
if (this == ws_vm->p_subWs)
xbt_dynar_push(dyn, &ws_vm);
}
if (this == ws_vm->p_subWs)
xbt_dynar_push(dyn, &ws_vm);
}
***********/
class HostModel;
***********/
class HostModel;
-typedef HostModel *HostModelPtr;
-
-typedef Host *HostPtr;
-
-typedef HostAction *HostActionPtr;
/*************
* Callbacks *
/*************
* Callbacks *
* @brief Callbacks handler which emit the callbacks after Host creation *
* @details Callback functions have the following signature: `void(HostPtr)`
*/
* @brief Callbacks handler which emit the callbacks after Host creation *
* @details Callback functions have the following signature: `void(HostPtr)`
*/
-XBT_PUBLIC_DATA(surf_callback(void, HostPtr)) hostCreatedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Host*)) hostCreatedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Host destruction *
* @details Callback functions have the following signature: `void(HostPtr)`
*/
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Host destruction *
* @details Callback functions have the following signature: `void(HostPtr)`
*/
-XBT_PUBLIC_DATA(surf_callback(void, HostPtr)) hostDestructedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Host*)) hostDestructedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Host State changed *
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Host State changed *
- * @details Callback functions have the following signature: `void(HostActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
+ * @details Callback functions have the following signature: `void(HostAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
-XBT_PUBLIC_DATA(surf_callback(void, HostPtr, e_surf_resource_state_t, e_surf_resource_state_t)) hostStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Host*, e_surf_resource_state_t, e_surf_resource_state_t)) hostStateChangedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after HostAction State changed *
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after HostAction State changed *
- * @details Callback functions have the following signature: `void(HostActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
+ * @details Callback functions have the following signature: `void(HostAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
-XBT_PUBLIC_DATA(surf_callback(void, HostActionPtr, e_surf_action_state_t, e_surf_action_state_t)) hostActionStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, HostAction*, e_surf_action_state_t, e_surf_action_state_t)) hostActionStateChangedCallbacks;
/*********
* Tools *
*********/
/*********
* Tools *
*********/
-XBT_PUBLIC_DATA(HostModelPtr) surf_host_model;
+XBT_PUBLIC_DATA(HostModel*) surf_host_model;
XBT_PUBLIC(void) host_parse_init(sg_platf_host_cbarg_t host);
XBT_PUBLIC(void) host_add_traces();
XBT_PUBLIC(void) host_parse_init(sg_platf_host_cbarg_t host);
XBT_PUBLIC(void) host_add_traces();
/** @brief HostModel destructor */
~HostModel();
/** @brief HostModel destructor */
~HostModel();
- virtual HostPtr createHost(const char *name)=0;
+ virtual Host *createHost(const char *name)=0;
void addTraces(){DIE_IMPOSSIBLE;}
/**
void addTraces(){DIE_IMPOSSIBLE;}
/**
* @param rate [description]
* @return [description]
*/
* @param rate [description]
* @return [description]
*/
- virtual ActionPtr executeParallelTask(int host_nb,
+ virtual Action *executeParallelTask(int host_nb,
void **host_list,
double *flops_amount,
double *bytes_amount,
void **host_list,
double *flops_amount,
double *bytes_amount,
* @param rate [description]
* @return [description]
*/
* @param rate [description]
* @return [description]
*/
- virtual ActionPtr communicate(HostPtr src, HostPtr dst, double size, double rate)=0;
+ virtual Action *communicate(Host *src, Host *dst, double size, double rate)=0;
- CpuModelPtr p_cpuModel;
* @param netElm The RoutingEdge associated to this Host
* @param cpu The Cpu associated to this Host
*/
* @param netElm The RoutingEdge associated to this Host
* @param cpu The Cpu associated to this Host
*/
- Host(ModelPtr model, const char *name, xbt_dict_t props,
- xbt_dynar_t storage, RoutingEdgePtr netElm, CpuPtr cpu);
+ Host(Model *model, const char *name, xbt_dict_t props,
+ xbt_dynar_t storage, RoutingEdge *netElm, Cpu *cpu);
/**
* @brief Host constructor
/**
* @brief Host constructor
* @param netElm The RoutingEdge associated to this Host
* @param cpu The Cpu associated to this Host
*/
* @param netElm The RoutingEdge associated to this Host
* @param cpu The Cpu associated to this Host
*/
- Host(ModelPtr model, const char *name, xbt_dict_t props,
- lmm_constraint_t constraint, xbt_dynar_t storage, RoutingEdgePtr netElm,
- CpuPtr cpu);
+ Host(Model *model, const char *name, xbt_dict_t props,
+ lmm_constraint_t constraint, xbt_dynar_t storage, RoutingEdge *netElm,
+ Cpu *cpu);
/** @brief Host destructor */
~ Host();
/** @brief Host destructor */
~ Host();
* @return The CpuAction corresponding to the processing
* @see Cpu
*/
* @return The CpuAction corresponding to the processing
* @see Cpu
*/
- virtual ActionPtr execute(double flops_amount)=0;
+ virtual Action *execute(double flops_amount)=0;
/**
* @brief Make a process sleep for duration seconds
/**
* @brief Make a process sleep for duration seconds
* @return The CpuAction corresponding to the sleeping
* @see Cpu
*/
* @return The CpuAction corresponding to the sleeping
* @see Cpu
*/
- virtual ActionPtr sleep(double duration)=0;
+ virtual Action *sleep(double duration)=0;
/**
* @brief Get the number of cores of the associated Cpu
/**
* @brief Get the number of cores of the associated Cpu
* @param storage The mount point
* @return The corresponding Storage
*/
* @param storage The mount point
* @return The corresponding Storage
*/
- virtual StoragePtr findStorageOnMountList(const char* storage);
+ virtual Storage *findStorageOnMountList(const char* storage);
/**
* @brief Get the xbt_dict_t of mount_point: Storage
/**
* @brief Get the xbt_dict_t of mount_point: Storage
*
* @return The StorageAction corresponding to the opening
*/
*
* @return The StorageAction corresponding to the opening
*/
- virtual ActionPtr open(const char* fullpath);
+ virtual Action *open(const char* fullpath);
/**
* @brief Close a file
/**
* @brief Close a file
* @param fd The file descriptor to close
* @return The StorageAction corresponding to the closing
*/
* @param fd The file descriptor to close
* @return The StorageAction corresponding to the closing
*/
- virtual ActionPtr close(surf_file_t fd);
+ virtual Action *close(surf_file_t fd);
/**
* @brief Unlink a file
/**
* @brief Unlink a file
* @param size The size in bytes to read
* @return The StorageAction corresponding to the reading
*/
* @param size The size in bytes to read
* @return The StorageAction corresponding to the reading
*/
- virtual ActionPtr read(surf_file_t fd, sg_size_t size);
+ virtual Action *read(surf_file_t fd, sg_size_t size);
/**
* @brief Write a file
/**
* @brief Write a file
* @param size The size in bytes to write
* @return The StorageAction corresponding to the writing
*/
* @param size The size in bytes to write
* @return The StorageAction corresponding to the writing
*/
- virtual ActionPtr write(surf_file_t fd, sg_size_t size);
+ virtual Action *write(surf_file_t fd, sg_size_t size);
/**
* @brief Get the informations of a file descriptor
/**
* @brief Get the informations of a file descriptor
virtual int fileMove(surf_file_t fd, const char* fullpath);
xbt_dynar_t p_storage;
virtual int fileMove(surf_file_t fd, const char* fullpath);
xbt_dynar_t p_storage;
- RoutingEdgePtr p_netElm;
- CpuPtr p_cpu;
+ RoutingEdge *p_netElm;
+ Cpu *p_cpu;
/**
* @brief Get the list of virtual machines on the current Host
/**
* @brief Get the list of virtual machines on the current Host
* @param cost The cost of this HostAction in [TODO]
* @param failed [description]
*/
* @param cost The cost of this HostAction in [TODO]
* @param failed [description]
*/
- HostAction(ModelPtr model, double cost, bool failed)
+ HostAction(Model *model, double cost, bool failed)
: Action(model, cost, failed) {}
/**
: Action(model, cost, failed) {}
/**
* @param failed [description]
* @param var The lmm variable associated to this StorageAction if it is part of a LMM component
*/
* @param failed [description]
* @param var The lmm variable associated to this StorageAction if it is part of a LMM component
*/
- HostAction(ModelPtr model, double cost, bool failed, lmm_variable_t var)
+ HostAction(Model *model, double cost, bool failed, lmm_variable_t var)
: Action(model, cost, failed, var) {}
void setState(e_surf_action_state_t state);
: Action(model, cost, failed, var) {}
void setState(e_surf_action_state_t state);
xbt_assert(!surf_network_model, "network model type already defined");
ptask_define_callbacks();
surf_host_model = new HostL07Model();
xbt_assert(!surf_network_model, "network model type already defined");
ptask_define_callbacks();
surf_host_model = new HostL07Model();
- ModelPtr model = surf_host_model;
+ Model *model = surf_host_model;
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
}
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
}
double HostL07Model::shareResources(double /*now*/)
{
double HostL07Model::shareResources(double /*now*/)
{
- HostL07ActionPtr action;
- ActionListPtr running_actions = getRunningActionSet();
+ ActionList *running_actions = getRunningActionSet();
double min = this->shareResourcesMaxMin(running_actions,
ptask_maxmin_system,
bottleneck_solve);
for(ActionList::iterator it(running_actions->begin()), itend(running_actions->end())
; it != itend ; ++it) {
double min = this->shareResourcesMaxMin(running_actions,
ptask_maxmin_system,
bottleneck_solve);
for(ActionList::iterator it(running_actions->begin()), itend(running_actions->end())
; it != itend ; ++it) {
- action = static_cast<HostL07ActionPtr>(&*it);
+ action = static_cast<HostL07Action*>(&*it);
if (action->m_latency > 0) {
if (min < 0) {
min = action->m_latency;
if (action->m_latency > 0) {
if (min < 0) {
min = action->m_latency;
void HostL07Model::updateActionsState(double /*now*/, double delta)
{
double deltap = 0.0;
void HostL07Model::updateActionsState(double /*now*/, double delta)
{
double deltap = 0.0;
- HostL07ActionPtr action;
- ActionListPtr actionSet = getRunningActionSet();
+ ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itNext = it, itend(actionSet->end())
; it != itend ; it=itNext) {
++itNext;
for(ActionList::iterator it(actionSet->begin()), itNext = it, itend(actionSet->end())
; it != itend ; it=itNext) {
++itNext;
- action = static_cast<HostL07ActionPtr>(&*it);
+ action = static_cast<HostL07Action*>(&*it);
deltap = delta;
if (action->m_latency > 0) {
if (action->m_latency > deltap) {
deltap = delta;
if (action->m_latency > 0) {
if (action->m_latency > deltap) {
i++))) {
constraint_id = lmm_constraint_id(cnst);
i++))) {
constraint_id = lmm_constraint_id(cnst);
- if (static_cast<HostPtr>(constraint_id)->getState() == SURF_RESOURCE_OFF) {
+ if (static_cast<Host*>(constraint_id)->getState() == SURF_RESOURCE_OFF) {
XBT_DEBUG("Action (%p) Failed!!", action);
action->finish();
action->setState(SURF_ACTION_FAILED);
XBT_DEBUG("Action (%p) Failed!!", action);
action->finish();
action->setState(SURF_ACTION_FAILED);
-ActionPtr HostL07Model::executeParallelTask(int host_nb,
+Action *HostL07Model::executeParallelTask(int host_nb,
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate)
{
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate)
{
- HostL07ActionPtr action;
int i, j;
unsigned int cpt;
int nb_link = 0;
int i, j;
unsigned int cpt;
int nb_link = 0;
double lat=0.0;
unsigned int cpt;
void *_link;
double lat=0.0;
unsigned int cpt;
void *_link;
- routing_platf->getRouteAndLatency(static_cast<HostL07Ptr>(host_list[i])->p_netElm,
- static_cast<HostL07Ptr>(host_list[j])->p_netElm,
+ routing_platf->getRouteAndLatency(static_cast<HostL07*>(host_list[i])->p_netElm,
+ static_cast<HostL07*>(host_list[j])->p_netElm,
&route,
&lat);
latency = MAX(latency, lat);
xbt_dynar_foreach(route, cpt, _link) {
&route,
&lat);
latency = MAX(latency, lat);
xbt_dynar_foreach(route, cpt, _link) {
- link = static_cast<LinkL07Ptr>(_link);
+ link = static_cast<LinkL07*>(_link);
xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, NULL);
}
}
xbt_dict_set(ptask_parallel_task_link_set, link->getName(), link, NULL);
}
}
action->m_suspended = 0; /* Should be useless because of the
calloc but it seems to help valgrind... */
action->m_hostNb = host_nb;
action->m_suspended = 0; /* Should be useless because of the
calloc but it seems to help valgrind... */
action->m_hostNb = host_nb;
- action->p_hostList = (HostPtr *) host_list;
+ action->p_hostList = (Host **) host_list;
action->p_computationAmount = flops_amount;
action->p_communicationAmount = bytes_amount;
action->m_latency = latency;
action->p_computationAmount = flops_amount;
action->p_communicationAmount = bytes_amount;
action->m_latency = latency;
for (i = 0; i < host_nb; i++)
lmm_expand(ptask_maxmin_system,
for (i = 0; i < host_nb; i++)
lmm_expand(ptask_maxmin_system,
- static_cast<HostL07Ptr>(host_list[i])->p_cpu->getConstraint(),
+ static_cast<HostL07*>(host_list[i])->p_cpu->getConstraint(),
action->getVariable(), flops_amount[i]);
for (i = 0; i < host_nb; i++) {
for (j = 0; j < host_nb; j++) {
void *_link;
action->getVariable(), flops_amount[i]);
for (i = 0; i < host_nb; i++) {
for (j = 0; j < host_nb; j++) {
void *_link;
xbt_dynar_t route=NULL;
if (bytes_amount[i * host_nb + j] == 0.0)
continue;
xbt_dynar_t route=NULL;
if (bytes_amount[i * host_nb + j] == 0.0)
continue;
- routing_platf->getRouteAndLatency(static_cast<HostL07Ptr>(host_list[i])->p_netElm,
- static_cast<HostL07Ptr>(host_list[j])->p_netElm,
+ routing_platf->getRouteAndLatency(static_cast<HostL07*>(host_list[i])->p_netElm,
+ static_cast<HostL07*>(host_list[j])->p_netElm,
&route, NULL);
xbt_dynar_foreach(route, cpt, _link) {
&route, NULL);
xbt_dynar_foreach(route, cpt, _link) {
- link = static_cast<LinkL07Ptr>(_link);
+ link = static_cast<LinkL07*>(_link);
lmm_expand_add(ptask_maxmin_system, link->getConstraint(),
action->getVariable(),
bytes_amount[i * host_nb + j]);
lmm_expand_add(ptask_maxmin_system, link->getConstraint(),
action->getVariable(),
bytes_amount[i * host_nb + j]);
-HostPtr HostL07Model::createHost(const char *name)
+Host *HostL07Model::createHost(const char *name)
sg_host_t sg_host = sg_host_by_name(name);
xbt_assert(!surf_host_resource_priv(sg_host),
sg_host_t sg_host = sg_host_by_name(name);
xbt_assert(!surf_host_resource_priv(sg_host),
return wk;//FIXME:xbt_lib_get_elm_or_null(host_lib, name);
}
return wk;//FIXME:xbt_lib_get_elm_or_null(host_lib, name);
}
-ActionPtr HostL07Model::communicate(HostPtr src, HostPtr dst,
+Action *HostL07Model::communicate(Host *src, Host *dst,
double size, double rate)
{
void **host_list = xbt_new0(void *, 2);
double *flops_amount = xbt_new0(double, 2);
double *bytes_amount = xbt_new0(double, 4);
double size, double rate)
{
void **host_list = xbt_new0(void *, 2);
double *flops_amount = xbt_new0(double, 2);
double *bytes_amount = xbt_new0(double, 4);
host_list[0] = src;
host_list[1] = dst;
host_list[0] = src;
host_list[1] = dst;
-xbt_dynar_t HostL07Model::getRoute(HostPtr src, HostPtr dst)
+xbt_dynar_t HostL07Model::getRoute(Host *src, Host *dst)
{
xbt_dynar_t route=NULL;
routing_platf->getRouteAndLatency(src->p_netElm, dst->p_netElm, &route, NULL);
return route;
}
{
xbt_dynar_t route=NULL;
routing_platf->getRouteAndLatency(src->p_netElm, dst->p_netElm, &route, NULL);
return route;
}
-CpuPtr CpuL07Model::createCpu(const char *name, xbt_dynar_t powerPeak,
+Cpu *CpuL07Model::createCpu(const char *name, xbt_dynar_t powerPeak,
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
"Host '%s' declared several times in the platform file.",
name);
"Host '%s' declared several times in the platform file.",
name);
- CpuL07Ptr cpu = new CpuL07(this, name, cpu_properties,
+ CpuL07 *cpu = new CpuL07(this, name, cpu_properties,
power_initial, power_scale, power_trace,
core, state_initial, state_trace);
power_initial, power_scale, power_trace,
core, state_initial, state_trace);
"Link '%s' declared several times in the platform file.",
name);
"Link '%s' declared several times in the platform file.",
name);
- LinkL07Ptr nw_link = new LinkL07(this, name, properties,
+ LinkL07 *nw_link = new LinkL07(this, name, properties,
bw_initial, bw_trace,
lat_initial, lat_trace,
state_initial, state_trace,
bw_initial, bw_trace,
lat_initial, lat_trace,
state_initial, state_trace,
/* Connect traces relative to cpu */
xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
/* Connect traces relative to cpu */
xbt_dict_foreach(trace_connect_list_host_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- CpuL07Ptr host = static_cast<CpuL07Ptr>(sg_host_surfcpu(sg_host_by_name(elm)));
+ CpuL07 *host = static_cast<CpuL07*>(sg_host_surfcpu(sg_host_by_name(elm)));
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
xbt_dict_foreach(trace_connect_list_power, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- CpuL07Ptr host = static_cast<CpuL07Ptr>(sg_host_surfcpu(sg_host_by_name(elm)));
+ CpuL07 *host = static_cast<CpuL07*>(sg_host_surfcpu(sg_host_by_name(elm)));
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_assert(host, "Host %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
/* Connect traces relative to network */
xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
/* Connect traces relative to network */
xbt_dict_foreach(trace_connect_list_link_avail, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- LinkL07Ptr link = static_cast<LinkL07Ptr>(Link::byName(elm));
+ LinkL07 *link = static_cast<LinkL07*>(Link::byName(elm));
xbt_assert(link, "Link %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_assert(link, "Link %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
xbt_dict_foreach(trace_connect_list_bandwidth, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- LinkL07Ptr link = static_cast<LinkL07Ptr>(Link::byName(elm));
+ LinkL07 *link = static_cast<LinkL07*>(Link::byName(elm));
xbt_assert(link, "Link %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_assert(link, "Link %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
xbt_dict_foreach(trace_connect_list_latency, cursor, trace_name, elm) {
tmgr_trace_t trace = (tmgr_trace_t) xbt_dict_get_or_null(traces_set_list, trace_name);
- LinkL07Ptr link = static_cast<LinkL07Ptr>(Link::byName(elm));
+ LinkL07 *link = static_cast<LinkL07*>(Link::byName(elm));
xbt_assert(link, "Link %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
xbt_assert(link, "Link %s undefined", elm);
xbt_assert(trace, "Trace %s undefined", trace_name);
* Resource *
************/
* Resource *
************/
-HostL07::HostL07(HostModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu)
+HostL07::HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu)
: Host(model, name, props, NULL, netElm, cpu)
{
}
: Host(model, name, props, NULL, netElm, cpu)
{
}
-CpuL07::CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t props,
+CpuL07::CpuL07(CpuL07Model *model, const char* name, xbt_dict_t props,
double power_initial, double power_scale, tmgr_trace_t power_trace,
int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace)
: Cpu(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, power_initial * power_scale),
double power_initial, double power_scale, tmgr_trace_t power_trace,
int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace)
: Cpu(model, name, props, lmm_constraint_new(ptask_maxmin_system, this, power_initial * power_scale),
p_stateEvent = tmgr_history_add_trace(history, state_trace, 0.0, 0, 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,
+LinkL07::LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
double bw_initial,
tmgr_trace_t bw_trace,
double lat_initial,
double bw_initial,
tmgr_trace_t bw_trace,
double lat_initial,
return p_cpu->getState();
}
return p_cpu->getState();
}
-ActionPtr HostL07::execute(double size)
+Action *HostL07::execute(double size)
{
void **host_list = xbt_new0(void *, 1);
double *flops_amount = xbt_new0(double, 1);
{
void **host_list = xbt_new0(void *, 1);
double *flops_amount = xbt_new0(double, 1);
bytes_amount[0] = 0.0;
flops_amount[0] = size;
bytes_amount[0] = 0.0;
flops_amount[0] = size;
- return static_cast<HostL07ModelPtr>(getModel())->executeParallelTask(1, host_list,
+ return static_cast<HostL07Model*>(getModel())->executeParallelTask(1, host_list,
flops_amount,
bytes_amount, -1);
}
flops_amount,
bytes_amount, -1);
}
-ActionPtr HostL07::sleep(double duration)
+Action *HostL07::sleep(double duration)
- HostL07ActionPtr action = NULL;
+ HostL07Action *action = NULL;
XBT_IN("(%s,%g)", getName(), duration);
XBT_IN("(%s,%g)", getName(), duration);
- action = static_cast<HostL07ActionPtr>(execute(1.0));
+ action = static_cast<HostL07Action*>(execute(1.0));
action->m_maxDuration = duration;
action->m_suspended = 2;
lmm_update_variable_weight(ptask_maxmin_system, action->getVariable(), 0.0);
action->m_maxDuration = duration;
action->m_suspended = 2;
lmm_update_variable_weight(ptask_maxmin_system, action->getVariable(), 0.0);
void LinkL07::updateLatency(double value, double date)
{
lmm_variable_t var = NULL;
void LinkL07::updateLatency(double value, double date)
{
lmm_variable_t var = NULL;
- HostL07ActionPtr action;
lmm_element_t elem = NULL;
m_latCurrent = value;
while ((var = lmm_get_var_from_cnst(ptask_maxmin_system, getConstraint(), &elem))) {
lmm_element_t elem = NULL;
m_latCurrent = value;
while ((var = lmm_get_var_from_cnst(ptask_maxmin_system, getConstraint(), &elem))) {
- action = (HostL07ActionPtr) lmm_variable_id(var);
+ action = static_cast<HostL07Action*>(lmm_variable_id(var));
action->updateBound();
}
}
action->updateBound();
}
}
if (p_communicationAmount[i * m_hostNb + j] > 0) {
double lat = 0.0;
if (p_communicationAmount[i * m_hostNb + j] > 0) {
double lat = 0.0;
- routing_platf->getRouteAndLatency(static_cast<HostL07Ptr>(((void**)p_hostList)[i])->p_netElm,
- static_cast<HostL07Ptr>(((void**)p_hostList)[j])->p_netElm,
+ routing_platf->getRouteAndLatency(static_cast<HostL07*>(((void**)p_hostList)[i])->p_netElm,
+ static_cast<HostL07*>(((void**)p_hostList)[j])->p_netElm,
&route, &lat);
lat_current = MAX(lat_current, lat * p_communicationAmount[i * m_hostNb + j]);
&route, &lat);
lat_current = MAX(lat_current, lat * p_communicationAmount[i * m_hostNb + j]);
***********/
class HostL07Model;
***********/
class HostL07Model;
-typedef HostL07Model *HostL07ModelPtr;
-
-typedef CpuL07Model *CpuL07ModelPtr;
-
-typedef NetworkL07Model *NetworkL07ModelPtr;
-typedef HostL07 *HostL07Ptr;
-
-typedef CpuL07 *CpuL07Ptr;
-
-typedef LinkL07 *LinkL07Ptr;
-typedef HostL07Action *HostL07ActionPtr;
double shareResources(double now);
void updateActionsState(double now, double delta);
double shareResources(double now);
void updateActionsState(double now, double delta);
- HostPtr createHost(const char *name);
- ActionPtr executeParallelTask(int host_nb,
+ Host *createHost(const char *name);
+ Action *executeParallelTask(int host_nb,
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate);
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate);
- xbt_dynar_t getRoute(HostPtr src, HostPtr dst);
- ActionPtr communicate(HostPtr src, HostPtr dst, double size, double rate);
+ xbt_dynar_t getRoute(Host *src, Host *dst);
+ Action *communicate(Host *src, Host *dst, double size, double rate);
- NetworkModelPtr p_networkModel;
+ NetworkModel *p_networkModel;
};
class CpuL07Model : public CpuModel {
public:
CpuL07Model() : CpuModel("cpuL07") {};
~CpuL07Model() {surf_cpu_model_pm = NULL;};
};
class CpuL07Model : public CpuModel {
public:
CpuL07Model() : CpuModel("cpuL07") {};
~CpuL07Model() {surf_cpu_model_pm = NULL;};
- CpuPtr createCpu(const char *name, xbt_dynar_t powerPeak,
+ Cpu *createCpu(const char *name, xbt_dynar_t powerPeak,
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
int pstate, double power_scale,
tmgr_trace_t power_trace, int core,
e_surf_resource_state_t state_initial,
xbt_dict_t cpu_properties);
void addTraces() {DIE_IMPOSSIBLE;};
xbt_dict_t cpu_properties);
void addTraces() {DIE_IMPOSSIBLE;};
- HostL07ModelPtr p_hostModel;
+ HostL07Model *p_hostModel;
};
class NetworkL07Model : public NetworkModel {
};
class NetworkL07Model : public NetworkModel {
e_surf_link_sharing_policy_t
policy, xbt_dict_t properties);
e_surf_link_sharing_policy_t
policy, xbt_dict_t properties);
- ActionPtr communicate(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, double /*size*/, double /*rate*/) {DIE_IMPOSSIBLE;};
+ Action *communicate(RoutingEdge */*src*/, RoutingEdge */*dst*/, double /*size*/, double /*rate*/) {DIE_IMPOSSIBLE;};
void addTraces() {DIE_IMPOSSIBLE;};
void addTraces() {DIE_IMPOSSIBLE;};
- HostL07ModelPtr p_hostModel;
+ HostL07Model *p_hostModel;
class HostL07 : public Host {
public:
class HostL07 : public Host {
public:
- HostL07(HostModelPtr model, const char* name, xbt_dict_t props, RoutingEdgePtr netElm, CpuPtr cpu);
+ HostL07(HostModel *model, const char* name, xbt_dict_t props, RoutingEdge *netElm, Cpu *cpu);
//bool isUsed();
bool isUsed() {DIE_IMPOSSIBLE;};
void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
//bool isUsed();
bool isUsed() {DIE_IMPOSSIBLE;};
void updateState(tmgr_trace_event_t /*event_type*/, double /*value*/, double /*date*/) {DIE_IMPOSSIBLE;};
- ActionPtr execute(double size);
- ActionPtr sleep(double duration);
+ Action *execute(double size);
+ Action *sleep(double duration);
e_surf_resource_state_t getState();
double getPowerPeakAt(int pstate_index);
int getNbPstates();
e_surf_resource_state_t getState();
double getPowerPeakAt(int pstate_index);
int getNbPstates();
tmgr_trace_event_t p_stateEvent;
tmgr_trace_event_t p_powerEvent;
public:
tmgr_trace_event_t p_stateEvent;
tmgr_trace_event_t p_powerEvent;
public:
- CpuL07(CpuL07ModelPtr model, const char* name, xbt_dict_t properties,
+ CpuL07(CpuL07Model *model, const char* name, xbt_dict_t properties,
double power_scale, double power_initial, tmgr_trace_t power_trace,
int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
bool isUsed();
//bool isUsed() {DIE_IMPOSSIBLE;};
void updateState(tmgr_trace_event_t event_type, double value, double date);
double power_scale, double power_initial, tmgr_trace_t power_trace,
int core, e_surf_resource_state_t state_initial, tmgr_trace_t state_trace);
bool isUsed();
//bool isUsed() {DIE_IMPOSSIBLE;};
void updateState(tmgr_trace_event_t event_type, double value, double date);
- CpuActionPtr execute(double /*size*/) {DIE_IMPOSSIBLE;};
- CpuActionPtr sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
+ CpuAction *execute(double /*size*/) {DIE_IMPOSSIBLE;};
+ CpuAction *sleep(double /*duration*/) {DIE_IMPOSSIBLE;};
double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
double getCurrentPowerPeak() {THROW_UNIMPLEMENTED;};
double getPowerPeakAt(int /*pstate_index*/) {THROW_UNIMPLEMENTED;};
class LinkL07 : public Link {
public:
class LinkL07 : public Link {
public:
- LinkL07(NetworkL07ModelPtr model, const char* name, xbt_dict_t props,
+ LinkL07(NetworkL07Model *model, const char* name, xbt_dict_t props,
double bw_initial,
tmgr_trace_t bw_trace,
double lat_initial,
double bw_initial,
tmgr_trace_t bw_trace,
double lat_initial,
* Action *
**********/
class HostL07Action : public HostAction {
* Action *
**********/
class HostL07Action : public HostAction {
- friend ActionPtr HostL07::execute(double size);
- friend ActionPtr HostL07::sleep(double duration);
- friend ActionPtr HostL07Model::executeParallelTask(int host_nb,
+ friend Action *HostL07::execute(double size);
+ friend Action *HostL07::sleep(double duration);
+ friend Action *HostL07Model::executeParallelTask(int host_nb,
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate);
public:
void **host_list,
double *flops_amount,
double *bytes_amount,
double rate);
public:
- HostL07Action(ModelPtr model, double cost, bool failed)
+ HostL07Action(Model *model, double cost, bool failed)
: HostAction(model, cost, failed) {};
~HostL07Action();
: HostAction(model, cost, failed) {};
~HostL07Action();
double getRemains();
int m_hostNb;
double getRemains();
int m_hostNb;
double *p_computationAmount;
double *p_communicationAmount;
double m_latency;
double *p_computationAmount;
double *p_communicationAmount;
double m_latency;
cnst->usage = elem->value / elem->variable->weight;
make_elem_active(elem);
cnst->usage = elem->value / elem->variable->weight;
make_elem_active(elem);
- ActionPtr action = static_cast<ActionPtr>(elem->variable->id);
+ Action *action = static_cast<Action*>(elem->variable->id);
if (sys->keep_track && !action->is_linked())
sys->keep_track->push_back(*action);
}
if (sys->keep_track && !action->is_linked())
sys->keep_track->push_back(*action);
}
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
- ModelPtr model = surf_network_model;
+ Model *model = surf_network_model;
xbt_dynar_push(model_list, &model);
xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",
xbt_dynar_push(model_list, &model);
xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor",
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
- ModelPtr model = surf_network_model;
+ Model *model = surf_network_model;
xbt_dynar_push(model_list, &model);
xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 1.0);
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();
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
- ModelPtr model = surf_network_model;
+ Model *model = surf_network_model;
xbt_dynar_push(model_list, &model);
lmm_set_default_protocol_function(func_reno_f, func_reno_fp,
func_reno_fpi);
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();
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
- ModelPtr model = surf_network_model;
+ Model *model = surf_network_model;
xbt_dynar_push(model_list, &model);
lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp,
func_reno2_fpi);
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();
surf_network_model = new NetworkCm02Model();
net_define_callbacks();
- ModelPtr model = surf_network_model;
+ Model *model = surf_network_model;
xbt_dynar_push(model_list, &model);
lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp,
func_vegas_fpi);
xbt_dynar_push(model_list, &model);
lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp,
func_vegas_fpi);
void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
{
void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/)
{
- NetworkCm02ActionPtr action;
+ NetworkCm02Action *action;
while ((xbt_heap_size(p_actionHeap) > 0)
&& (double_equals(xbt_heap_maxkey(p_actionHeap), now, sg_surf_precision))) {
while ((xbt_heap_size(p_actionHeap) > 0)
&& (double_equals(xbt_heap_maxkey(p_actionHeap), now, sg_surf_precision))) {
- action = (NetworkCm02ActionPtr) xbt_heap_pop(p_actionHeap);
+ action = static_cast<NetworkCm02Action*> (xbt_heap_pop(p_actionHeap));
XBT_DEBUG("Something happened to action %p", action);
if (TRACE_is_enabled()) {
int n = lmm_get_number_of_cnst_from_var(p_maxminSystem, action->getVariable());
XBT_DEBUG("Something happened to action %p", action);
if (TRACE_is_enabled()) {
int n = lmm_get_number_of_cnst_from_var(p_maxminSystem, action->getVariable());
void NetworkCm02Model::updateActionsStateFull(double now, double delta)
{
void NetworkCm02Model::updateActionsStateFull(double now, double delta)
{
- NetworkCm02ActionPtr action;
- ActionListPtr running_actions = getRunningActionSet();
+ NetworkCm02Action *action;
+ ActionList *running_actions = getRunningActionSet();
for(ActionList::iterator it(running_actions->begin()), itNext=it, itend(running_actions->end())
; it != itend ; it=itNext) {
++itNext;
for(ActionList::iterator it(running_actions->begin()), itNext=it, itend(running_actions->end())
; it != itend ; it=itNext) {
++itNext;
- action = (NetworkCm02ActionPtr) &*it;
+ action = static_cast<NetworkCm02Action*> (&*it);
XBT_DEBUG("Something happened to action %p", action);
double deltap = delta;
if (action->m_latency > 0) {
XBT_DEBUG("Something happened to action %p", action);
double deltap = delta;
if (action->m_latency > 0) {
-ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst,
double size, double rate)
{
unsigned int i;
void *_link;
NetworkCm02Link *link;
int failed = 0;
double size, double rate)
{
unsigned int i;
void *_link;
NetworkCm02Link *link;
int failed = 0;
- NetworkCm02ActionPtr action = NULL;
+ NetworkCm02Action *action = NULL;
double bandwidth_bound;
double latency = 0.0;
xbt_dynar_t back_route = NULL;
int constraints_per_variable = 0;
double bandwidth_bound;
double latency = 0.0;
xbt_dynar_t back_route = NULL;
int constraints_per_variable = 0;
- xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdgePtr), NULL);
+ xbt_dynar_t route = xbt_dynar_new(sizeof(RoutingEdge*), NULL);
XBT_IN("(%s,%s,%g,%g)", src->getName(), dst->getName(), size, rate);
XBT_IN("(%s,%s,%g,%g)", src->getName(), dst->getName(), size, rate);
/************
* Resource *
************/
/************
* Resource *
************/
-NetworkCm02Link::NetworkCm02Link(NetworkCm02ModelPtr model, const char *name, xbt_dict_t props,
+NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
lmm_system_t system,
double constraint_value,
tmgr_history_t history,
lmm_system_t system,
double constraint_value,
tmgr_history_t history,
setState(SURF_RESOURCE_OFF);
while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), cnst, &elem))) {
setState(SURF_RESOURCE_OFF);
while ((var = lmm_get_var_from_cnst(getModel()->getMaxminSystem(), cnst, &elem))) {
- ActionPtr action = (ActionPtr) lmm_variable_id(var);
+ Action *action = static_cast<Action*>( lmm_variable_id(var) );
if (action->getState() == SURF_ACTION_RUNNING ||
action->getState() == SURF_ACTION_READY) {
if (action->getState() == SURF_ACTION_RUNNING ||
action->getState() == SURF_ACTION_READY) {
lmm_element_t nextelem = NULL;
int numelem = 0;
lmm_element_t nextelem = NULL;
int numelem = 0;
- NetworkCm02ActionPtr action = NULL;
+ NetworkCm02Action *action = NULL;
p_power.peak = value;
lmm_update_constraint_bound(getModel()->getMaxminSystem(),
p_power.peak = value;
lmm_update_constraint_bound(getModel()->getMaxminSystem(),
TRACE_surf_link_set_bandwidth(date, getName(), sg_bandwidth_factor * p_power.peak * p_power.scale);
if (sg_weight_S_parameter > 0) {
while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
TRACE_surf_link_set_bandwidth(date, getName(), sg_bandwidth_factor * p_power.peak * p_power.scale);
if (sg_weight_S_parameter > 0) {
while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
- action = (NetworkCm02ActionPtr) lmm_variable_id(var);
+ action = (NetworkCm02Action*) lmm_variable_id(var);
action->m_weight += delta;
if (!action->isSuspended())
lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
action->m_weight += delta;
if (!action->isSuspended())
lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight);
lmm_element_t elem = NULL;
lmm_element_t nextelem = NULL;
int numelem = 0;
lmm_element_t elem = NULL;
lmm_element_t nextelem = NULL;
int numelem = 0;
- NetworkCm02ActionPtr action = NULL;
+ NetworkCm02Action *action = NULL;
m_latCurrent = value;
while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
m_latCurrent = value;
while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) {
- action = (NetworkCm02ActionPtr) lmm_variable_id(var);
+ action = (NetworkCm02Action*) lmm_variable_id(var);
action->m_latCurrent += delta;
action->m_weight += delta;
if (action->m_rate < 0)
action->m_latCurrent += delta;
action->m_weight += delta;
if (action->m_rate < 0)
* Classes *
***********/
class NetworkCm02Model;
* Classes *
***********/
class NetworkCm02Model;
-typedef NetworkCm02Model *NetworkCm02ModelPtr;
-
-typedef NetworkCm02Action *NetworkCm02ActionPtr;
void addTraces();
void updateActionsStateLazy(double now, double delta);
void updateActionsStateFull(double now, double delta);
void addTraces();
void updateActionsStateLazy(double now, double delta);
void updateActionsStateFull(double now, double delta);
- ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+ Action *communicate(RoutingEdge *src, RoutingEdge *dst,
double size, double rate);
};
double size, double rate);
};
class NetworkCm02Link : public Link {
public:
class NetworkCm02Link : public Link {
public:
- NetworkCm02Link(NetworkCm02ModelPtr model, const char *name, xbt_dict_t props,
+ NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props,
lmm_system_t system,
double constraint_value,
tmgr_history_t history,
lmm_system_t system,
double constraint_value,
tmgr_history_t history,
**********/
class NetworkCm02Action : public NetworkAction {
**********/
class NetworkCm02Action : public NetworkAction {
- friend ActionPtr NetworkCm02Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate);
+ friend Action *NetworkCm02Model::communicate(RoutingEdge *src, RoutingEdge *dst, double size, double rate);
- NetworkCm02Action(ModelPtr model, double cost, bool failed)
+ NetworkCm02Action(Model *model, double cost, bool failed)
: NetworkAction(model, cost, failed) {};
void updateRemainingLazy(double now);
void recycle();
: NetworkAction(model, cost, failed) {};
void updateRemainingLazy(double now);
void recycle();
sg_platf_host_add_cb(netcste_count_hosts);
sg_platf_host_add_cb(netcste_count_hosts);
- ModelPtr model = surf_network_model;
+ Model *model = surf_network_model;
xbt_dynar_push(model_list, &model);
}
double NetworkConstantModel::shareResources(double /*now*/)
{
xbt_dynar_push(model_list, &model);
}
double NetworkConstantModel::shareResources(double /*now*/)
{
- NetworkConstantActionPtr action = NULL;
+ NetworkConstantAction *action = NULL;
- ActionListPtr actionSet = getRunningActionSet();
+ ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itend(actionSet->end())
; it != itend ; ++it) {
for(ActionList::iterator it(actionSet->begin()), itend(actionSet->end())
; it != itend ; ++it) {
- action = static_cast<NetworkConstantActionPtr>(&*it);
+ action = static_cast<NetworkConstantAction*>(&*it);
if (action->m_latency > 0 && (min < 0 || action->m_latency < min))
min = action->m_latency;
}
if (action->m_latency > 0 && (min < 0 || action->m_latency < min))
min = action->m_latency;
}
void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
{
void NetworkConstantModel::updateActionsState(double /*now*/, double delta)
{
- NetworkConstantActionPtr action = NULL;
- ActionListPtr actionSet = getRunningActionSet();
+ NetworkConstantAction *action = NULL;
+ ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
; it != itend ; it=itNext) {
++itNext;
for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
; it != itend ; it=itNext) {
++itNext;
- action = static_cast<NetworkConstantActionPtr>(&*it);
+ action = static_cast<NetworkConstantAction*>(&*it);
if (action->m_latency > 0) {
if (action->m_latency > delta) {
double_update(&(action->m_latency), delta, sg_surf_precision);
if (action->m_latency > 0) {
if (action->m_latency > delta) {
double_update(&(action->m_latency), delta, sg_surf_precision);
-ActionPtr NetworkConstantModel::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+Action *NetworkConstantModel::communicate(RoutingEdge *src, RoutingEdge *dst,
double size, double rate)
{
char *src_name = src->getName();
char *dst_name = dst->getName();
XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
double size, double rate)
{
char *src_name = src->getName();
char *dst_name = dst->getName();
XBT_IN("(%s,%s,%g,%g)", src_name, dst_name, size, rate);
- NetworkConstantActionPtr action = new NetworkConstantAction(this, size, sg_latency_factor);
+ NetworkConstantAction *action = new NetworkConstantAction(this, size, sg_latency_factor);
XBT_OUT();
surf_callback_emit(networkCommunicateCallbacks, action, src, dst, size, rate);
XBT_OUT();
surf_callback_emit(networkCommunicateCallbacks, action, src, dst, size, rate);
* Classes *
***********/
class NetworkConstantModel;
* Classes *
***********/
class NetworkConstantModel;
-typedef NetworkConstantModel *NetworkConstantModelPtr;
-
class NetworkConstantAction;
class NetworkConstantAction;
-typedef NetworkConstantAction *NetworkConstantActionPtr;
};
double shareResources(double now);
void updateActionsState(double now, double delta);
};
double shareResources(double now);
void updateActionsState(double now, double delta);
- ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+ Action *communicate(RoutingEdge *src, RoutingEdge *dst,
double size, double rate);
double size, double rate);
- void gapRemove(ActionPtr action);
+ void gapRemove(Action *action);
************/
class NetworkConstantLink : public NetworkCm02Link {
public:
************/
class NetworkConstantLink : public NetworkCm02Link {
public:
- NetworkConstantLink(NetworkCm02ModelPtr model, const char* name, xbt_dict_t properties);
+ NetworkConstantLink(NetworkCm02Model *model, const char* name, xbt_dict_t properties);
bool isUsed();
void updateState(tmgr_trace_event_t event_type, double value, double date);
double getBandwidth();
bool isUsed();
void updateState(tmgr_trace_event_t event_type, double value, double date);
double getBandwidth();
**********/
class NetworkConstantAction : public NetworkCm02Action {
public:
**********/
class NetworkConstantAction : public NetworkCm02Action {
public:
- NetworkConstantAction(NetworkConstantModelPtr model_, double size, double latency)
+ NetworkConstantAction(NetworkConstantModel *model_, double size, double latency)
: NetworkCm02Action(model_, size, false)
, m_latInit(latency)
{
: NetworkCm02Action(model_, size, false)
, m_latInit(latency)
{
-static void IB_action_state_changed_callback(NetworkActionPtr action, e_surf_action_state_t statein, e_surf_action_state_t stateout){
+static void IB_action_state_changed_callback(NetworkAction *action, e_surf_action_state_t statein, e_surf_action_state_t stateout){
if(statein!=SURF_ACTION_RUNNING|| stateout!=SURF_ACTION_DONE)
return;
std::pair<IBNode*,IBNode*> pair = ((NetworkIBModel*)surf_network_model)->active_comms[action];
if(statein!=SURF_ACTION_RUNNING|| stateout!=SURF_ACTION_DONE)
return;
std::pair<IBNode*,IBNode*> pair = ((NetworkIBModel*)surf_network_model)->active_comms[action];
-static void IB_action_init_callback(NetworkActionPtr action,RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate){
+static void IB_action_init_callback(NetworkAction *action,RoutingEdge *src, RoutingEdge *dst, double size, double rate){
if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL)
xbt_die("IB comm added, without any node connected !");
if(((NetworkIBModel*)surf_network_model)->active_nodes==NULL)
xbt_die("IB comm added, without any node connected !");
-void NetworkIBModel::updateIBfactors(NetworkActionPtr action, IBNode *from, IBNode * to, int remove) {
+void NetworkIBModel::updateIBfactors(NetworkAction *action, IBNode *from, IBNode * to, int remove) {
if (from == to)//disregard local comms (should use loopback)
return;
if (from == to)//disregard local comms (should use loopback)
return;
public :
//IBNode* origin;
IBNode* destination;
public :
//IBNode* origin;
IBNode* destination;
- NetworkActionPtr action;
double init_rate;
ActiveComm() : destination(NULL),action(NULL),init_rate(-1){};
~ActiveComm(){};
double init_rate;
ActiveComm() : destination(NULL),action(NULL),init_rate(-1){};
~ActiveComm(){};
NetworkIBModel();
NetworkIBModel(const char *name);
~NetworkIBModel();
NetworkIBModel();
NetworkIBModel(const char *name);
~NetworkIBModel();
- void updateIBfactors(NetworkActionPtr action, IBNode *from, IBNode * to, int remove);
+ void updateIBfactors(NetworkAction *action, IBNode *from, IBNode * to, int remove);
- std::map<NetworkActionPtr , std::pair<IBNode*,IBNode*> > active_comms;
+ std::map<NetworkAction *, std::pair<IBNode*,IBNode*> > active_comms;
surf_callback(void, Link*) networkLinkCreatedCallbacks;
surf_callback(void, Link*) networkLinkDestructedCallbacks;
surf_callback(void, Link*, e_surf_resource_state_t, e_surf_resource_state_t) networkLinkStateChangedCallbacks;
surf_callback(void, Link*) networkLinkCreatedCallbacks;
surf_callback(void, Link*) networkLinkDestructedCallbacks;
surf_callback(void, Link*, e_surf_resource_state_t, e_surf_resource_state_t) networkLinkStateChangedCallbacks;
-surf_callback(void, NetworkActionPtr, e_surf_action_state_t, e_surf_action_state_t) networkActionStateChangedCallbacks;
-surf_callback(void, NetworkActionPtr, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate) networkCommunicateCallbacks;
+surf_callback(void, NetworkAction*, e_surf_action_state_t, e_surf_action_state_t) networkActionStateChangedCallbacks;
+surf_callback(void, NetworkAction*, RoutingEdge *src, RoutingEdge *dst, double size, double rate) networkCommunicateCallbacks;
void netlink_parse_init(sg_platf_link_cbarg_t link){
if (link->policy == SURF_LINK_FULLDUPLEX) {
void netlink_parse_init(sg_platf_link_cbarg_t link){
if (link->policy == SURF_LINK_FULLDUPLEX) {
-NetworkModelPtr surf_network_model = NULL;
+NetworkModel *surf_network_model = NULL;
double NetworkModel::latencyFactor(double /*size*/) {
return sg_latency_factor;
double NetworkModel::latencyFactor(double /*size*/) {
return sg_latency_factor;
double NetworkModel::shareResourcesFull(double now)
{
double NetworkModel::shareResourcesFull(double now)
{
- NetworkActionPtr action = NULL;
- ActionListPtr runningActions = surf_network_model->getRunningActionSet();
+ NetworkAction *action = NULL;
+ ActionList *runningActions = surf_network_model->getRunningActionSet();
double minRes;
minRes = shareResourcesMaxMin(runningActions, surf_network_model->p_maxminSystem, surf_network_model->f_networkSolve);
for(ActionList::iterator it(runningActions->begin()), itend(runningActions->end())
; it != itend ; ++it) {
double minRes;
minRes = shareResourcesMaxMin(runningActions, surf_network_model->p_maxminSystem, surf_network_model->f_networkSolve);
for(ActionList::iterator it(runningActions->begin()), itend(runningActions->end())
; it != itend ; ++it) {
- action = static_cast<NetworkActionPtr>(&*it);
+ action = static_cast<NetworkAction*>(&*it);
#ifdef HAVE_LATENCY_BOUND_TRACKING
if (lmm_is_variable_limited_by_latency(action->getVariable())) {
action->m_latencyLimited = 1;
#ifdef HAVE_LATENCY_BOUND_TRACKING
if (lmm_is_variable_limited_by_latency(action->getVariable())) {
action->m_latencyLimited = 1;
* Resource *
************/
* Resource *
************/
-Link::Link(NetworkModelPtr model, const char *name, xbt_dict_t props)
+Link::Link(NetworkModel *model, const char *name, xbt_dict_t props)
: Resource(model, name, props)
, p_latEvent(NULL)
{
: Resource(model, name, props)
, p_latEvent(NULL)
{
XBT_DEBUG("Create link '%s'",name);
}
XBT_DEBUG("Create link '%s'",name);
}
-Link::Link(NetworkModelPtr model, const char *name, xbt_dict_t props,
+Link::Link(NetworkModel *model, const char *name, xbt_dict_t props,
lmm_constraint_t constraint,
tmgr_history_t history,
tmgr_trace_t state_trace)
lmm_constraint_t constraint,
tmgr_history_t history,
tmgr_trace_t state_trace)
* Classes *
***********/
class NetworkModel;
* Classes *
***********/
class NetworkModel;
-typedef NetworkModel *NetworkModelPtr;
-
-typedef NetworkAction *NetworkActionPtr;
/*************
* Callbacks *
/*************
* Callbacks *
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emits the callbacks after Link State changed
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emits the callbacks after Link State changed
- * @details Callback functions have the following signature: `void(LinkActionPtr action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
+ * @details Callback functions have the following signature: `void(LinkAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
*/
XBT_PUBLIC_DATA( surf_callback(void, Link*, e_surf_resource_state_t, e_surf_resource_state_t)) networkLinkStateChangedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emits the callbacks after NetworkAction State changed
*/
XBT_PUBLIC_DATA( surf_callback(void, Link*, e_surf_resource_state_t, e_surf_resource_state_t)) networkLinkStateChangedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emits the callbacks after NetworkAction State changed
- * @details Callback functions have the following signature: `void(NetworkActionPtr action, e_surf_action_state_t old, e_surf_action_state_t current)`
+ * @details Callback functions have the following signature: `void(NetworkAction *action, e_surf_action_state_t old, e_surf_action_state_t current)`
-XBT_PUBLIC_DATA( surf_callback(void, NetworkActionPtr, e_surf_action_state_t, e_surf_action_state_t)) networkActionStateChangedCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, NetworkAction*, e_surf_action_state_t, e_surf_action_state_t)) networkActionStateChangedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emits the callbacks after communication created
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emits the callbacks after communication created
- * @details Callback functions have the following signature: `void(NetworkActionPtr action, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate)`
+ * @details Callback functions have the following signature: `void(NetworkAction *action, RoutingEdge *src, RoutingEdge *dst, double size, double rate)`
-XBT_PUBLIC_DATA( surf_callback(void, NetworkActionPtr, RoutingEdgePtr src, RoutingEdgePtr dst, double size, double rate)) networkCommunicateCallbacks;
+XBT_PUBLIC_DATA( surf_callback(void, NetworkAction*, RoutingEdge *src, RoutingEdge *dst, double size, double rate)) networkCommunicateCallbacks;
e_surf_link_sharing_policy_t policy,
xbt_dict_t properties)=0;
e_surf_link_sharing_policy_t policy,
xbt_dict_t properties)=0;
- virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkActionPtr /*action*/) {};
+ virtual void gapAppend(double /*size*/, const Link* /*link*/, NetworkAction */*action*/) {};
/**
* @brief Create a communication between two hosts.
/**
* @brief Create a communication between two hosts.
* unlimited.
* @return The action representing the communication
*/
* unlimited.
* @return The action representing the communication
*/
- virtual ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+ virtual Action *communicate(RoutingEdge *src, RoutingEdge *dst,
double size, double rate)=0;
/**
double size, double rate)=0;
/**
* @param name The name of the Link
* @param props Dictionary of properties associated to this Link
*/
* @param name The name of the Link
* @param props Dictionary of properties associated to this Link
*/
- Link(NetworkModelPtr model, const char *name, xbt_dict_t props);
+ Link(NetworkModel *model, const char *name, xbt_dict_t props);
/**
* @brief Link constructor
/**
* @brief Link constructor
* @param history [TODO]
* @param state_trace [TODO]
*/
* @param history [TODO]
* @param state_trace [TODO]
*/
- Link(NetworkModelPtr model, const char *name, xbt_dict_t props,
+ Link(NetworkModel *model, const char *name, xbt_dict_t props,
lmm_constraint_t constraint,
tmgr_history_t history,
tmgr_trace_t state_trace);
lmm_constraint_t constraint,
tmgr_history_t history,
tmgr_trace_t state_trace);
* @param cost The cost of this NetworkAction in [TODO]
* @param failed [description]
*/
* @param cost The cost of this NetworkAction in [TODO]
* @param failed [description]
*/
- NetworkAction(ModelPtr model, double cost, bool failed)
+ NetworkAction(Model *model, double cost, bool failed)
: Action(model, cost, failed) {}
/**
: Action(model, cost, failed) {}
/**
* @param var The lmm variable associated to this Action if it is part of a
* LMM component
*/
* @param var The lmm variable associated to this Action if it is part of a
* LMM component
*/
- NetworkAction(ModelPtr model, double cost, bool failed, lmm_variable_t var)
+ NetworkAction(Model *model, double cost, bool failed, lmm_variable_t var)
: Action(model, cost, failed, var) {};
void setState(e_surf_action_state_t state);
: Action(model, cost, failed, var) {};
void setState(e_surf_action_state_t state);
xbt_die("There is no routes!");
XBT_DEBUG("Have get_onelink_routes, found %ld routes",onelink_routes->used);
//save them in trace file
xbt_die("There is no routes!");
XBT_DEBUG("Have get_onelink_routes, found %ld routes",onelink_routes->used);
//save them in trace file
unsigned int iter;
xbt_dynar_foreach(onelink_routes, iter, onelink) {
char *src = onelink->p_src->getName();
unsigned int iter;
xbt_dynar_foreach(onelink_routes, iter, onelink) {
char *src = onelink->p_src->getName();
return new NetworkNS3Link(this, name, properties, bw_initial, lat_initial);
}
return new NetworkNS3Link(this, name, properties, bw_initial, lat_initial);
}
-xbt_dynar_t NetworkNS3Model::getRoute(RoutingEdgePtr src, RoutingEdgePtr dst)
+xbt_dynar_t NetworkNS3Model::getRoute(RoutingEdge *src, RoutingEdge *dst)
{
xbt_dynar_t route = NULL;
routing_get_route_and_latency(src, dst, &route, NULL);
{
xbt_dynar_t route = NULL;
routing_get_route_and_latency(src, dst, &route, NULL);
-ActionPtr NetworkNS3Model::communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+Action *NetworkNS3Model::communicate(RoutingEdge *src, RoutingEdge *dst,
double size, double rate)
{
XBT_DEBUG("Communicate from %s to %s", src->getName(), dst->getName());
double size, double rate)
{
XBT_DEBUG("Communicate from %s to %s", src->getName(), dst->getName());
- NetworkNS3ActionPtr action = new NetworkNS3Action(this, size, 0);
+ NetworkNS3Action *action = new NetworkNS3Action(this, size, 0);
ns3_create_flow(src->getName(), dst->getName(), surf_get_clock(), size, action);
ns3_create_flow(src->getName(), dst->getName(), surf_get_clock(), size, action);
- NetworkNS3ActionPtr action;
+ NetworkNS3Action *action;
xbt_dict_foreach(dict_socket,cursor,key,data){
xbt_dict_foreach(dict_socket,cursor,key,data){
- action = static_cast<NetworkNS3ActionPtr>(ns3_get_socket_action(data));
+ action = static_cast<NetworkNS3Action*>(ns3_get_socket_action(data));
XBT_DEBUG("Processing socket %p (action %p)",data,action);
action->setRemains(action->getCost() - ns3_get_socket_sent(data));
XBT_DEBUG("Processing socket %p (action %p)",data,action);
action->setRemains(action->getCost() - ns3_get_socket_sent(data));
routing_get_route_and_latency (action->p_srcElm, action->p_dstElm, &route, NULL);
unsigned int i;
for (i = 0; i < xbt_dynar_length (route); i++){
routing_get_route_and_latency (action->p_srcElm, action->p_dstElm, &route, NULL);
unsigned int i;
for (i = 0; i < xbt_dynar_length (route); i++){
- NetworkNS3Link* link = ((NetworkNS3Link*)xbt_dynar_get_ptr (route, i));
+ NetworkNS3Link* link = ((NetworkNS3Link*)xbt_dynar_get_ptr(route, i));
TRACE_surf_link_set_utilization (link->getName(),
action->getCategory(),
(data_delta_sent)/delta,
TRACE_surf_link_set_utilization (link->getName(),
action->getCategory(),
(data_delta_sent)/delta,
xbt_dynar_pop(socket_to_destroy,&key);
void *data = xbt_dict_get (dict_socket, key);
xbt_dynar_pop(socket_to_destroy,&key);
void *data = xbt_dict_get (dict_socket, key);
- action = static_cast<NetworkNS3ActionPtr>(ns3_get_socket_action(data));
+ action = static_cast<NetworkNS3Action*>(ns3_get_socket_action(data));
XBT_DEBUG ("Removing socket %p of action %p", key, action);
xbt_dict_remove(dict_socket, key);
}
XBT_DEBUG ("Removing socket %p of action %p", key, action);
xbt_dict_remove(dict_socket, key);
}
* Resource *
************/
* Resource *
************/
-NetworkNS3Link::NetworkNS3Link(NetworkNS3ModelPtr model, const char *name, xbt_dict_t props,
+NetworkNS3Link::NetworkNS3Link(NetworkNS3Model *model, const char *name, xbt_dict_t props,
double bw_initial, double lat_initial)
: Link(model, name, props)
, p_lat(bprintf("%f", lat_initial))
double bw_initial, double lat_initial)
: Link(model, name, props)
, p_lat(bprintf("%f", lat_initial))
-NetworkNS3Action::NetworkNS3Action(ModelPtr model, double cost, bool failed)
+NetworkNS3Action::NetworkNS3Action(Model *model, double cost, bool failed)
: NetworkAction(model, cost, failed)
{}
: NetworkAction(model, cost, failed)
{}
* Classes *
***********/
class NetworkNS3Model;
* Classes *
***********/
class NetworkNS3Model;
-typedef NetworkNS3Model *NetworkNS3ModelPtr;
-
-typedef NetworkNS3Action *NetworkNS3ActionPtr;
tmgr_trace_t state_trace,
e_surf_link_sharing_policy_t policy,
xbt_dict_t properties);
tmgr_trace_t state_trace,
e_surf_link_sharing_policy_t policy,
xbt_dict_t properties);
- xbt_dynar_t getRoute(RoutingEdgePtr src, RoutingEdgePtr dst);
- ActionPtr communicate(RoutingEdgePtr src, RoutingEdgePtr dst,
+ xbt_dynar_t getRoute(RoutingEdge *src, RoutingEdge *dst);
+ Action *communicate(RoutingEdge *src, RoutingEdge *dst,
double size, double rate);
double shareResources(double now);
void updateActionsState(double now, double delta);
double size, double rate);
double shareResources(double now);
void updateActionsState(double now, double delta);
************/
class NetworkNS3Link : public Link {
public:
************/
class NetworkNS3Link : public Link {
public:
- NetworkNS3Link(NetworkNS3ModelPtr model, const char *name, xbt_dict_t props,
+ NetworkNS3Link(NetworkNS3Model *model, const char *name, xbt_dict_t props,
double bw_initial, double lat_initial);
~NetworkNS3Link();
double bw_initial, double lat_initial);
~NetworkNS3Link();
**********/
class NetworkNS3Action : public NetworkAction {
public:
**********/
class NetworkNS3Action : public NetworkAction {
public:
- NetworkNS3Action(ModelPtr model, double cost, bool failed);
+ NetworkNS3Action(Model *model, double cost, bool failed);
#ifdef HAVE_LATENCY_BOUND_TRACKING
int getLatencyLimited();
#ifdef HAVE_LATENCY_BOUND_TRACKING
int getLatencyLimited();
//private:
double m_lastSent;
//private:
double m_lastSent;
- RoutingEdgePtr p_srcElm;
- RoutingEdgePtr p_dstElm;
+ RoutingEdge *p_srcElm;
+ RoutingEdge *p_dstElm;
-void NetworkSmpiModel::gapAppend(double size, Link* link, NetworkActionPtr action)
+void NetworkSmpiModel::gapAppend(double size, Link* link, NetworkAction *action)
{
const char *src = link->getName();
xbt_fifo_t fifo;
{
const char *src = link->getName();
xbt_fifo_t fifo;
-void NetworkSmpiModel::gapRemove(ActionPtr lmm_action)
+void NetworkSmpiModel::gapRemove(Action *lmm_action)
{
xbt_fifo_t fifo;
size_t size;
{
xbt_fifo_t fifo;
size_t size;
- NetworkCm02ActionPtr action = static_cast<NetworkCm02ActionPtr>(lmm_action);
+ NetworkCm02Action *action = static_cast<NetworkCm02Action*>(lmm_action);
if (sg_sender_gap > 0.0 && action->p_senderLinkName
&& action->p_senderFifoItem) {
if (sg_sender_gap > 0.0 && action->p_senderLinkName
&& action->p_senderFifoItem) {
***********/
class NetworkSmpiModel;
***********/
class NetworkSmpiModel;
-typedef NetworkSmpiModel *NetworkSmpiModelPtr;
NetworkSmpiModel();
~NetworkSmpiModel();
NetworkSmpiModel();
~NetworkSmpiModel();
- void gapAppend(double size, Link* link, NetworkActionPtr action);
- void gapRemove(ActionPtr action);
+ void gapAppend(double size, Link* link, NetworkAction *action);
+ void gapRemove(Action *action);
double latencyFactor(double size);
double bandwidthFactor(double size);
double bandwidthConstraint(double rate, double bound, double size);
double latencyFactor(double size);
double bandwidthFactor(double size);
double bandwidthConstraint(double rate, double bound, double size);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_energy, surf,
"Logging specific to the SURF energy plugin");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_energy, surf,
"Logging specific to the SURF energy plugin");
-std::map<CpuPtr, CpuEnergyPtr> *surf_energy=NULL;
+std::map<Cpu*, CpuEnergy*> *surf_energy=NULL;
-static void energyCpuCreatedCallback(CpuPtr cpu){
+static void energyCpuCreatedCallback(Cpu *cpu){
(*surf_energy)[cpu] = new CpuEnergy(cpu);
}
(*surf_energy)[cpu] = new CpuEnergy(cpu);
}
-static void update_consumption_running(CpuPtr cpu, CpuEnergyPtr cpu_energy) {
+static void update_consumption_running(Cpu *cpu, CpuEnergy *cpu_energy) {
double cpu_load = lmm_constraint_get_usage(cpu->getConstraint()) / cpu->m_powerPeak;
double start_time = cpu_energy->last_updated;
double finish_time = surf_get_clock();
double cpu_load = lmm_constraint_get_usage(cpu->getConstraint()) / cpu->m_powerPeak;
double start_time = cpu_energy->last_updated;
double finish_time = surf_get_clock();
XBT_DEBUG("[cpu_update_energy] period=[%.2f-%.2f]; current power peak=%.0E flop/s; consumption change: %.2f J -> %.2f J",
start_time, finish_time, cpu->m_powerPeak, previous_energy, energy_this_step);
}
XBT_DEBUG("[cpu_update_energy] period=[%.2f-%.2f]; current power peak=%.0E flop/s; consumption change: %.2f J -> %.2f J",
start_time, finish_time, cpu->m_powerPeak, previous_energy, energy_this_step);
}
-static void update_consumption_off(CpuPtr cpu, CpuEnergyPtr cpu_energy) {
+static void update_consumption_off(Cpu *cpu, CpuEnergy *cpu_energy) {
double start_time = cpu_energy->last_updated;
double finish_time = surf_get_clock();
double start_time = cpu_energy->last_updated;
double finish_time = surf_get_clock();
start_time, finish_time, previous_energy, energy_this_step);
}
start_time, finish_time, previous_energy, energy_this_step);
}
-static void energyCpuDestructedCallback(CpuPtr cpu){
- std::map<CpuPtr, CpuEnergyPtr>::iterator cpu_energy_it = surf_energy->find(cpu);
+static void energyCpuDestructedCallback(Cpu *cpu){
+ std::map<Cpu*, CpuEnergy*>::iterator cpu_energy_it = surf_energy->find(cpu);
xbt_assert(cpu_energy_it != surf_energy->end(), "The cpu is not in surf_energy.");
xbt_assert(cpu_energy_it != surf_energy->end(), "The cpu is not in surf_energy.");
- CpuEnergyPtr cpu_energy = cpu_energy_it->second;
+ CpuEnergy *cpu_energy = cpu_energy_it->second;
if (cpu->getState() == SURF_RESOURCE_OFF)
update_consumption_off(cpu, cpu_energy);
else
if (cpu->getState() == SURF_RESOURCE_OFF)
update_consumption_off(cpu, cpu_energy);
else
surf_energy->erase(cpu_energy_it);
}
surf_energy->erase(cpu_energy_it);
}
-static void energyCpuActionStateChangedCallback(CpuActionPtr action, e_surf_action_state_t old, e_surf_action_state_t cur){
- CpuPtr cpu = getActionCpu(action);
- CpuEnergyPtr cpu_energy = (*surf_energy)[cpu];
+static void energyCpuActionStateChangedCallback(CpuAction *action, e_surf_action_state_t old, e_surf_action_state_t cur){
+ Cpu *cpu = getActionCpu(action);
+ CpuEnergy *cpu_energy = (*surf_energy)[cpu];
if(cpu_energy->last_updated < surf_get_clock()) {
update_consumption_running(cpu, cpu_energy);
}
}
if(cpu_energy->last_updated < surf_get_clock()) {
update_consumption_running(cpu, cpu_energy);
}
}
-static void energyStateChangedCallback(CpuPtr cpu, e_surf_resource_state_t oldState, e_surf_resource_state_t newState){
- CpuEnergyPtr cpu_energy = (*surf_energy)[cpu];
+static void energyStateChangedCallback(Cpu *cpu, e_surf_resource_state_t oldState, e_surf_resource_state_t newState){
+ CpuEnergy *cpu_energy = (*surf_energy)[cpu];
if(cpu_energy->last_updated < surf_get_clock()) {
if (oldState == SURF_RESOURCE_OFF)
if(cpu_energy->last_updated < surf_get_clock()) {
if (oldState == SURF_RESOURCE_OFF)
*/
void sg_energy_plugin_init() {
if (surf_energy == NULL) {
*/
void sg_energy_plugin_init() {
if (surf_energy == NULL) {
- surf_energy = new std::map<CpuPtr, CpuEnergyPtr>();
+ surf_energy = new std::map<Cpu*, CpuEnergy*>();
surf_callback_connect(cpuCreatedCallbacks, energyCpuCreatedCallback);
surf_callback_connect(cpuDestructedCallbacks, energyCpuDestructedCallback);
surf_callback_connect(cpuActionStateChangedCallbacks, energyCpuActionStateChangedCallback);
surf_callback_connect(cpuCreatedCallbacks, energyCpuCreatedCallback);
surf_callback_connect(cpuDestructedCallbacks, energyCpuDestructedCallback);
surf_callback_connect(cpuActionStateChangedCallbacks, energyCpuActionStateChangedCallback);
-CpuEnergy::CpuEnergy(CpuPtr ptr)
+CpuEnergy::CpuEnergy(Cpu *ptr)
: cpu(ptr)
{
total_energy = 0;
: cpu(ptr)
{
total_energy = 0;
double CpuEnergy::getWattMinAt(int pstate) {
xbt_dynar_t power_range_list = power_range_watts_list;
xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
double CpuEnergy::getWattMinAt(int pstate) {
xbt_dynar_t power_range_list = power_range_watts_list;
xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
- xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(cpu)->getPState(), xbt_dynar_t);
+ xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01*>(cpu)->getPState(), xbt_dynar_t);
double min_power = xbt_dynar_get_as(current_power_values, 0, double);
return min_power;
}
double CpuEnergy::getWattMaxAt(int pstate) {
xbt_dynar_t power_range_list = power_range_watts_list;
xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
double min_power = xbt_dynar_get_as(current_power_values, 0, double);
return min_power;
}
double CpuEnergy::getWattMaxAt(int pstate) {
xbt_dynar_t power_range_list = power_range_watts_list;
xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
- xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(cpu)->getPState(), xbt_dynar_t);
+ xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01*>(cpu)->getPState(), xbt_dynar_t);
double max_power = xbt_dynar_get_as(current_power_values, 1, double);
return max_power;
}
double max_power = xbt_dynar_get_as(current_power_values, 1, double);
return max_power;
}
xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
/* retrieve the power values associated with the current pstate */
xbt_assert(power_range_watts_list, "No power range properties specified for host %s", cpu->getName());
/* retrieve the power values associated with the current pstate */
- xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01Ptr>(cpu)->getPState(), xbt_dynar_t);
+ xbt_dynar_t current_power_values = xbt_dynar_get_as(power_range_list, static_cast<CpuCas01*>(cpu)->getPState(), xbt_dynar_t);
/* min_power corresponds to the idle power (cpu load = 0) */
/* max_power is the power consumed at 100% cpu load */
/* min_power corresponds to the idle power (cpu load = 0) */
/* max_power is the power consumed at 100% cpu load */
#define CALLBACK_HPP_
class CpuEnergy;
#define CALLBACK_HPP_
class CpuEnergy;
-typedef CpuEnergy *CpuEnergyPtr;
-extern std::map<CpuPtr, CpuEnergyPtr> *surf_energy;
+extern std::map<Cpu*, CpuEnergy*> *surf_energy;
class CpuEnergy {
public:
class CpuEnergy {
public:
~CpuEnergy();
double getCurrentWattsValue(double cpu_load);
~CpuEnergy();
double getCurrentWattsValue(double cpu_load);
double watts_off; /*< Consumption when the machine is turned off (shutdown) */
double total_energy; /*< Total energy consumed by the host */
double last_updated; /*< Timestamp of the last energy update event*/
double watts_off; /*< Consumption when the machine is turned off (shutdown) */
double total_energy; /*< Total energy consumed by the host */
double last_updated; /*< Timestamp of the last energy update event*/
};
#endif /* CALLBACK_HPP_ */
};
#endif /* CALLBACK_HPP_ */
xbt_lib_t storage_type_lib;
int ROUTING_STORAGE_TYPE_LEVEL; //Routing for storage_type level
xbt_dynar_t mount_list = NULL;
xbt_lib_t storage_type_lib;
int ROUTING_STORAGE_TYPE_LEVEL; //Routing for storage_type level
xbt_dynar_t mount_list = NULL;
-StorageModelPtr surf_storage_model = NULL;
+StorageModel *surf_storage_model = NULL;
/*************
* Callbacks *
*************/
/*************
* Callbacks *
*************/
-surf_callback(void, StoragePtr) storageCreatedCallbacks;
-surf_callback(void, StoragePtr) storageDestructedCallbacks;
-surf_callback(void, StoragePtr, e_surf_resource_state_t, e_surf_resource_state_t) storageStateChangedCallbacks;
-surf_callback(void, StorageActionPtr, e_surf_action_state_t, e_surf_action_state_t) storageActionStateChangedCallbacks;
+surf_callback(void, Storage*) storageCreatedCallbacks;
+surf_callback(void, Storage*) storageDestructedCallbacks;
+surf_callback(void, Storage*, e_surf_resource_state_t, e_surf_resource_state_t) storageStateChangedCallbacks;
+surf_callback(void, StorageAction*, e_surf_action_state_t, e_surf_action_state_t) storageActionStateChangedCallbacks;
* Resource *
************/
* Resource *
************/
-Storage::Storage(ModelPtr model, const char *name, xbt_dict_t props,
+Storage::Storage(Model *model, const char *name, xbt_dict_t props,
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)
, p_typeId(xbt_strdup(type_id))
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)
, p_typeId(xbt_strdup(type_id))
- , p_writeActions(xbt_dynar_new(sizeof(ActionPtr),NULL))
+ , p_writeActions(xbt_dynar_new(sizeof(Action*),NULL))
{
surf_callback_emit(storageCreatedCallbacks, this);
p_content = parseContent(content_name);
setState(SURF_RESOURCE_ON);
}
{
surf_callback_emit(storageCreatedCallbacks, this);
p_content = parseContent(content_name);
setState(SURF_RESOURCE_ON);
}
-Storage::Storage(ModelPtr model, const char *name, xbt_dict_t props,
+Storage::Storage(Model *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)
, p_contentType(content_type)
, m_size(size), m_usedSize(0)
, p_typeId(xbt_strdup(type_id))
, p_contentType(content_type)
, m_size(size), m_usedSize(0)
, p_typeId(xbt_strdup(type_id))
- , p_writeActions(xbt_dynar_new(sizeof(ActionPtr),NULL)) {
+ , p_writeActions(xbt_dynar_new(sizeof(Action*),NULL)) {
surf_callback_emit(storageCreatedCallbacks, this);
p_content = parseContent(content_name);
p_attach = xbt_strdup(attach);
surf_callback_emit(storageCreatedCallbacks, this);
p_content = parseContent(content_name);
p_attach = xbt_strdup(attach);
/**********
* Action *
**********/
/**********
* Action *
**********/
-StorageAction::StorageAction(ModelPtr model, double cost, bool failed,
- StoragePtr storage, e_surf_action_storage_type_t type)
+StorageAction::StorageAction(Model *model, double cost, bool failed,
+ Storage *storage, e_surf_action_storage_type_t type)
: Action(model, cost, failed)
, m_type(type), p_storage(storage), p_file(NULL){
progress = 0;
};
: Action(model, cost, failed)
, m_type(type), p_storage(storage), p_file(NULL){
progress = 0;
};
-StorageAction::StorageAction(ModelPtr model, double cost, bool failed, lmm_variable_t var,
- StoragePtr storage, e_surf_action_storage_type_t type)
+StorageAction::StorageAction(Model *model, double cost, bool failed, lmm_variable_t var,
+ Storage *storage, e_surf_action_storage_type_t type)
: Action(model, cost, failed, var)
, m_type(type), p_storage(storage), p_file(NULL){
progress = 0;
: Action(model, cost, failed, var)
, m_type(type), p_storage(storage), p_file(NULL){
progress = 0;
***********/
class StorageModel;
***********/
class StorageModel;
-typedef StorageModel *StorageModelPtr;
-
-typedef Storage *StoragePtr;
-
-typedef StorageAction *StorageActionPtr;
/*************
* Callbacks *
/*************
* Callbacks *
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Storage creation *
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Storage creation *
- * @details Callback functions have the following signature: `void(StoragePtr)`
+ * @details Callback functions have the following signature: `void(Storage*)`
-XBT_PUBLIC_DATA(surf_callback(void, StoragePtr)) storageCreatedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Storage*)) storageCreatedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Storage destruction *
* @details Callback functions have the following signature: `void(StoragePtr)`
*/
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Storage destruction *
* @details Callback functions have the following signature: `void(StoragePtr)`
*/
-XBT_PUBLIC_DATA(surf_callback(void, StoragePtr)) storageDestructedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Storage*)) storageDestructedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after Storage State changed *
/** @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)`
+ * @details Callback functions have the following signature: `void(StorageAction *action, e_surf_resource_state_t old, e_surf_resource_state_t current)`
-XBT_PUBLIC_DATA(surf_callback(void, StoragePtr, e_surf_resource_state_t, e_surf_resource_state_t)) storageStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, Storage*, 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 *
/** @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)`
+ * @details Callback functions have the following signature: `void(StorageAction *action, e_surf_action_state_t old, e_surf_action_state_t current)`
-XBT_PUBLIC_DATA(surf_callback(void, StorageActionPtr, e_surf_action_state_t, e_surf_action_state_t)) storageActionStateChangedCallbacks;
+XBT_PUBLIC_DATA(surf_callback(void, StorageAction*, e_surf_action_state_t, e_surf_action_state_t)) storageActionStateChangedCallbacks;
* @param attach [description]
* @return The created Storage
*/
* @param attach [description]
* @return The created Storage
*/
- virtual StoragePtr createStorage(const char* id,
+ virtual Storage *createStorage(const char* id,
const char* type_id,
const char* content_name,
const char* content_type,
const char* type_id,
const char* content_name,
const char* content_type,
* @param content_type [description]
* @param size [description]
*/
* @param content_type [description]
* @param size [description]
*/
- Storage(ModelPtr model, const char *name, xbt_dict_t props,
+ Storage(Model *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);
* @param size [description]
* @param attach [description]
*/
* @param size [description]
* @param attach [description]
*/
- Storage(ModelPtr model, const char *name, xbt_dict_t props,
+ Storage(Model *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,
lmm_system_t maxminSystem, double bread, double bwrite,
double bconnection,
const char* type_id, char *content_name, char *content_type,
*
* @return The StorageAction corresponding to the opening
*/
*
* @return The StorageAction corresponding to the opening
*/
- virtual StorageActionPtr open(const char* mount, const char* path)=0;
+ virtual StorageAction *open(const char* mount, const char* path)=0;
/**
* @brief Close a file
/**
* @brief Close a file
* @param fd The file descriptor to close
* @return The StorageAction corresponding to the closing
*/
* @param fd The file descriptor to close
* @return The StorageAction corresponding to the closing
*/
- virtual StorageActionPtr close(surf_file_t fd)=0;
+ virtual StorageAction *close(surf_file_t fd)=0;
* @param size The size in bytes to read
* @return The StorageAction corresponding to the reading
*/
* @param size The size in bytes to read
* @return The StorageAction corresponding to the reading
*/
- virtual StorageActionPtr read(surf_file_t fd, sg_size_t size)=0;
+ virtual StorageAction *read(surf_file_t fd, sg_size_t size)=0;
/**
* @brief Write a file
/**
* @brief Write a file
* @param size The size in bytes to write
* @return The StorageAction corresponding to the writing
*/
* @param size The size in bytes to write
* @return The StorageAction corresponding to the writing
*/
- virtual StorageActionPtr write(surf_file_t fd, sg_size_t size)=0;
+ virtual StorageAction *write(surf_file_t fd, sg_size_t size)=0;
/**
* @brief Get the content of the current Storage
/**
* @brief Get the content of the current Storage
* @param storage The Storage associated to this StorageAction
* @param type [description]
*/
* @param storage The Storage associated to this StorageAction
* @param type [description]
*/
- StorageAction(ModelPtr model, double cost, bool failed, StoragePtr storage,
+ StorageAction(Model *model, double cost, bool failed, Storage *storage,
e_surf_action_storage_type_t type);
/**
e_surf_action_storage_type_t type);
/**
* @param storage The Storage associated to this StorageAction
* @param type [description]
*/
* @param storage The Storage associated to this StorageAction
* @param type [description]
*/
- StorageAction(ModelPtr model, double cost, bool failed, lmm_variable_t var,
- StoragePtr storage, e_surf_action_storage_type_t type);
+ StorageAction(Model *model, double cost, bool failed, lmm_variable_t var,
+ Storage *storage, e_surf_action_storage_type_t type);
void setState(e_surf_action_state_t state);
e_surf_action_storage_type_t m_type;
void setState(e_surf_action_state_t state);
e_surf_action_storage_type_t m_type;
surf_file_t p_file;
double progress;
};
surf_file_t p_file;
double progress;
};
static XBT_INLINE void surf_storage_resource_free(void *r)
{
// specific to storage
static XBT_INLINE void surf_storage_resource_free(void *r)
{
// specific to storage
- StoragePtr storage = static_cast<StoragePtr>(r);
+ Storage *storage = static_cast<Storage*>(r);
// generic resource
delete storage;
}
// generic resource
delete storage;
}
}
StorageN11Model::StorageN11Model() : StorageModel() {
}
StorageN11Model::StorageN11Model() : StorageModel() {
- ActionPtr action = NULL;
XBT_DEBUG("surf_storage_model_init_internal");
XBT_DEBUG("surf_storage_model_init_internal");
storage_running_action_set_that_does_not_need_being_checked = NULL;
}
storage_running_action_set_that_does_not_need_being_checked = NULL;
}
-StoragePtr StorageN11Model::createStorage(const char* id, const char* type_id,
+Storage *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)
{
double Bwrite = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bwrite"));
double Bconnection = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bconnection"));
double Bwrite = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bwrite"));
double Bconnection = surf_parse_get_bandwidth((char*)xbt_dict_get(storage_type->model_properties, "Bconnection"));
- StoragePtr storage = new StorageN11(this, id, properties, p_maxminSystem,
+ Storage *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_DEBUG("storage_share_resources %f", now);
unsigned int i, j;
{
XBT_DEBUG("storage_share_resources %f", now);
unsigned int i, j;
- StorageActionPtr write_action;
+ StorageAction *write_action;
double min_completion = shareResourcesMaxMin(getRunningActionSet(),
p_maxminSystem, lmm_solve);
double min_completion = shareResourcesMaxMin(getRunningActionSet(),
p_maxminSystem, lmm_solve);
// Foreach write action on disk
xbt_dynar_foreach(storage->p_writeActions, j, _write_action)
{
// Foreach write action on disk
xbt_dynar_foreach(storage->p_writeActions, j, _write_action)
{
- write_action = static_cast<StorageActionPtr>(_write_action);
+ write_action = static_cast<StorageAction*>(_write_action);
rate += lmm_variable_getvalue(write_action->getVariable());
}
if(rate > 0)
rate += lmm_variable_getvalue(write_action->getVariable());
}
if(rate > 0)
void StorageN11Model::updateActionsState(double /*now*/, double delta)
{
void StorageN11Model::updateActionsState(double /*now*/, double delta)
{
- StorageActionPtr action = NULL;
+ StorageAction *action = NULL;
- ActionListPtr actionSet = getRunningActionSet();
+ ActionList *actionSet = getRunningActionSet();
for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
; it != itend ; it=itNext) {
++itNext;
for(ActionList::iterator it(actionSet->begin()), itNext=it, itend(actionSet->end())
; it != itend ; it=itNext) {
++itNext;
- action = static_cast<StorageActionPtr>(&*it);
+ action = static_cast<StorageAction*>(&*it);
if(action->m_type == WRITE)
{
if(action->m_type == WRITE)
{
* Resource *
************/
* Resource *
************/
-StorageN11::StorageN11(StorageModelPtr model, const char* name,
+StorageN11::StorageN11(StorageModel *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)
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)
XBT_DEBUG("Create resource with Bconnection '%f' Bread '%f' Bwrite '%f' and Size '%llu'", bconnection, bread, bwrite, size);
}
XBT_DEBUG("Create resource with Bconnection '%f' Bread '%f' Bwrite '%f' and Size '%llu'", bconnection, bread, bwrite, size);
}
-StorageActionPtr StorageN11::open(const char* mount, const char* path)
+StorageAction *StorageN11::open(const char* mount, const char* path)
{
XBT_DEBUG("\tOpen file '%s'",path);
{
XBT_DEBUG("\tOpen file '%s'",path);
file->mount = xbt_strdup(mount);
file->current_position = 0;
file->mount = xbt_strdup(mount);
file->current_position = 0;
- StorageActionPtr action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, OPEN);
+ StorageAction *action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, OPEN);
action->p_file = file;
return action;
}
action->p_file = file;
return action;
}
-StorageActionPtr StorageN11::close(surf_file_t fd)
+StorageAction *StorageN11::close(surf_file_t fd)
{
char *filename = fd->name;
XBT_DEBUG("\tClose file '%s' size '%llu'", filename, fd->size);
// unref write actions from storage
void *_write_action;
{
char *filename = fd->name;
XBT_DEBUG("\tClose file '%s' size '%llu'", filename, fd->size);
// unref write actions from storage
void *_write_action;
- StorageActionPtr write_action;
+ StorageAction *write_action;
unsigned int i;
xbt_dynar_foreach(p_writeActions, i, _write_action) {
unsigned int i;
xbt_dynar_foreach(p_writeActions, i, _write_action) {
- write_action = static_cast<StorageActionPtr>(_write_action);
+ write_action = static_cast<StorageAction*>(_write_action);
if ((write_action->p_file) == fd) {
xbt_dynar_cursor_rm(p_writeActions, &i);
write_action->unref();
if ((write_action->p_file) == fd) {
xbt_dynar_cursor_rm(p_writeActions, &i);
write_action->unref();
free(fd->name);
free(fd->mount);
xbt_free(fd);
free(fd->name);
free(fd->mount);
xbt_free(fd);
- StorageActionPtr action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, CLOSE);
+ StorageAction *action = new StorageN11Action(getModel(), 0, getState() != SURF_RESOURCE_ON, this, CLOSE);
-StorageActionPtr StorageN11::read(surf_file_t fd, sg_size_t size)
+StorageAction *StorageN11::read(surf_file_t fd, sg_size_t size)
{
if(fd->current_position + size > fd->size){
size = fd->size - fd->current_position;
{
if(fd->current_position + size > fd->size){
size = fd->size - fd->current_position;
else
fd->current_position += size;
else
fd->current_position += size;
- StorageActionPtr action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, READ);
+ StorageAction *action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, READ);
-StorageActionPtr StorageN11::write(surf_file_t fd, sg_size_t size)
+StorageAction *StorageN11::write(surf_file_t fd, sg_size_t size)
{
char *filename = fd->name;
XBT_DEBUG("\tWrite file '%s' size '%llu/%llu'",filename,size,fd->size);
{
char *filename = fd->name;
XBT_DEBUG("\tWrite file '%s' size '%llu/%llu'",filename,size,fd->size);
- StorageActionPtr action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, WRITE);
+ StorageAction *action = new StorageN11Action(getModel(), size, getState() != SURF_RESOURCE_ON, this, WRITE);
action->p_file = fd;
/* Substract the part of the file that might disappear from the used sized on
* the storage element */
action->p_file = fd;
/* Substract the part of the file that might disappear from the used sized on
* the storage element */
-StorageN11Action::StorageN11Action(ModelPtr model, double cost, bool failed, StoragePtr storage, e_surf_action_storage_type_t type)
+StorageN11Action::StorageN11Action(Model *model, double cost, bool failed, Storage *storage, e_surf_action_storage_type_t type)
: StorageAction(model, cost, failed,
lmm_variable_new(model->getMaxminSystem(), this, 1.0, -1.0 , 3),
storage, type) {
: StorageAction(model, cost, failed,
lmm_variable_new(model->getMaxminSystem(), this, 1.0, -1.0 , 3),
storage, type) {
getVariable(), 1.0);
//TODO there is something annoying with what's below. Have to sort it out...
getVariable(), 1.0);
//TODO there is something annoying with what's below. Have to sort it out...
-// ActionPtr action = this;
+// Action *action = this;
// xbt_dynar_push(storage->p_writeActions, &action);
// ref();
break;
// xbt_dynar_push(storage->p_writeActions, &action);
// ref();
break;
***********/
class StorageN11Model;
***********/
class StorageN11Model;
-typedef StorageN11Model *StorageN11ModelPtr;
-
-class StorageN11;
-typedef StorageN11 *StorageN11Ptr;
-
-typedef StorageN11 *StorageN11Ptr;
-
-typedef StorageN11Action *StorageN11ActionPtr;
-
-class StorageN11Action;
-typedef StorageN11Action *StorageN11ActionPtr;
-
public:
StorageN11Model();
~StorageN11Model();
public:
StorageN11Model();
~StorageN11Model();
- StoragePtr createStorage(const char* id, const char* type_id,
+ Storage *createStorage(const char* id, const char* type_id,
const char* content_name, const char* content_type, xbt_dict_t properties, const char* attach);
void addTraces(){DIE_IMPOSSIBLE;}
double shareResources(double now);
const char* content_name, const char* content_type, xbt_dict_t properties, const char* attach);
void addTraces(){DIE_IMPOSSIBLE;}
double shareResources(double now);
class StorageN11 : public Storage {
public:
class StorageN11 : public Storage {
public:
- StorageN11(StorageModelPtr model, const char* name, xbt_dict_t properties,
+ StorageN11(StorageModel *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);
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);
- StorageActionPtr open(const char* mount, const char* path);
- StorageActionPtr close(surf_file_t fd);
- StorageActionPtr ls(const char *path);
- StorageActionPtr read(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param ptr ??
- StorageActionPtr write(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param ptr ??
+ StorageAction *open(const char* mount, const char* path);
+ StorageAction *close(surf_file_t fd);
+ StorageAction *ls(const char *path);
+ StorageAction *read(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param *??
+ StorageAction *write(surf_file_t fd, sg_size_t size);//FIXME:why we have a useless param *??
void rename(const char *src, const char *dest);
lmm_constraint_t p_constraintWrite; /* Constraint for maximum write bandwidth*/
void rename(const char *src, const char *dest);
lmm_constraint_t p_constraintWrite; /* Constraint for maximum write bandwidth*/
class StorageN11Action : public StorageAction {
public:
class StorageN11Action : public StorageAction {
public:
- StorageN11Action(ModelPtr model, double cost, bool failed, StoragePtr storage, e_surf_action_storage_type_t type);
+ StorageN11Action(Model *model, double cost, bool failed, Storage *storage, e_surf_action_storage_type_t type);
void suspend();
int unref();
void cancel();
void suspend();
int unref();
void cancel();
-static HostPtr get_casted_host(surf_resource_t resource){
- return static_cast<HostPtr>(surf_host_resource_priv(resource));
+static Host *get_casted_host(surf_resource_t resource){
+ return static_cast<Host*>(surf_host_resource_priv(resource));
-static VMPtr get_casted_vm(surf_resource_t resource){
- return static_cast<VMPtr>(surf_host_resource_priv(resource));
+static VM *get_casted_vm(surf_resource_t resource){
+ return static_cast<VM*>(surf_host_resource_priv(resource));
}
char *surf_routing_edge_name(sg_routing_edge_t edge){
}
char *surf_routing_edge_name(sg_routing_edge_t edge){
double next_event_date = -1.0;
tmgr_trace_event_t event = NULL;
double value = -1.0;
double next_event_date = -1.0;
tmgr_trace_event_t event = NULL;
double value = -1.0;
- ResourcePtr resource = NULL;
- ModelPtr model = NULL;
+ Resource *resource = NULL;
+ Model *model = NULL;
unsigned int iter;
XBT_DEBUG
unsigned int iter;
XBT_DEBUG
double next_event_date = -1.0;
double model_next_action_end = -1.0;
double value = -1.0;
double next_event_date = -1.0;
double model_next_action_end = -1.0;
double value = -1.0;
- ResourcePtr resource = NULL;
- ModelPtr model = NULL;
+ Resource *resource = NULL;
+ Model *model = NULL;
tmgr_trace_event_t event = NULL;
unsigned int iter;
tmgr_trace_event_t event = NULL;
unsigned int iter;
/* sequential version */
xbt_dynar_foreach(model_list_invoke, iter, model) {
/* sequential version */
xbt_dynar_foreach(model_list_invoke, iter, model) {
- surf_share_resources(static_cast<ModelPtr>(model));
+ surf_share_resources(static_cast<Model*>(model));
surf_model_t surf_resource_model(const void *host, int level) {
/* If level is SURF_WKS_LEVEL, ws is a host_CLM03 object. It has
* surf_resource at the generic_resource field. */
surf_model_t surf_resource_model(const void *host, int level) {
/* If level is SURF_WKS_LEVEL, ws is a host_CLM03 object. It has
* surf_resource at the generic_resource field. */
- ResourcePtr ws = static_cast<ResourcePtr>(xbt_lib_get_level((xbt_dictelm_t) host, level));
+ Resource *ws = static_cast<Resource*>(xbt_lib_get_level((xbt_dictelm_t) host, level));
return ws->getModel();
}
void *surf_as_cluster_get_backbone(AS_t as){
return ws->getModel();
}
void *surf_as_cluster_get_backbone(AS_t as){
- return static_cast<AsClusterPtr>(as)->p_backbone;
+ return static_cast<AsCluster*>(as)->p_backbone;
}
void surf_as_cluster_set_backbone(AS_t as, void* backbone){
}
void surf_as_cluster_set_backbone(AS_t as, void* backbone){
- static_cast<AsClusterPtr>(as)->p_backbone = static_cast<Link*>(backbone);
+ static_cast<AsCluster*>(as)->p_backbone = static_cast<Link*>(backbone);
}
const char *surf_model_name(surf_model_t model){
}
const char *surf_model_name(surf_model_t model){
double *flops_amount,
double *bytes_amount,
double rate){
double *flops_amount,
double *bytes_amount,
double rate){
- return static_cast<ActionPtr>(model->executeParallelTask(host_nb, host_list, flops_amount, bytes_amount, rate));
+ return static_cast<Action*>(model->executeParallelTask(host_nb, host_list, flops_amount, bytes_amount, rate));
}
surf_action_t surf_host_model_communicate(surf_host_model_t model, surf_resource_t src, surf_resource_t dst, double size, double rate){
}
surf_action_t surf_host_model_communicate(surf_host_model_t model, surf_resource_t src, surf_resource_t dst, double size, double rate){
}
double surf_host_get_wattmin_at(surf_resource_t resource, int pstate){
xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
}
double surf_host_get_wattmin_at(surf_resource_t resource, int pstate){
xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
- std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
+ std::map<Cpu*, CpuEnergy*>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
return cpuIt->second->getWattMinAt(pstate);
}
double surf_host_get_wattmax_at(surf_resource_t resource, int pstate){
xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
return cpuIt->second->getWattMinAt(pstate);
}
double surf_host_get_wattmax_at(surf_resource_t resource, int pstate){
xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
- std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
+ std::map<Cpu*, CpuEnergy*>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
return cpuIt->second->getWattMaxAt(pstate);
}
double surf_host_get_consumed_energy(surf_resource_t resource){
xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
return cpuIt->second->getWattMaxAt(pstate);
}
double surf_host_get_consumed_energy(surf_resource_t resource){
xbt_assert(surf_energy!=NULL, "The Energy plugin is not active. Please call sg_energy_plugin_init() during initialization.");
- std::map<CpuPtr, CpuEnergyPtr>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
+ std::map<Cpu*, CpuEnergy*>::iterator cpuIt = surf_energy->find(get_casted_host(resource)->p_cpu);
return cpuIt->second->getConsumedEnergy();
}
return cpuIt->second->getConsumedEnergy();
}
xbt_dynar_t vms = get_casted_host(host)->getVms();
xbt_dynar_t vms_ = xbt_dynar_new(sizeof(sg_host_t), NULL);
unsigned int cpt;
xbt_dynar_t vms = get_casted_host(host)->getVms();
xbt_dynar_t vms_ = xbt_dynar_new(sizeof(sg_host_t), NULL);
unsigned int cpt;
xbt_dynar_foreach(vms, cpt, vm) {
sg_host_t vm_ = xbt_lib_get_elm_or_null(host_lib, vm->getName());
xbt_dynar_push(vms_, &vm_);
xbt_dynar_foreach(vms, cpt, vm) {
sg_host_t vm_ = xbt_lib_get_elm_or_null(host_lib, vm->getName());
xbt_dynar_push(vms_, &vm_);
void surf_vm_destroy(surf_resource_t resource){
/* Before clearing the entries in host_lib, we have to pick up resources. */
void surf_vm_destroy(surf_resource_t resource){
/* Before clearing the entries in host_lib, we have to pick up resources. */
- VMPtr vm = get_casted_vm(resource);
+ VM *vm = get_casted_vm(resource);
char* name = xbt_dict_get_elm_key(resource);
/* We deregister objects from host_lib, without invoking the freeing callback
* of each level.
char* name = xbt_dict_get_elm_key(resource);
/* We deregister objects from host_lib, without invoking the freeing callback
* of each level.
}
xbt_dict_t surf_storage_get_content(surf_resource_t resource){
}
xbt_dict_t surf_storage_get_content(surf_resource_t resource){
- return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getContent();
+ return static_cast<Storage*>(surf_storage_resource_priv(resource))->getContent();
}
sg_size_t surf_storage_get_size(surf_resource_t resource){
}
sg_size_t surf_storage_get_size(surf_resource_t resource){
- return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getSize();
+ return static_cast<Storage*>(surf_storage_resource_priv(resource))->getSize();
}
sg_size_t surf_storage_get_free_size(surf_resource_t resource){
}
sg_size_t surf_storage_get_free_size(surf_resource_t resource){
- return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getFreeSize();
+ return static_cast<Storage*>(surf_storage_resource_priv(resource))->getFreeSize();
}
sg_size_t surf_storage_get_used_size(surf_resource_t resource){
}
sg_size_t surf_storage_get_used_size(surf_resource_t resource){
- return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->getUsedSize();
+ return static_cast<Storage*>(surf_storage_resource_priv(resource))->getUsedSize();
}
const char* surf_storage_get_host(surf_resource_t resource){
}
const char* surf_storage_get_host(surf_resource_t resource){
- return static_cast<StoragePtr>(surf_storage_resource_priv(resource))->p_attach;
+ return static_cast<Storage*>(surf_storage_resource_priv(resource))->p_attach;
}
surf_action_t surf_cpu_execute(surf_resource_t cpu, double size){
}
surf_action_t surf_cpu_execute(surf_resource_t cpu, double size){
}
void surf_cpu_action_set_affinity(surf_action_t action, surf_resource_t cpu, unsigned long mask) {
}
void surf_cpu_action_set_affinity(surf_action_t action, surf_resource_t cpu, unsigned long mask) {
- static_cast<CpuActionPtr>(action)->setAffinity(sg_host_surfcpu(cpu), mask);
+ static_cast<CpuAction*>(action)->setAffinity(sg_host_surfcpu(cpu), mask);
}
void surf_cpu_action_set_bound(surf_action_t action, double bound) {
}
void surf_cpu_action_set_bound(surf_action_t action, double bound) {
- static_cast<CpuActionPtr>(action)->setBound(bound);
+ static_cast<CpuAction*>(action)->setBound(bound);
}
#ifdef HAVE_LATENCY_BOUND_TRACKING
}
#ifdef HAVE_LATENCY_BOUND_TRACKING
#endif
surf_file_t surf_storage_action_get_file(surf_action_t action){
#endif
surf_file_t surf_storage_action_get_file(surf_action_t action){
- return static_cast<StorageActionPtr>(action)->p_file;
+ return static_cast<StorageAction*>(action)->p_file;
static XBT_INLINE void surf_host_free(void *r)
{
static XBT_INLINE void surf_host_free(void *r)
{
- delete static_cast<HostPtr>(r);
+ delete static_cast<Host*>(r);
}
static XBT_INLINE void surf_storage_free(void *r)
{
}
static XBT_INLINE void surf_storage_free(void *r)
{
- delete static_cast<StoragePtr>(r);
+ delete static_cast<Storage*>(r);
xbt_init(argc, argv);
if (!model_list)
xbt_init(argc, argv);
if (!model_list)
- model_list = xbt_dynar_new(sizeof(ModelPtr), NULL);
+ model_list = xbt_dynar_new(sizeof(Model*), NULL);
- model_list_invoke = xbt_dynar_new(sizeof(ModelPtr), NULL);
+ model_list_invoke = xbt_dynar_new(sizeof(Model*), NULL);
if (!history)
history = tmgr_history_new();
if (!history)
history = tmgr_history_new();
void surf_exit(void)
{
unsigned int iter;
void surf_exit(void)
{
unsigned int iter;
TRACE_end(); /* Just in case it was not called by the upper
* layer (or there is no upper layer) */
TRACE_end(); /* Just in case it was not called by the upper
* layer (or there is no upper layer) */
double Model::shareResourcesLazy(double now)
{
double Model::shareResourcesLazy(double now)
{
- ActionPtr action = NULL;
double min = -1;
double share;
double min = -1;
double share;
-double Model::shareResourcesMaxMin(ActionListPtr running_actions,
+double Model::shareResourcesMaxMin(ActionList *running_actions,
lmm_system_t sys,
void (*solve) (lmm_system_t))
{
lmm_system_t sys,
void (*solve) (lmm_system_t))
{
- ActionPtr action = NULL;
double min = -1;
double value = -1;
double min = -1;
double value = -1;
: p_name(NULL), p_properties(NULL), p_model(NULL)
{}
: p_name(NULL), p_properties(NULL), p_model(NULL)
{}
-Resource::Resource(ModelPtr model, const char *name, xbt_dict_t props)
+Resource::Resource(Model *model, const char *name, xbt_dict_t props)
: p_name(xbt_strdup(name)), p_properties(props), p_model(model)
, m_running(true), m_stateCurrent(SURF_RESOURCE_ON)
{}
: p_name(xbt_strdup(name)), p_properties(props), p_model(model)
, m_running(true), m_stateCurrent(SURF_RESOURCE_ON)
{}
-Resource::Resource(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint)
+Resource::Resource(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint)
: p_name(xbt_strdup(name)), p_properties(props), p_model(model)
, m_running(true), m_stateCurrent(SURF_RESOURCE_ON), p_constraint(constraint)
{}
: p_name(xbt_strdup(name)), p_properties(props), p_model(model)
, m_running(true), m_stateCurrent(SURF_RESOURCE_ON), p_constraint(constraint)
{}
-Resource::Resource(ModelPtr model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit)
+Resource::Resource(Model *model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit)
: p_name(xbt_strdup(name)), p_properties(props), p_model(model)
, m_running(true), m_stateCurrent(stateInit)
{}
: p_name(xbt_strdup(name)), p_properties(props), p_model(model)
, m_running(true), m_stateCurrent(stateInit)
{}
-ModelPtr Resource::getModel() {
+Model *Resource::getModel() {
"SURF_ACTION_NOT_IN_THE_SYSTEM"
};
"SURF_ACTION_NOT_IN_THE_SYSTEM"
};
-void Action::initialize(ModelPtr model, double cost, bool failed,
+void Action::initialize(Model *model, double cost, bool failed,
lmm_variable_t var)
{
m_priority = 1.0;
lmm_variable_t var)
{
m_priority = 1.0;
-Action::Action(ModelPtr model, double cost, bool failed)
+Action::Action(Model *model, double cost, bool failed)
{
initialize(model, cost, failed);
p_category = NULL;
{
initialize(model, cost, failed);
p_category = NULL;
p_stateSet->push_back(*this);
}
p_stateSet->push_back(*this);
}
-Action::Action(ModelPtr model, double cost, bool failed, lmm_variable_t var)
+Action::Action(Model *model, double cost, bool failed, lmm_variable_t var)
{
initialize(model, cost, failed, var);
p_category = NULL;
{
initialize(model, cost, failed, var);
p_category = NULL;
/* added to manage the communication action's heap */
void surf_action_lmm_update_index_heap(void *action, int i) {
/* added to manage the communication action's heap */
void surf_action_lmm_update_index_heap(void *action, int i) {
- ((ActionPtr)action)->updateIndexHeap(i);
+ static_cast<Action*>(action)->updateIndexHeap(i);
}
void Action::updateIndexHeap(int i) {
}
void Action::updateIndexHeap(int i) {
double_update(&m_remains, m_lastValue * delta, sg_surf_precision*sg_maxmin_precision);
if (getModel() == surf_cpu_model_pm && TRACE_is_enabled()) {
double_update(&m_remains, m_lastValue * delta, sg_surf_precision*sg_maxmin_precision);
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)));
+ Resource *cpu = static_cast<Resource*>(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);
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);
/***********
* Classes *
***********/
/***********
* Classes *
***********/
-//class Model;
-typedef Model* ModelPtr;
-
-//class Resource;
-typedef Resource* ResourcePtr;
-
-//class Action;
-typedef Action* ActionPtr;
-
typedef boost::intrusive::list<Action> ActionList;
typedef ActionList* ActionListPtr;
typedef boost::intrusive::list_base_hook<> actionHook;
typedef boost::intrusive::list<Action> ActionList;
typedef ActionList* ActionListPtr;
typedef boost::intrusive::list_base_hook<> actionHook;
* @param name The name of the Resource
* @param props Dictionary of properties associated to this Resource
*/
* @param name The name of the Resource
* @param props Dictionary of properties associated to this Resource
*/
- Resource(ModelPtr model, const char *name, xbt_dict_t props);
+ Resource(Model *model, const char *name, xbt_dict_t props);
/**
* @brief Resource constructor
/**
* @brief Resource constructor
* @param props Dictionary of properties associated to this Resource
* @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
*/
* @param props Dictionary of properties associated to this Resource
* @param constraint The lmm constraint associated to this Resource if it is part of a LMM component
*/
- Resource(ModelPtr model, const char *name, xbt_dict_t props, lmm_constraint_t constraint);
+ Resource(Model *model, const char *name, xbt_dict_t props, lmm_constraint_t constraint);
/**
* @brief Resource constructor
*
/**
* @brief Resource constructor
*
* @param props Dictionary of properties associated to this Resource
* @param stateInit the initial state of the Resource
*/
* @param props Dictionary of properties associated to this Resource
* @param stateInit the initial state of the Resource
*/
- Resource(ModelPtr model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit);
+ Resource(Model *model, const char *name, xbt_dict_t props, e_surf_resource_state_t stateInit);
/**
* @brief Resource destructor
/**
* @brief Resource destructor
*
* @return The Model of the current Resource
*/
*
* @return The Model of the current Resource
*/
/**
* @brief Get the name of the current Resource
/**
* @brief Get the name of the current Resource
private:
const char *p_name;
xbt_dict_t p_properties;
private:
const char *p_name;
xbt_dict_t p_properties;
bool m_running;
e_surf_resource_state_t m_stateCurrent;
bool m_running;
e_surf_resource_state_t m_stateCurrent;
/**
* @brief Common initializations for the constructors
*/
/**
* @brief Common initializations for the constructors
*/
- void initialize(ModelPtr model, double cost, bool failed,
+ void initialize(Model *model, double cost, bool failed,
lmm_variable_t var = NULL);
public:
lmm_variable_t var = NULL);
public:
* @param cost The cost of the Action
* @param failed If the action is impossible (e.g.: execute something on a switched off host)
*/
* @param cost The cost of the Action
* @param failed If the action is impossible (e.g.: execute something on a switched off host)
*/
- Action(ModelPtr model, double cost, bool failed);
+ Action(Model *model, double cost, bool failed);
/**
* @brief Action constructor
/**
* @brief Action constructor
* @param failed If the action is impossible (e.g.: execute something on a switched off host)
* @param var The lmm variable associated to this Action if it is part of a LMM component
*/
* @param failed If the action is impossible (e.g.: execute something on a switched off host)
* @param var The lmm variable associated to this Action if it is part of a LMM component
*/
- Action(ModelPtr model, double cost, bool failed, lmm_variable_t var);
+ Action(Model *model, double cost, bool failed, lmm_variable_t var);
/**
* @brief Action destructor
/**
* @brief Action destructor
s_xbt_swag_hookup_t p_stateHookup;
s_xbt_swag_hookup_t p_stateHookup;
- ModelPtr getModel() {return p_model;}
+ Model *getModel() {return p_model;}
protected:
ActionListPtr p_stateSet;
protected:
ActionListPtr p_stateSet;
int m_latencyLimited; /**< Set to 1 if is limited by latency, 0 otherwise */
#endif
double m_cost;
int m_latencyLimited; /**< Set to 1 if is limited by latency, 0 otherwise */
#endif
double m_cost;
void *p_data; /**< for your convenience */
/* LMM */
void *p_data; /**< for your convenience */
/* LMM */
*
* Routing edges are either host and routers, whatever
*/
*
* Routing edges are either host and routers, whatever
*/
-RoutingEdgePtr sg_routing_edge_by_name_or_null(const char *name) {
+RoutingEdge *sg_routing_edge_by_name_or_null(const char *name) {
sg_host_t h = sg_host_by_name(name);
sg_host_t h = sg_host_by_name(name);
- RoutingEdgePtr net_elm = h==NULL?NULL: sg_host_edge(h);
+ RoutingEdge *net_elm = h==NULL?NULL: sg_host_edge(h);
- net_elm = (RoutingEdgePtr) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
+ net_elm = (RoutingEdge*) xbt_lib_get_or_null(as_router_lib, name, ROUTING_ASR_LEVEL);
return net_elm;
}
/* Global vars */
return net_elm;
}
/* Global vars */
-RoutingPlatfPtr routing_platf = NULL;
-AsPtr current_routing = NULL;
+RoutingPlatf *routing_platf = NULL;
+As *current_routing = NULL;
/* global parse functions */
extern xbt_dynar_t mount_list;
/* global parse functions */
extern xbt_dynar_t mount_list;
*/
static void parse_S_host_link(sg_platf_host_link_cbarg_t host)
{
*/
static void parse_S_host_link(sg_platf_host_link_cbarg_t host)
{
- RoutingEdgePtr info = sg_host_edge(sg_host_by_name(host->id));
+ RoutingEdge *info = sg_host_edge(sg_host_by_name(host->id));
xbt_assert(info, "Host '%s' not found!", host->id);
xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER] ||
current_routing->p_modelDesc == &routing_models[SURF_MODEL_VIVALDI],
xbt_assert(info, "Host '%s' not found!", host->id);
xbt_assert(current_routing->p_modelDesc == &routing_models[SURF_MODEL_CLUSTER] ||
current_routing->p_modelDesc == &routing_models[SURF_MODEL_VIVALDI],
xbt_assert(!sg_host_by_name(host->id),
"Reading a host, processing unit \"%s\" already exists", host->id);
xbt_assert(!sg_host_by_name(host->id),
"Reading a host, processing unit \"%s\" already exists", host->id);
- RoutingEdgePtr info = new RoutingEdgeImpl(xbt_strdup(host->id),
+ RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(host->id),
-1,
SURF_NETWORK_ELEMENT_HOST,
current_routing);
-1,
SURF_NETWORK_ELEMENT_HOST,
current_routing);
"Reading a router, processing unit \"%s\" already exists",
router->id);
"Reading a router, processing unit \"%s\" already exists",
router->id);
- RoutingEdgePtr info = new RoutingEdgeImpl(xbt_strdup(router->id),
+ RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(router->id),
-1,
SURF_NETWORK_ELEMENT_ROUTER,
current_routing);
-1,
SURF_NETWORK_ELEMENT_ROUTER,
current_routing);
}
/* make a new routing component */
}
/* make a new routing component */
- AsPtr new_as = model->create();
+ As *new_as = model->create();
new_as->p_modelDesc = model;
new_as->p_hierarchy = SURF_ROUTING_NULL;
new_as->p_name = xbt_strdup(AS->id);
new_as->p_modelDesc = model;
new_as->p_hierarchy = SURF_ROUTING_NULL;
new_as->p_name = xbt_strdup(AS->id);
- RoutingEdgePtr info = new RoutingEdgeImpl(xbt_strdup(new_as->p_name),
+ RoutingEdge *info = new RoutingEdgeImpl(xbt_strdup(new_as->p_name),
-1,
SURF_NETWORK_ELEMENT_AS,
current_routing);
-1,
SURF_NETWORK_ELEMENT_AS,
current_routing);
{
xbt_assert(src && dst, "bad parameters for \"elements_father\" method");
#define ELEMENTS_FATHER_MAXDEPTH 16 /* increase if it is not enough */
{
xbt_assert(src && dst, "bad parameters for \"elements_father\" method");
#define ELEMENTS_FATHER_MAXDEPTH 16 /* increase if it is not enough */
- AsPtr src_as, dst_as;
- AsPtr path_src[ELEMENTS_FATHER_MAXDEPTH];
- AsPtr path_dst[ELEMENTS_FATHER_MAXDEPTH];
+ As *src_as, *dst_as;
+ As *path_src[ELEMENTS_FATHER_MAXDEPTH];
+ As *path_dst[ELEMENTS_FATHER_MAXDEPTH];
int index_src = 0;
int index_dst = 0;
int index_src = 0;
int index_dst = 0;
- AsPtr current;
- AsPtr current_src;
- AsPtr current_dst;
- AsPtr father;
+ As *current;
+ As *current_src;
+ As *current_dst;
+ As *father;
/* (1) find the as where the src and dst are located */
sg_routing_edge_t src_data = src;
/* (1) find the as where the src and dst are located */
sg_routing_edge_t src_data = src;
* This function is called by "get_route" and "get_latency". It allows to walk
* recursively through the ASes tree.
*/
* This function is called by "get_route" and "get_latency". It allows to walk
* recursively through the ASes tree.
*/
-static void _get_route_and_latency(RoutingEdgePtr src, RoutingEdgePtr dst,
+static void _get_route_and_latency(RoutingEdge *src, RoutingEdge *dst,
xbt_dynar_t * links, double *latency)
{
s_sg_platf_route_cbarg_t route;
xbt_dynar_t * links, double *latency)
{
s_sg_platf_route_cbarg_t route;
XBT_DEBUG("Solve route/latency \"%s\" to \"%s\"", src->getName(), dst->getName());
/* Find how src and dst are interconnected */
XBT_DEBUG("Solve route/latency \"%s\" to \"%s\"", src->getName(), dst->getName());
/* Find how src and dst are interconnected */
- AsPtr common_father, src_father, dst_father;
+ As *common_father, *src_father, *dst_father;
elements_father(src, dst, &common_father, &src_father, &dst_father);
XBT_DEBUG("elements_father: common father '%s' src_father '%s' dst_father '%s'",
common_father->p_name, src_father->p_name, dst_father->p_name);
elements_father(src, dst, &common_father, &src_father, &dst_father);
XBT_DEBUG("elements_father: common father '%s' src_father '%s' dst_father '%s'",
common_father->p_name, src_father->p_name, dst_father->p_name);
route.link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
// Find the net_card corresponding to father
route.link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
// Find the net_card corresponding to father
- RoutingEdgePtr src_father_net_elm = src_father->p_netElem;
- RoutingEdgePtr dst_father_net_elm = dst_father->p_netElem;
+ RoutingEdge *src_father_net_elm = src_father->p_netElem;
+ RoutingEdge *dst_father_net_elm = dst_father->p_netElem;
common_father->getRouteAndLatency(src_father_net_elm, dst_father_net_elm,
&route, latency);
common_father->getRouteAndLatency(src_father_net_elm, dst_father_net_elm,
&route, latency);
* walk through the routing components tree and find a route between hosts
* by calling the differents "get_route" functions in each routing component.
*/
* walk through the routing components tree and find a route between hosts
* by calling the differents "get_route" functions in each routing component.
*/
-void RoutingPlatf::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst,
+void RoutingPlatf::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst,
xbt_dynar_t* route, double *latency)
{
XBT_DEBUG("routing_get_route_and_latency from %s to %s", src->getName(), dst->getName());
xbt_dynar_t* route, double *latency)
{
XBT_DEBUG("routing_get_route_and_latency from %s to %s", src->getName(), dst->getName());
return recursiveGetOneLinkRoutes(p_root);
}
return recursiveGetOneLinkRoutes(p_root);
}
-xbt_dynar_t RoutingPlatf::recursiveGetOneLinkRoutes(AsPtr rc)
+xbt_dynar_t RoutingPlatf::recursiveGetOneLinkRoutes(As *rc)
- xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
+ xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
//adding my one link routes
xbt_dynar_t onelink_mine = rc->getOneLinkRoutes();
//adding my one link routes
xbt_dynar_t onelink_mine = rc->getOneLinkRoutes();
e_surf_network_element_type_t routing_get_network_element_type(const char *name)
{
e_surf_network_element_type_t routing_get_network_element_type(const char *name)
{
- RoutingEdgePtr rc = sg_routing_edge_by_name_or_null(name);
+ RoutingEdge *rc = sg_routing_edge_by_name_or_null(name);
if (rc)
return rc->getRcType();
if (rc)
return rc->getRcType();
XBT_DEBUG("<AS id=\"%s\"\trouting=\"Torus_Cluster\">", cluster->id);
AS.routing = A_surfxml_AS_routing_Cluster___torus;
sg_platf_new_AS_begin(&AS);
XBT_DEBUG("<AS id=\"%s\"\trouting=\"Torus_Cluster\">", cluster->id);
AS.routing = A_surfxml_AS_routing_Cluster___torus;
sg_platf_new_AS_begin(&AS);
- ((AsClusterTorusPtr)current_routing)->parse_specific_arguments(cluster);
+ ((AsClusterTorus*)current_routing)->parse_specific_arguments(cluster);
}
else if (cluster->topology == SURF_CLUSTER_FAT_TREE) {
XBT_DEBUG("<AS id=\"%s\"\trouting=\"Fat_Tree_Cluster\">", cluster->id);
}
else if (cluster->topology == SURF_CLUSTER_FAT_TREE) {
XBT_DEBUG("<AS id=\"%s\"\trouting=\"Fat_Tree_Cluster\">", cluster->id);
}
if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){
}
if(cluster->loopback_bw!=0 || cluster->loopback_lat!=0){
- ((AsClusterPtr)current_routing)->p_nb_links_per_node++;
- ((AsClusterPtr)current_routing)->p_has_loopback=1;
+ ((AsCluster*)current_routing)->p_nb_links_per_node++;
+ ((AsCluster*)current_routing)->p_has_loopback=1;
}
if(cluster->limiter_link!=0){
}
if(cluster->limiter_link!=0){
- ((AsClusterPtr)current_routing)->p_nb_links_per_node++;
- ((AsClusterPtr)current_routing)->p_has_limiter=1;
+ ((AsCluster*)current_routing)->p_nb_links_per_node++;
+ ((AsCluster*)current_routing)->p_has_limiter=1;
info_loop.link_up = Link::byName(tmp_link);
info_loop.link_down = info_loop.link_up;
free(tmp_link);
info_loop.link_up = Link::byName(tmp_link);
info_loop.link_down = info_loop.link_up;
free(tmp_link);
- xbt_dynar_set(current_routing->p_linkUpDownList, rankId*((AsClusterPtr)current_routing)->p_nb_links_per_node, &info_loop);
+ xbt_dynar_set(current_routing->p_linkUpDownList, rankId*(static_cast<AsCluster*>(current_routing))->p_nb_links_per_node, &info_loop);
}
//add a limiter link (shared link to account for maximal bandwidth of the node)
}
//add a limiter link (shared link to account for maximal bandwidth of the node)
info_lim.link_down = info_lim.link_up;
free(tmp_link);
xbt_dynar_set(current_routing->p_linkUpDownList,
info_lim.link_down = info_lim.link_up;
free(tmp_link);
xbt_dynar_set(current_routing->p_linkUpDownList,
- rankId*((AsClusterPtr)current_routing)->p_nb_links_per_node + ((AsClusterPtr)current_routing)->p_has_loopback ,
+ rankId*(static_cast<AsCluster*>(current_routing))->p_nb_links_per_node + static_cast<AsCluster*>(current_routing)->p_has_loopback ,
((AsClusterFatTree*) current_routing)->addProcessingNode(i);
}
else {
((AsClusterFatTree*) current_routing)->addProcessingNode(i);
}
else {
- ((AsClusterPtr)current_routing)->create_links_for_node(cluster, i, rankId, rankId*
- ((AsClusterPtr)current_routing)->p_nb_links_per_node
- + ((AsClusterPtr)current_routing)->p_has_loopback
- + ((AsClusterPtr)current_routing)->p_has_limiter );
+ static_cast<AsCluster*>(current_routing)->create_links_for_node(cluster, i, rankId, rankId*
+ static_cast<AsCluster*>(current_routing)->p_nb_links_per_node
+ + static_cast<AsCluster*>(current_routing)->p_has_loopback
+ + static_cast<AsCluster*>(current_routing)->p_has_limiter );
}
xbt_free(link_id);
xbt_free(host_id);
}
xbt_free(link_id);
xbt_free(host_id);
// For fat trees, the links must be created once all nodes have been added
if(cluster->topology == SURF_CLUSTER_FAT_TREE) {
// For fat trees, the links must be created once all nodes have been added
if(cluster->topology == SURF_CLUSTER_FAT_TREE) {
- ((AsClusterFatTree*)current_routing)->create_links();
+ static_cast<AsClusterFatTree*>(current_routing)->create_links();
}
// Add a router. It is magically used thanks to the way in which surf_routing_cluster is written,
// and it's very useful to connect clusters together
}
// Add a router. It is magically used thanks to the way in which surf_routing_cluster is written,
// and it's very useful to connect clusters together
bprintf("%s%s_router%s", cluster->prefix, cluster->id,
cluster->suffix);
sg_platf_new_router(&router);
bprintf("%s%s_router%s", cluster->prefix, cluster->id,
cluster->suffix);
sg_platf_new_router(&router);
- ((AsClusterPtr)current_routing)->p_router = (RoutingEdgePtr) xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL);
+ ((AsCluster*)current_routing)->p_router = (RoutingEdge*) xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL);
free(newid);
//Make the backbone
free(newid);
//Make the backbone
router.id = router_id;
router.coord = peer->coord;
sg_platf_new_router(&router);
router.id = router_id;
router.coord = peer->coord;
sg_platf_new_router(&router);
- static_cast<AsClusterPtr>(current_routing)->p_router = static_cast<RoutingEdgePtr>(xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL));
+ static_cast<AsCluster*>(current_routing)->p_router = static_cast<RoutingEdge*>(xbt_lib_get_or_null(as_router_lib, router.id, ROUTING_ASR_LEVEL));
XBT_DEBUG("</AS>");
sg_platf_new_AS_end();
XBT_DEBUG("</AS>");
sg_platf_new_AS_end();
xbt_lib_cursor_t cursor;
char *key;
void **data;
xbt_lib_cursor_t cursor;
char *key;
void **data;
- RoutingEdgePtr host_elm;
xbt_lib_foreach(storage_lib, cursor, key, data) {
if(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL) != NULL) {
xbt_lib_foreach(storage_lib, cursor, key, data) {
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));
+ Storage *storage = static_cast<Storage*>(xbt_lib_get_level(xbt_lib_get_elm_or_null(storage_lib, key), SURF_STORAGE_LEVEL));
host_elm = sg_routing_edge_by_name_or_null(storage->p_attach);
if(!host_elm)
surf_parse_error("Unable to attach storage %s: host %s doesn't exist.", storage->getName(), storage->p_attach);
host_elm = sg_routing_edge_by_name_or_null(storage->p_attach);
if(!host_elm)
surf_parse_error("Unable to attach storage %s: host %s doesn't exist.", storage->getName(), storage->p_attach);
* This fuction is call by "finalize". It allow to finalize the
* AS or routing components. It delete all the structures.
*/
* This fuction is call by "finalize". It allow to finalize the
* AS or routing components. It delete all the structures.
*/
-static void finalize_rec(AsPtr as) {
+static void finalize_rec(As *as) {
xbt_dict_cursor_t cursor = NULL;
char *key;
AS_t elem;
xbt_dict_cursor_t cursor = NULL;
char *key;
AS_t elem;
return routing_platf->p_root;
}
return routing_platf->p_root;
}
-const char *surf_AS_get_name(AsPtr as) {
+const char *surf_AS_get_name(As *as) {
-static AsPtr surf_AS_recursive_get_by_name(AsPtr current, const char * name) {
+static As *surf_AS_recursive_get_by_name(As *current, const char * name) {
xbt_dict_cursor_t cursor = NULL;
char *key;
AS_t elem;
xbt_dict_cursor_t cursor = NULL;
char *key;
AS_t elem;
if(!strcmp(current->p_name, name))
return current;
if(!strcmp(current->p_name, name))
return current;
-AsPtr surf_AS_get_by_name(const char * name) {
- AsPtr as = surf_AS_recursive_get_by_name(routing_platf->p_root, name);
+As *surf_AS_get_by_name(const char * name) {
+ As *as = surf_AS_recursive_get_by_name(routing_platf->p_root, name);
if(as == NULL)
XBT_WARN("Impossible to find an AS with name %s, please check your input", name);
return as;
}
if(as == NULL)
XBT_WARN("Impossible to find an AS with name %s, please check your input", name);
return as;
}
-xbt_dict_t surf_AS_get_routing_sons(AsPtr as) {
+xbt_dict_t surf_AS_get_routing_sons(As *as) {
return as->p_routingSons;
}
return as->p_routingSons;
}
-const char *surf_AS_get_model(AsPtr as) {
+const char *surf_AS_get_model(As *as) {
return as->p_modelDesc->name;
}
return as->p_modelDesc->name;
}
-xbt_dynar_t surf_AS_get_hosts(AsPtr as) {
+xbt_dynar_t surf_AS_get_hosts(As *as) {
xbt_dynar_t elms = as->p_indexNetworkElm;
sg_routing_edge_t relm;
xbt_dictelm_t delm;
xbt_dynar_t elms = as->p_indexNetworkElm;
sg_routing_edge_t relm;
xbt_dictelm_t delm;
int count = xbt_dynar_length(elms);
xbt_dynar_t res = xbt_dynar_new(sizeof(xbt_dictelm_t), NULL);
for (index = 0; index < count; index++) {
int count = xbt_dynar_length(elms);
xbt_dynar_t res = xbt_dynar_new(sizeof(xbt_dictelm_t), NULL);
for (index = 0; index < count; index++) {
- relm = xbt_dynar_get_as(elms, index, RoutingEdgePtr);
+ relm = xbt_dynar_get_as(elms, index, RoutingEdge*);
delm = xbt_lib_get_elm_or_null(host_lib, relm->getName());
if (delm!=NULL) {
xbt_dynar_push(res, &delm);
delm = xbt_lib_get_elm_or_null(host_lib, relm->getName());
if (delm!=NULL) {
xbt_dynar_push(res, &delm);
-/* Note: As and RoutingEdge are declared as struct instead of class, to keep
- compatibility with C files where they are mentioned. */
-struct As;
-typedef As *AsPtr;
-
class RoutingModelDescription;
class RoutingModelDescription;
-typedef RoutingModelDescription *RoutingModelDescriptionPtr;
-
-typedef Onelink *OnelinkPtr;
-
-typedef RoutingPlatf *RoutingPlatfPtr;
/** @ingroup SURF_routing_interface
* @brief The Autonomous System (AS) routing interface
* @details [TODO]
*/
/** @ingroup SURF_routing_interface
* @brief The Autonomous System (AS) routing interface
* @details [TODO]
*/
public:
xbt_dynar_t p_indexNetworkElm;
xbt_dict_t p_bypassRoutes; /* store bypass routes */
routing_model_description_t p_modelDesc;
e_surf_routing_hierarchy_t p_hierarchy;
char *p_name;
public:
xbt_dynar_t p_indexNetworkElm;
xbt_dict_t p_bypassRoutes; /* store bypass routes */
routing_model_description_t p_modelDesc;
e_surf_routing_hierarchy_t p_hierarchy;
char *p_name;
xbt_dict_t p_routingSons;
xbt_dict_t p_routingSons;
- RoutingEdgePtr p_netElem;
+ RoutingEdge *p_netElem;
xbt_dynar_t p_linkUpDownList;
/**
xbt_dynar_t p_linkUpDownList;
/**
* @param into [description]
* @param latency [description]
*/
* @param into [description]
* @param latency [description]
*/
- virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency)=0;
+ virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency)=0;
virtual xbt_dynar_t getOneLinkRoutes()=0;
virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0;
virtual xbt_dynar_t getOneLinkRoutes()=0;
virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges)=0;
- virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat)=0;
+ virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat)=0;
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
- virtual int parsePU(RoutingEdgePtr elm)=0; /* A host or a router, whatever */
- virtual int parseAS( RoutingEdgePtr elm)=0;
+ virtual int parsePU(RoutingEdge *elm)=0; /* A host or a router, whatever */
+ virtual int parseAS( RoutingEdge *elm)=0;
virtual void parseRoute(sg_platf_route_cbarg_t route)=0;
virtual void parseASroute(sg_platf_route_cbarg_t route)=0;
virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
virtual void parseRoute(sg_platf_route_cbarg_t route)=0;
virtual void parseASroute(sg_platf_route_cbarg_t route)=0;
virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
virtual int *getIdPtr()=0;
virtual void setId(int id)=0;
virtual char *getName()=0;
virtual int *getIdPtr()=0;
virtual void setId(int id)=0;
virtual char *getName()=0;
- virtual AsPtr getRcComponent()=0;
+ virtual As *getRcComponent()=0;
virtual e_surf_network_element_type_t getRcType()=0;
};
struct RoutingEdgeImpl : public RoutingEdge {
public:
virtual e_surf_network_element_type_t getRcType()=0;
};
struct RoutingEdgeImpl : public RoutingEdge {
public:
- RoutingEdgeImpl(char *name, int id, e_surf_network_element_type_t rcType, AsPtr rcComponent)
+ RoutingEdgeImpl(char *name, int id, e_surf_network_element_type_t rcType, As *rcComponent)
: p_rcComponent(rcComponent), p_rcType(rcType), m_id(id), p_name(name) {}
~RoutingEdgeImpl() { xbt_free(p_name);};
: p_rcComponent(rcComponent), p_rcType(rcType), m_id(id), p_name(name) {}
~RoutingEdgeImpl() { xbt_free(p_name);};
int *getIdPtr() {return &m_id;}
void setId(int id) {m_id = id;}
char *getName() {return p_name;}
int *getIdPtr() {return &m_id;}
void setId(int id) {m_id = id;}
char *getName() {return p_name;}
- AsPtr getRcComponent() {return p_rcComponent;}
+ As *getRcComponent() {return p_rcComponent;}
e_surf_network_element_type_t getRcType() {return p_rcType;}
private:
e_surf_network_element_type_t getRcType() {return p_rcType;}
private:
e_surf_network_element_type_t p_rcType;
int m_id;
char *p_name;
e_surf_network_element_type_t p_rcType;
int m_id;
char *p_name;
int *getIdPtr() {return p_re->getIdPtr();}
void setId(int id) {p_re->setId(id);}
char *getName() {return p_re->getName();}
int *getIdPtr() {return p_re->getIdPtr();}
void setId(int id) {p_re->setId(id);}
char *getName() {return p_re->getName();}
- AsPtr getRcComponent() {return p_re->getRcComponent();}
+ As *getRcComponent() {return p_re->getRcComponent();}
e_surf_network_element_type_t getRcType() {return p_re->getRcType();}
private:
RoutingEdge *p_re;
e_surf_network_element_type_t getRcType() {return p_re->getRcType();}
private:
RoutingEdge *p_re;
*/
class Onelink {
public:
*/
class Onelink {
public:
- Onelink(void *link, RoutingEdgePtr src, RoutingEdgePtr dst)
+ Onelink(void *link, RoutingEdge *src, RoutingEdge *dst)
: p_src(src), p_dst(dst), p_link(link) {};
: p_src(src), p_dst(dst), p_link(link) {};
- RoutingEdgePtr p_src;
- RoutingEdgePtr p_dst;
+ RoutingEdge *p_src;
+ RoutingEdge *p_dst;
XBT_PUBLIC_CLASS RoutingPlatf {
public:
~RoutingPlatf();
XBT_PUBLIC_CLASS RoutingPlatf {
public:
~RoutingPlatf();
void *p_loopback;
xbt_dynar_t p_lastRoute;
xbt_dynar_t getOneLinkRoutes(void);
void *p_loopback;
xbt_dynar_t p_lastRoute;
xbt_dynar_t getOneLinkRoutes(void);
- xbt_dynar_t recursiveGetOneLinkRoutes(AsPtr rc);
- void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, xbt_dynar_t * links, double *latency);
+ xbt_dynar_t recursiveGetOneLinkRoutes(As *rc);
+ void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, xbt_dynar_t * links, double *latency);
};
#endif /* NETWORK_ROUTING_HPP_ */
};
#endif /* NETWORK_ROUTING_HPP_ */
-void AsCluster::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat)
+void AsCluster::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat)
{
s_surf_parsing_link_up_down_t info;
XBT_VERB("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]",
{
s_surf_parsing_link_up_down_t info;
XBT_VERB("cluster_get_route_and_latency from '%s'[%d] to '%s'[%d]",
- xbt_dynar_push_as(route->link_list, void *, static_cast<ResourcePtr>(p_backbone));
+ xbt_dynar_push_as(route->link_list, void *, static_cast<Resource*>(p_backbone));
if (lat)
*lat += p_backbone->getLatency();
}
if (lat)
*lat += p_backbone->getLatency();
}
int isrc;
int table_size = xbt_dynar_length(p_indexNetworkElm);
int isrc;
int table_size = xbt_dynar_length(p_indexNetworkElm);
xbt_node_t current, previous, backboneNode = NULL, routerNode;
s_surf_parsing_link_up_down_t info;
xbt_node_t current, previous, backboneNode = NULL, routerNode;
s_surf_parsing_link_up_down_t info;
}
for (isrc = 0; isrc < table_size; isrc++) {
}
for (isrc = 0; isrc < table_size; isrc++) {
- src = xbt_dynar_get_as(p_indexNetworkElm, isrc, RoutingEdgePtr);
+ src = xbt_dynar_get_as(p_indexNetworkElm, isrc, RoutingEdge*);
if (src->getRcType() != SURF_NETWORK_ELEMENT_ROUTER) {
previous = new_xbt_graph_node(graph, src->getName(), nodes);
if (src->getRcType() != SURF_NETWORK_ELEMENT_ROUTER) {
previous = new_xbt_graph_node(graph, src->getName(), nodes);
if (info.link_up) { // link up
if (info.link_up) { // link up
- const char *link_name = static_cast<ResourcePtr>(info.link_up)->getName();
+ const char *link_name = static_cast<Resource*>(info.link_up)->getName();
current = new_xbt_graph_node(graph, link_name, nodes);
new_xbt_graph_edge(graph, previous, current, edges);
current = new_xbt_graph_node(graph, link_name, nodes);
new_xbt_graph_edge(graph, previous, current, edges);
}
if (info.link_down) { // link down
}
if (info.link_down) { // link down
- const char *link_name = static_cast<ResourcePtr>(info.link_down)->getName();
+ const char *link_name = static_cast<Resource*>(info.link_down)->getName();
current = new_xbt_graph_node(graph, link_name, nodes);
new_xbt_graph_edge(graph, previous, current, edges);
current = new_xbt_graph_node(graph, link_name, nodes);
new_xbt_graph_edge(graph, previous, current, edges);
-int AsCluster::parsePU(RoutingEdgePtr elm) {
+int AsCluster::parsePU(RoutingEdge *elm) {
XBT_DEBUG("Load process unit \"%s\"", elm->getName());
XBT_DEBUG("Load process unit \"%s\"", elm->getName());
- xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+ xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
return xbt_dynar_length(p_indexNetworkElm)-1;
}
return xbt_dynar_length(p_indexNetworkElm)-1;
}
-int AsCluster::parseAS(RoutingEdgePtr elm) {
+int AsCluster::parseAS(RoutingEdge *elm) {
XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName());
XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName());
- xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+ xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
return xbt_dynar_length(p_indexNetworkElm)-1;
}
return xbt_dynar_length(p_indexNetworkElm)-1;
}
* Classes *
***********/
class AsCluster;
* Classes *
***********/
class AsCluster;
-typedef AsCluster *AsClusterPtr;
/* ************************************************** */
/* ************************************************** */
- virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+ virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
//xbt_dynar_t getOneLinkRoutes();
//void parseRoute(sg_platf_route_cbarg_t route);
//void parseASroute(sg_platf_route_cbarg_t route);
void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
//xbt_dynar_t getOneLinkRoutes();
//void parseRoute(sg_platf_route_cbarg_t route);
//void parseASroute(sg_platf_route_cbarg_t route);
void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
- //sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+ //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
- int parsePU(RoutingEdgePtr elm); /* A host or a router, whatever */
- int parseAS(RoutingEdgePtr elm);
+ int parsePU(RoutingEdge *elm); /* A host or a router, whatever */
+ int parseAS(RoutingEdge *elm);
virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position);
Link* p_backbone;
void *p_loopback;
virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position);
Link* p_backbone;
void *p_loopback;
- RoutingEdgePtr p_router;
int p_has_limiter;
int p_has_loopback;
int p_nb_links_per_node;
int p_has_limiter;
int p_has_loopback;
int p_nb_links_per_node;
-void AsClusterFatTree::getRouteAndLatency(RoutingEdgePtr src,
- RoutingEdgePtr dst,
+void AsClusterFatTree::getRouteAndLatency(RoutingEdge *src,
+ RoutingEdge *dst,
sg_platf_route_cbarg_t into,
double *latency) {
FatTreeNode *source, *destination, *currentNode;
sg_platf_route_cbarg_t into,
double *latency) {
FatTreeNode *source, *destination, *currentNode;
public:
AsClusterFatTree();
~AsClusterFatTree();
public:
AsClusterFatTree();
~AsClusterFatTree();
- virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst,
+ virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst,
sg_platf_route_cbarg_t into,
double *latency);
sg_platf_route_cbarg_t into,
double *latency);
xbt_dynar_free(&dimensions);
}
xbt_dynar_free(&dimensions);
}
-void AsClusterTorus::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat){
+void AsClusterTorus::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat){
XBT_VERB("torus_get_route_and_latency from '%s'[%d] to '%s'[%d]",
src->getName(), src->getId(),
XBT_VERB("torus_get_route_and_latency from '%s'[%d] to '%s'[%d]",
src->getName(), src->getId(),
#ifndef SURF_ROUTING_CLUSTER_TORUS_HPP_
#define SURF_ROUTING_CLUSTER_TORUS_HPP_
#ifndef SURF_ROUTING_CLUSTER_TORUS_HPP_
#define SURF_ROUTING_CLUSTER_TORUS_HPP_
-class AsClusterTorus;
-typedef AsClusterTorus *AsClusterTorusPtr;
-
-
class AsClusterTorus: public AsCluster {
public:
AsClusterTorus();
virtual ~AsClusterTorus();
virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position);
class AsClusterTorus: public AsCluster {
public:
AsClusterTorus();
virtual ~AsClusterTorus();
virtual void create_links_for_node(sg_platf_cluster_cbarg_t cluster, int id, int rank, int position);
- virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+ virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster);
void parse_specific_arguments(sg_platf_cluster_cbarg_t cluster);
void model_dijkstra_both_end(AS_t as)
{
void model_dijkstra_both_end(AS_t as)
{
- AsDijkstraPtr THIS_AS = static_cast<AsDijkstraPtr>(as);
+ AsDijkstra *THIS_AS = static_cast<AsDijkstra*>(as);
xbt_node_t node = NULL;
unsigned int cursor2;
xbt_dynar_t nodes = NULL;
xbt_node_t node = NULL;
unsigned int cursor2;
xbt_dynar_t nodes = NULL;
xbt_dynar_t AsDijkstra::getOnelinkRoutes()
{
xbt_dynar_t AsDijkstra::getOnelinkRoutes()
{
- xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
+ xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
int src,dst;
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t,1);
route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t),NULL);
int src,dst;
- RoutingEdgePtr src_elm, dst_elm;
+ RoutingEdge *src_elm, *dst_elm;
int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
for(src=0; src < table_size; src++) {
for(dst=0; dst< table_size; dst++) {
xbt_dynar_reset(route->link_list);
int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
for(src=0; src < table_size; src++) {
for(dst=0; dst< table_size; dst++) {
xbt_dynar_reset(route->link_list);
- src_elm = xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdgePtr);
- dst_elm = xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdgePtr);
+ src_elm = xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdge*);
+ dst_elm = xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdge*);
this->getRouteAndLatency(src_elm, dst_elm,route, NULL);
if (xbt_dynar_length(route->link_list) == 1) {
void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
this->getRouteAndLatency(src_elm, dst_elm,route, NULL);
if (xbt_dynar_length(route->link_list) == 1) {
void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
if (p_hierarchy == SURF_ROUTING_BASE)
onelink = new Onelink(link, src_elm, dst_elm);
else if (p_hierarchy == SURF_ROUTING_RECURSIVE)
if (p_hierarchy == SURF_ROUTING_BASE)
onelink = new Onelink(link, src_elm, dst_elm);
else if (p_hierarchy == SURF_ROUTING_RECURSIVE)
-void AsDijkstra::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat)
+void AsDijkstra::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat)
}
/* compose route path with links */
}
/* compose route path with links */
- RoutingEdgePtr gw_src = NULL, gw_dst, prev_gw_src, first_gw = NULL;
- RoutingEdgePtr gw_dst_net_elm = NULL, prev_gw_src_net_elm = NULL;
+ RoutingEdge *gw_src = NULL, *gw_dst, *prev_gw_src, *first_gw = NULL;
+ RoutingEdge *gw_dst_net_elm = NULL, *prev_gw_src_net_elm = NULL;
for (v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
xbt_node_t node_pred_v =
for (v = dst_node_id; v != src_node_id; v = pred_arr[v]) {
xbt_node_t node_pred_v =
surf_parse_error("The gw_src '%s' does not exist!",route->gw_src->getName());
}
surf_parse_error("The gw_src '%s' does not exist!",route->gw_src->getName());
}
- RoutingEdgePtr src_net_elm, dst_net_elm;
+ RoutingEdge *src_net_elm, *dst_net_elm;
src_net_elm = sg_routing_edge_by_name_or_null(src);
dst_net_elm = sg_routing_edge_by_name_or_null(dst);
src_net_elm = sg_routing_edge_by_name_or_null(src);
dst_net_elm = sg_routing_edge_by_name_or_null(dst);
THROWF(arg_error,0,"(AS)Route from '%s' to '%s' already exists",src,dst);
if (route->gw_dst && route->gw_src) {
THROWF(arg_error,0,"(AS)Route from '%s' to '%s' already exists",src,dst);
if (route->gw_dst && route->gw_src) {
gw_tmp = route->gw_src;
route->gw_src = route->gw_dst;
route->gw_dst = gw_tmp;
gw_tmp = route->gw_src;
route->gw_src = route->gw_dst;
route->gw_dst = gw_tmp;
* Classes *
***********/
class AsDijkstra;
* Classes *
***********/
class AsDijkstra;
-typedef AsDijkstra *AsDijkstraPtr;
class AsDijkstra : public AsGeneric {
public:
class AsDijkstra : public AsGeneric {
public:
* will have a loopback attached to it.
*/
void addLoopback();
* will have a loopback attached to it.
*/
void addLoopback();
- void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat);
+ void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat);
xbt_dynar_t getOnelinkRoutes();
void getRouteAndLatency(sg_platf_route_cbarg_t route, double *lat);
void parseASroute(sg_platf_route_cbarg_t route);
xbt_dynar_t getOnelinkRoutes();
void getRouteAndLatency(sg_platf_route_cbarg_t route, double *lat);
void parseASroute(sg_platf_route_cbarg_t route);
void model_floyd_end(AS_t current_routing)
{
void model_floyd_end(AS_t current_routing)
{
- static_cast<AsFloydPtr>(current_routing)->end();
+ static_cast<AsFloyd*>(current_routing)->end();
}
AsFloyd::AsFloyd(): AsGeneric() {
}
AsFloyd::AsFloyd(): AsGeneric() {
/* Business methods */
xbt_dynar_t AsFloyd::getOneLinkRoutes()
{
/* Business methods */
xbt_dynar_t AsFloyd::getOneLinkRoutes()
{
- xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
+ xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
for(src=0; src < table_size; src++) {
for(dst=0; dst< table_size; dst++) {
xbt_dynar_reset(route->link_list);
for(src=0; src < table_size; src++) {
for(dst=0; dst< table_size; dst++) {
xbt_dynar_reset(route->link_list);
- src_elm = xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdgePtr);
- dst_elm = xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdgePtr);
+ src_elm = xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdge*);
+ dst_elm = xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdge*);
this->getRouteAndLatency(src_elm, dst_elm, route, NULL);
if (xbt_dynar_length(route->link_list) == 1) {
void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
this->getRouteAndLatency(src_elm, dst_elm, route, NULL);
if (xbt_dynar_length(route->link_list) == 1) {
void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
if (p_hierarchy == SURF_ROUTING_BASE)
onelink = new Onelink(link, src_elm, dst_elm);
else if (p_hierarchy == SURF_ROUTING_RECURSIVE)
if (p_hierarchy == SURF_ROUTING_BASE)
onelink = new Onelink(link, src_elm, dst_elm);
else if (p_hierarchy == SURF_ROUTING_RECURSIVE)
-void AsFloyd::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t res, double *lat)
+void AsFloyd::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t res, double *lat)
/* set the size of table routing */
int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
/* set the size of table routing */
int table_size = (int)xbt_dynar_length(p_indexNetworkElm);
- RoutingEdgePtr src_net_elm, dst_net_elm;
+ RoutingEdge *src_net_elm, *dst_net_elm;
src_net_elm = sg_routing_edge_by_name_or_null(src);
dst_net_elm = sg_routing_edge_by_name_or_null(dst);
src_net_elm = sg_routing_edge_by_name_or_null(src);
dst_net_elm = sg_routing_edge_by_name_or_null(dst);
* Classes *
***********/
class AsFloyd;
* Classes *
***********/
class AsFloyd;
-typedef AsFloyd *AsFloydPtr;
class AsFloyd: public AsGeneric {
public:
AsFloyd();
~AsFloyd();
class AsFloyd: public AsGeneric {
public:
AsFloyd();
~AsFloyd();
- void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+ void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
xbt_dynar_t getOneLinkRoutes();
void parseASroute(sg_platf_route_cbarg_t route);
void parseRoute(sg_platf_route_cbarg_t route);
xbt_dynar_t getOneLinkRoutes();
void parseASroute(sg_platf_route_cbarg_t route);
void parseRoute(sg_platf_route_cbarg_t route);
//void parseASroute(sg_platf_route_cbarg_t route);
//void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
//void parseASroute(sg_platf_route_cbarg_t route);
//void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
- //sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+ //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
- //int parsePU(RoutingEdgePtr elm); /* A host or a router, whatever */
- //int parseAS(RoutingEdgePtr elm);
+ //int parsePU(RoutingEdge *elm); /* A host or a router, whatever */
+ //int parseAS(RoutingEdge *elm);
//virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
//virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
sg_platf_route_cbarg_t e_route;
/* set utils vars */
sg_platf_route_cbarg_t e_route;
/* set utils vars */
- AsFullPtr routing = ((AsFullPtr) _routing);
+ AsFull *routing = static_cast<AsFull*>(_routing);
int table_size = (int)xbt_dynar_length(routing->p_indexNetworkElm);
/* Create table if necessary */
int table_size = (int)xbt_dynar_length(routing->p_indexNetworkElm);
/* Create table if necessary */
xbt_dynar_t AsFull::getOneLinkRoutes()
{
xbt_dynar_t AsFull::getOneLinkRoutes()
{
- xbt_dynar_t ret = xbt_dynar_new(sizeof(OnelinkPtr), xbt_free_f);
+ xbt_dynar_t ret = xbt_dynar_new(sizeof(Onelink*), xbt_free_f);
int src, dst;
int table_size = xbt_dynar_length(p_indexNetworkElm);
int src, dst;
int table_size = xbt_dynar_length(p_indexNetworkElm);
if (route) {
if (xbt_dynar_length(route->link_list) == 1) {
void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
if (route) {
if (xbt_dynar_length(route->link_list) == 1) {
void *link = *(void **) xbt_dynar_get_ptr(route->link_list, 0);
if (p_hierarchy == SURF_ROUTING_BASE) {
if (p_hierarchy == SURF_ROUTING_BASE) {
- RoutingEdgePtr tmp_src = xbt_dynar_get_as(p_indexNetworkElm, src, sg_routing_edge_t);
+ RoutingEdge *tmp_src = xbt_dynar_get_as(p_indexNetworkElm, src, sg_routing_edge_t);
- RoutingEdgePtr tmp_dst = xbt_dynar_get_as(p_indexNetworkElm, dst, sg_routing_edge_t);
+ RoutingEdge *tmp_dst = xbt_dynar_get_as(p_indexNetworkElm, dst, sg_routing_edge_t);
tmp_dst->setId(dst);
onelink = new Onelink(link, tmp_src, tmp_dst);
} else if (p_hierarchy == SURF_ROUTING_RECURSIVE)
tmp_dst->setId(dst);
onelink = new Onelink(link, tmp_src, tmp_dst);
} else if (p_hierarchy == SURF_ROUTING_RECURSIVE)
-void AsFull::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t res, double *lat)
+void AsFull::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t res, double *lat)
{
XBT_DEBUG("full_get_route_and_latency from %s[%d] to %s[%d]",
src->getName(),
{
XBT_DEBUG("full_get_route_and_latency from %s[%d] to %s[%d]",
src->getName(),
int as_route = 0;
char *src = (char*)(route->src);
char *dst = (char*)(route->dst);
int as_route = 0;
char *src = (char*)(route->src);
char *dst = (char*)(route->dst);
- RoutingEdgePtr src_net_elm, dst_net_elm;
+ RoutingEdge *src_net_elm, *dst_net_elm;
src_net_elm = sg_routing_edge_by_name_or_null(src);
dst_net_elm = sg_routing_edge_by_name_or_null(dst);
src_net_elm = sg_routing_edge_by_name_or_null(src);
dst_net_elm = sg_routing_edge_by_name_or_null(dst);
* Classes *
***********/
class AsFull;
* Classes *
***********/
class AsFull;
-typedef AsFull *AsFullPtr;
class AsFull: public AsGeneric {
public:
class AsFull: public AsGeneric {
public:
- void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+ void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
xbt_dynar_t getOneLinkRoutes();
void parseRoute(sg_platf_route_cbarg_t route);
void parseASroute(sg_platf_route_cbarg_t route);
//void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
xbt_dynar_t getOneLinkRoutes();
void parseRoute(sg_platf_route_cbarg_t route);
void parseASroute(sg_platf_route_cbarg_t route);
//void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
- //sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+ //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
- //virtual int parsePU(RoutingEdgePtr elm)=0; /* A host or a router, whatever */
- //virtual int parseAS( RoutingEdgePtr elm)=0;
+ //virtual int parsePU(RoutingEdge *elm)=0; /* A host or a router, whatever */
+ //virtual int parseAS( RoutingEdge *elm)=0;
//virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
};
//virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
};
-void AsGeneric::getRouteAndLatency(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, sg_platf_route_cbarg_t /*into*/, double */*latency*/){
+void AsGeneric::getRouteAndLatency(RoutingEdge */*src*/, RoutingEdge */*dst*/, sg_platf_route_cbarg_t /*into*/, double */*latency*/){
xbt_dict_free(&p_bypassRoutes);
}
xbt_dict_free(&p_bypassRoutes);
}
-int AsGeneric::parsePU(RoutingEdgePtr elm)
+int AsGeneric::parsePU(RoutingEdge *elm)
{
XBT_DEBUG("Load process unit \"%s\"", elm->getName());
{
XBT_DEBUG("Load process unit \"%s\"", elm->getName());
- xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+ xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
return xbt_dynar_length(p_indexNetworkElm)-1;
}
return xbt_dynar_length(p_indexNetworkElm)-1;
}
-int AsGeneric::parseAS(RoutingEdgePtr elm)
+int AsGeneric::parseAS(RoutingEdge *elm)
{
XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName());
{
XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName());
- xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+ xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
return xbt_dynar_length(p_indexNetworkElm)-1;
}
return xbt_dynar_length(p_indexNetworkElm)-1;
}
for (src = 0; src < table_size; src++) {
for (src = 0; src < table_size; src++) {
- RoutingEdgePtr my_src =
- xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdgePtr);
+ RoutingEdge *my_src =
+ xbt_dynar_get_as(p_indexNetworkElm, src, RoutingEdge*);
for (dst = 0; dst < table_size; dst++) {
if (src == dst)
continue;
for (dst = 0; dst < table_size; dst++) {
if (src == dst)
continue;
- RoutingEdgePtr my_dst =
- xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdgePtr);
+ RoutingEdge *my_dst =
+ xbt_dynar_get_as(p_indexNetworkElm, dst, RoutingEdge*);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
sg_platf_route_cbarg_t route = xbt_new0(s_sg_platf_route_cbarg_t, 1);
route->link_list = xbt_dynar_new(sizeof(sg_routing_link_t), NULL);
}
xbt_dynar_foreach(route->link_list, cpt, link) {
}
xbt_dynar_foreach(route->link_list, cpt, link) {
- const char *link_name = ((ResourcePtr) link)->getName();
+ const char *link_name = static_cast<Resource*>(link)->getName();
current = new_xbt_graph_node(graph, link_name, nodes);
current_name = link_name;
new_xbt_graph_edge(graph, previous, current, edges);
current = new_xbt_graph_node(graph, link_name, nodes);
current_name = link_name;
new_xbt_graph_edge(graph, previous, current, edges);
-sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdgePtr src,
- RoutingEdgePtr dst,
+sg_platf_route_cbarg_t AsGeneric::getBypassRoute(RoutingEdge *src,
+ RoutingEdge *dst,
double *lat)
{
// If never set a bypass route return NULL without any further computations
double *lat)
{
// If never set a bypass route return NULL without any further computations
free(route_name);
}
else{
free(route_name);
}
else{
int index_src, index_dst;
xbt_dynar_t path_src = NULL;
xbt_dynar_t path_dst = NULL;
int index_src, index_dst;
xbt_dynar_t path_src = NULL;
xbt_dynar_t path_dst = NULL;
- AsPtr current = NULL;
- AsPtr *current_src = NULL;
- AsPtr *current_dst = NULL;
+ As *current = NULL;
+ As **current_src = NULL;
+ As **current_dst = NULL;
if (src == NULL || dst == NULL)
xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
if (src == NULL || dst == NULL)
xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
dst_as = dst->getRcComponent();
/* (2) find the path to the root routing component */
dst_as = dst->getRcComponent();
/* (2) find the path to the root routing component */
- path_src = xbt_dynar_new(sizeof(AsPtr), NULL);
+ path_src = xbt_dynar_new(sizeof(As*), NULL);
current = src_as;
while (current != NULL) {
xbt_dynar_push(path_src, ¤t);
current = current->p_routingFather;
}
current = src_as;
while (current != NULL) {
xbt_dynar_push(path_src, ¤t);
current = current->p_routingFather;
}
- path_dst = xbt_dynar_new(sizeof(AsPtr), NULL);
+ path_dst = xbt_dynar_new(sizeof(As*), NULL);
current = dst_as;
while (current != NULL) {
xbt_dynar_push(path_dst, ¤t);
current = dst_as;
while (current != NULL) {
xbt_dynar_push(path_dst, ¤t);
/* (3) find the common father */
index_src = path_src->used - 1;
index_dst = path_dst->used - 1;
/* (3) find the common father */
index_src = path_src->used - 1;
index_dst = path_dst->used - 1;
- current_src = (AsPtr *) xbt_dynar_get_ptr(path_src, index_src);
- current_dst = (AsPtr *) xbt_dynar_get_ptr(path_dst, index_dst);
+ current_src = (As **) xbt_dynar_get_ptr(path_src, index_src);
+ current_dst = (As **) xbt_dynar_get_ptr(path_dst, index_dst);
while (index_src >= 0 && index_dst >= 0 && *current_src == *current_dst) {
xbt_dynar_pop_ptr(path_src);
xbt_dynar_pop_ptr(path_dst);
index_src--;
index_dst--;
while (index_src >= 0 && index_dst >= 0 && *current_src == *current_dst) {
xbt_dynar_pop_ptr(path_src);
xbt_dynar_pop_ptr(path_dst);
index_src--;
index_dst--;
- current_src = (AsPtr *) xbt_dynar_get_ptr(path_src, index_src);
- current_dst = (AsPtr *) xbt_dynar_get_ptr(path_dst, index_dst);
+ current_src = (As **) xbt_dynar_get_ptr(path_src, index_src);
+ current_dst = (As **) xbt_dynar_get_ptr(path_dst, index_dst);
}
int max_index_src = path_src->used - 1;
}
int max_index_src = path_src->used - 1;
for (i = 0; i < max; i++) {
if (i <= max_index_src && max <= max_index_dst) {
char *route_name = bprintf("%s#%s",
for (i = 0; i < max; i++) {
if (i <= max_index_src && max <= max_index_dst) {
char *route_name = bprintf("%s#%s",
(xbt_dynar_get_ptr(path_src, i)))->p_name,
(xbt_dynar_get_ptr(path_src, i)))->p_name,
(xbt_dynar_get_ptr(path_dst, max)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
(xbt_dynar_get_ptr(path_dst, max)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
break;
if (max <= max_index_src && i <= max_index_dst) {
char *route_name = bprintf("%s#%s",
break;
if (max <= max_index_src && i <= max_index_dst) {
char *route_name = bprintf("%s#%s",
(xbt_dynar_get_ptr(path_src, max)))->p_name,
(xbt_dynar_get_ptr(path_src, max)))->p_name,
(xbt_dynar_get_ptr(path_dst, i)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
(xbt_dynar_get_ptr(path_dst, i)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
if (max <= max_index_src && max <= max_index_dst) {
char *route_name = bprintf("%s#%s",
if (max <= max_index_src && max <= max_index_dst) {
char *route_name = bprintf("%s#%s",
(xbt_dynar_get_ptr(path_src, max)))->p_name,
(xbt_dynar_get_ptr(path_src, max)))->p_name,
(xbt_dynar_get_ptr(path_dst, max)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
(xbt_dynar_get_ptr(path_dst, max)))->p_name);
e_route_bypass = (sg_platf_route_cbarg_t) xbt_dict_get_or_null(dict_bypassRoutes, route_name);
xbt_free(route_name);
-AsPtr AsGeneric::asExist(AsPtr to_find)
+As *AsGeneric::asExist(As *to_find)
{
//return to_find; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
xbt_dict_cursor_t cursor = NULL;
char *key;
int found = 0;
{
//return to_find; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
xbt_dict_cursor_t cursor = NULL;
char *key;
int found = 0;
xbt_dict_foreach(p_routingSons, cursor, key, elem) {
if (to_find == elem || elem->asExist(to_find)) {
found = 1;
xbt_dict_foreach(p_routingSons, cursor, key, elem) {
if (to_find == elem || elem->asExist(to_find)) {
found = 1;
-AsPtr AsGeneric::autonomousSystemExist(char *element)
+As *AsGeneric::autonomousSystemExist(char *element)
{
//return rc; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
{
//return rc; // FIXME: BYPASSERROR OF FOREACH WITH BREAK
- AsPtr element_as, result, elem;
+ As *element_as, *result, *elem;
xbt_dict_cursor_t cursor = NULL;
char *key;
xbt_dict_cursor_t cursor = NULL;
char *key;
- element_as = ((RoutingEdgePtr)
+ element_as = ((RoutingEdge*)
xbt_lib_get_or_null(as_router_lib, element,
ROUTING_ASR_LEVEL))->getRcComponent();
xbt_lib_get_or_null(as_router_lib, element,
ROUTING_ASR_LEVEL))->getRcComponent();
- result = ((AsPtr) - 1);
if (element_as != this)
result = asExist(element_as);
if (element_as != this)
result = asExist(element_as);
-AsPtr AsGeneric::processingUnitsExist(char *element)
+As *AsGeneric::processingUnitsExist(char *element)
- AsPtr element_as = sg_host_edge(sg_host_by_name(element)) ->getRcComponent();
+ As *element_as = sg_host_edge(sg_host_by_name(element)) ->getRcComponent();
if (element_as == this)
return element_as;
return asExist(element_as);
}
if (element_as == this)
return element_as;
return asExist(element_as);
}
-void AsGeneric::srcDstCheck(RoutingEdgePtr src, RoutingEdgePtr dst)
+void AsGeneric::srcDstCheck(RoutingEdge *src, RoutingEdge *dst)
{
if (src == NULL || dst == NULL)
xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
{
if (src == NULL || dst == NULL)
xbt_die("Ask for route \"from\"(%s) or \"to\"(%s) no found at AS \"%s\"",
dst ? dst->getName() : "(null)",
p_name);
dst ? dst->getName() : "(null)",
p_name);
- AsPtr src_as = src->getRcComponent();
- AsPtr dst_as = dst->getRcComponent();
+ As *src_as = src->getRcComponent();
+ As *dst_as = dst->getRcComponent();
if (src_as != dst_as)
xbt_die("The src(%s in %s) and dst(%s in %s) are in differents AS",
if (src_as != dst_as)
xbt_die("The src(%s in %s) and dst(%s in %s) are in differents AS",
#define SURF_ROUTING_GENERIC_HPP_
class AsGeneric;
#define SURF_ROUTING_GENERIC_HPP_
class AsGeneric;
-typedef AsGeneric *AsGenericPtr;
void generic_free_route(sg_platf_route_cbarg_t route);
void generic_free_route(sg_platf_route_cbarg_t route);
AsGeneric();
~AsGeneric();
AsGeneric();
~AsGeneric();
- virtual void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+ virtual void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
virtual xbt_dynar_t getOneLinkRoutes();
virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
virtual xbt_dynar_t getOneLinkRoutes();
virtual void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
- virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+ virtual sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
- virtual int parsePU(RoutingEdgePtr elm); /* A host or a router, whatever */
- virtual int parseAS( RoutingEdgePtr elm);
+ virtual int parsePU(RoutingEdge *elm); /* A host or a router, whatever */
+ virtual int parseAS(RoutingEdge *elm);
virtual void parseRoute(sg_platf_route_cbarg_t route);
virtual void parseASroute(sg_platf_route_cbarg_t route);
virtual void parseBypassroute(sg_platf_route_cbarg_t e_route);
virtual sg_platf_route_cbarg_t newExtendedRoute(e_surf_routing_hierarchy_t hierarchy, sg_platf_route_cbarg_t routearg, int change_order);
virtual void parseRoute(sg_platf_route_cbarg_t route);
virtual void parseASroute(sg_platf_route_cbarg_t route);
virtual void parseBypassroute(sg_platf_route_cbarg_t e_route);
virtual sg_platf_route_cbarg_t newExtendedRoute(e_surf_routing_hierarchy_t hierarchy, sg_platf_route_cbarg_t routearg, int change_order);
- virtual AsPtr asExist(AsPtr to_find);
- virtual AsPtr autonomousSystemExist(char *element);
- virtual AsPtr processingUnitsExist(char *element);
- virtual void srcDstCheck(RoutingEdgePtr src, RoutingEdgePtr dst);
+ virtual As *asExist(As *to_find);
+ virtual As *autonomousSystemExist(char *element);
+ virtual As *processingUnitsExist(char *element);
+ virtual void srcDstCheck(RoutingEdge *src, RoutingEdge *dst);
};
#endif /* SURF_ROUTING_GENERIC_HPP_ */
};
#endif /* SURF_ROUTING_GENERIC_HPP_ */
-void AsNone::getRouteAndLatency(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/,
+void AsNone::getRouteAndLatency(RoutingEdge */*src*/, RoutingEdge */*dst*/,
sg_platf_route_cbarg_t /*res*/, double *lat)
{
*lat = 0.0;
sg_platf_route_cbarg_t /*res*/, double *lat)
{
*lat = 0.0;
XBT_INFO("No routing no graph");
}
XBT_INFO("No routing no graph");
}
-sg_platf_route_cbarg_t AsNone::getBypassRoute(RoutingEdgePtr /*src*/, RoutingEdgePtr /*dst*/, double */*lat*/) {
+sg_platf_route_cbarg_t AsNone::getBypassRoute(RoutingEdge */*src*/, RoutingEdge */*dst*/, double */*lat*/) {
-int AsNone::parsePU(RoutingEdgePtr elm) {
+int AsNone::parsePU(RoutingEdge *elm) {
XBT_DEBUG("Load process unit \"%s\"", elm->getName());
XBT_DEBUG("Load process unit \"%s\"", elm->getName());
- xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+ xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
/* don't care about PUs */
return -1;
}
/* don't care about PUs */
return -1;
}
-int AsNone::parseAS(RoutingEdgePtr elm) {
+int AsNone::parseAS(RoutingEdge *elm) {
XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName());
XBT_DEBUG("Load Autonomous system \"%s\"", elm->getName());
- xbt_dynar_push_as(p_indexNetworkElm, RoutingEdgePtr, elm);
+ xbt_dynar_push_as(p_indexNetworkElm, RoutingEdge*, elm);
/* even don't care about sub-ASes -- I'm as nihilist as an old punk*/
return -1;
}
/* even don't care about sub-ASes -- I'm as nihilist as an old punk*/
return -1;
}
- void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+ void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
xbt_dynar_t getOneLinkRoutes();
void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
xbt_dynar_t getOneLinkRoutes();
void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
- sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+ sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
- int parsePU(RoutingEdgePtr elm); /* A host or a router, whatever */
- int parseAS( RoutingEdgePtr elm);
+ int parsePU(RoutingEdge *elm); /* A host or a router, whatever */
+ int parseAS( RoutingEdge *elm);
void parseRoute(sg_platf_route_cbarg_t route);
void parseASroute(sg_platf_route_cbarg_t route);
void parseBypassroute(sg_platf_route_cbarg_t e_route);
void parseRoute(sg_platf_route_cbarg_t route);
void parseASroute(sg_platf_route_cbarg_t route);
void parseBypassroute(sg_platf_route_cbarg_t e_route);
/* ************************************************** */
/* ************** Cluster ROUTING **************** */
/* ************************************************** */
/* ************** Cluster ROUTING **************** */
-AsPtr model_cluster_create(void); /* create structures for cluster routing model */
-AsPtr model_torus_cluster_create(void);
-AsPtr model_fat_tree_cluster_create(void);
+As *model_cluster_create(void); /* create structures for cluster routing model */
+As *model_torus_cluster_create(void);
+As *model_fat_tree_cluster_create(void);
/* ************************************************** */
/* ************** Vivaldi ROUTING **************** */
/* ************************************************** */
/* ************** Vivaldi ROUTING **************** */
return new AsVivaldi();
}
return new AsVivaldi();
}
-void AsVivaldi::getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t route, double *lat)
+void AsVivaldi::getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t route, double *lat)
{
s_surf_parsing_link_up_down_t info;
{
s_surf_parsing_link_up_down_t info;
-int AsVivaldi::parsePU(RoutingEdgePtr elm) {
+int AsVivaldi::parsePU(RoutingEdge *elm) {
XBT_DEBUG("Load process unit \"%s\"", elm->getName());
xbt_dynar_push_as(p_indexNetworkElm, sg_routing_edge_t, elm);
return xbt_dynar_length(p_indexNetworkElm)-1;
XBT_DEBUG("Load process unit \"%s\"", elm->getName());
xbt_dynar_push_as(p_indexNetworkElm, sg_routing_edge_t, elm);
return xbt_dynar_length(p_indexNetworkElm)-1;
* Classes *
***********/
class AsVivaldi;
* Classes *
***********/
class AsVivaldi;
-typedef AsVivaldi *AsVivaldiPtr;
class AsVivaldi: public AsGeneric {
public:
class AsVivaldi: public AsGeneric {
public:
AsVivaldi() : AsGeneric() {};
~AsVivaldi() {};
AsVivaldi() : AsGeneric() {};
~AsVivaldi() {};
- void getRouteAndLatency(RoutingEdgePtr src, RoutingEdgePtr dst, sg_platf_route_cbarg_t into, double *latency);
+ void getRouteAndLatency(RoutingEdge *src, RoutingEdge *dst, sg_platf_route_cbarg_t into, double *latency);
//void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
//void getGraph(xbt_graph_t graph, xbt_dict_t nodes, xbt_dict_t edges);
- //sg_platf_route_cbarg_t getBypassRoute(RoutingEdgePtr src, RoutingEdgePtr dst, double *lat);
+ //sg_platf_route_cbarg_t getBypassRoute(RoutingEdge *src, RoutingEdge *dst, double *lat);
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
/* The parser calls the following functions to inform the routing models
* that a new element is added to the AS currently built.
*
* Of course, only the routing model of this AS is informed, not every ones */
- int parsePU(RoutingEdgePtr elm); /* A host or a router, whatever */
- //virtual int parseAS( RoutingEdgePtr elm)=0;
+ int parsePU(RoutingEdge *elm); /* A host or a router, whatever */
+ //virtual int parseAS( RoutingEdge *elm)=0;
//virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
};
//virtual void parseBypassroute(sg_platf_route_cbarg_t e_route)=0;
};
void surf_vm_model_init_HL13(void){
if (surf_cpu_model_vm) {
surf_vm_model = new VMHL13Model();
void surf_vm_model_init_HL13(void){
if (surf_cpu_model_vm) {
surf_vm_model = new VMHL13Model();
- ModelPtr model = surf_vm_model;
+ Model *model = surf_vm_model;
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
xbt_dynar_push(model_list, &model);
xbt_dynar_push(model_list_invoke, &model);
-ActionPtr VMHL13Model::communicate(HostPtr src, HostPtr dst, double size, double rate){
+Action *VMHL13Model::communicate(Host *src, Host *dst, double size, double rate){
return surf_network_model->communicate(src->p_netElm, dst->p_netElm, size, rate);
}
/* ind means ''indirect'' that this is a reference on the whole dict_elm
* structure (i.e not on the surf_resource_private infos) */
return surf_network_model->communicate(src->p_netElm, dst->p_netElm, size, rate);
}
/* ind means ''indirect'' that this is a reference on the whole dict_elm
* structure (i.e not on the surf_resource_private infos) */
-VMPtr VMHL13Model::createVM(const char *name, surf_resource_t host_PM)
+VM *VMHL13Model::createVM(const char *name, surf_resource_t host_PM)
- VMHL13Ptr ws = new VMHL13(this, name, NULL, host_PM);
+ VMHL13 *ws = new VMHL13(this, name, NULL, host_PM);
xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, ws);
xbt_lib_set(host_lib, name, SURF_HOST_LEVEL, ws);
-static inline double get_solved_value(CpuActionPtr cpu_action)
+static inline double get_solved_value(CpuAction *cpu_action)
{
return cpu_action->getVariable()->value;
}
{
return cpu_action->getVariable()->value;
}
/* 0. Make sure that we already calculated the resource share at the physical
* machine layer. */
{
/* 0. Make sure that we already calculated the resource share at the physical
* machine layer. */
{
- _XBT_GNUC_UNUSED ModelPtr ws_model = surf_host_model;
- _XBT_GNUC_UNUSED ModelPtr vm_ws_model = surf_vm_model;
+ _XBT_GNUC_UNUSED Model *ws_model = surf_host_model;
+ _XBT_GNUC_UNUSED Model *vm_ws_model = surf_vm_model;
_XBT_GNUC_UNUSED unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, &ws_model);
_XBT_GNUC_UNUSED 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_host_model comes before");
_XBT_GNUC_UNUSED unsigned int index_of_pm_ws_model = xbt_dynar_search(model_list_invoke, &ws_model);
_XBT_GNUC_UNUSED 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_host_model comes before");
VMModel::ws_vms.begin();
iter != VMModel::ws_vms.end(); ++iter) {
VMModel::ws_vms.begin();
iter != VMModel::ws_vms.end(); ++iter) {
- VMPtr ws_vm = &*iter;
- CpuPtr cpu = ws_vm->p_cpu;
+ VM *ws_vm = &*iter;
+ Cpu *cpu = ws_vm->p_cpu;
xbt_assert(cpu, "cpu-less host");
double solved_value = get_solved_value(ws_vm->p_action);
xbt_assert(cpu, "cpu-less host");
double solved_value = get_solved_value(ws_vm->p_action);
- VM2013Ptr ws_vm2013 = static_cast<VM2013Ptr>(&*iter);
+ VM2013 *ws_vm2013 = static_cast<VM2013Ptr>(&*iter);
XBT_INFO("cost %f remains %f start %f finish %f", ws_vm2013->cpu_action->cost,
ws_vm2013->cpu_action->remains,
ws_vm2013->cpu_action->start,
XBT_INFO("cost %f remains %f start %f finish %f", ws_vm2013->cpu_action->cost,
ws_vm2013->cpu_action->remains,
ws_vm2013->cpu_action->start,
-ActionPtr VMHL13Model::executeParallelTask(int host_nb,
+Action *VMHL13Model::executeParallelTask(int host_nb,
void **host_list,
double *flops_amount,
double *bytes_amount,
void **host_list,
double *flops_amount,
double *bytes_amount,
#define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
if ((host_nb == 1)
&& (cost_or_zero(bytes_amount, 0) == 0.0))
#define cost_or_zero(array,pos) ((array)?(array)[pos]:0.0)
if ((host_nb == 1)
&& (cost_or_zero(bytes_amount, 0) == 0.0))
- return ((HostCLM03Ptr)host_list[0])->execute(flops_amount[0]);
+ return static_cast<HostCLM03*>(host_list[0])->execute(flops_amount[0]);
else if ((host_nb == 1)
&& (cost_or_zero(flops_amount, 0) == 0.0))
else if ((host_nb == 1)
&& (cost_or_zero(flops_amount, 0) == 0.0))
- return communicate((HostCLM03Ptr)host_list[0], (HostCLM03Ptr)host_list[0],bytes_amount[0], rate);
+ return communicate(static_cast<HostCLM03*>(host_list[0]), static_cast<HostCLM03*>(host_list[0]),bytes_amount[0], rate);
else if ((host_nb == 2)
&& (cost_or_zero(flops_amount, 0) == 0.0)
&& (cost_or_zero(flops_amount, 1) == 0.0)) {
else if ((host_nb == 2)
&& (cost_or_zero(flops_amount, 0) == 0.0)
&& (cost_or_zero(flops_amount, 1) == 0.0)) {
- return communicate((HostCLM03Ptr)host_list[0], (HostCLM03Ptr)host_list[1],value, rate);
+ return communicate(static_cast<HostCLM03*>(host_list[0]), static_cast<HostCLM03*>(host_list[1]),value, rate);
* Resource *
************/
* Resource *
************/
-VMHL13::VMHL13(VMModelPtr model, const char* name, xbt_dict_t props,
+VMHL13::VMHL13(VMModel *model, const char* name, xbt_dict_t props,
surf_resource_t host_PM)
: VM(model, name, props, NULL, NULL)
{
surf_resource_t host_PM)
: VM(model, name, props, NULL, NULL)
{
- HostPtr sub_ws = static_cast<HostPtr>(surf_host_resource_priv(host_PM));
+ Host *sub_ws = static_cast<Host*>(surf_host_resource_priv(host_PM));
/* Currently, we assume a VM has no storage. */
p_storage = NULL;
/* Currently, we assume a VM has no storage. */
p_storage = NULL;
// //// CPU RELATED STUFF ////
// Roughly, create a vcpu resource by using the values of the sub_cpu one.
// //// CPU RELATED STUFF ////
// Roughly, create a vcpu resource by using the values of the sub_cpu one.
- CpuCas01Ptr sub_cpu = static_cast<CpuCas01Ptr>(sg_host_surfcpu(host_PM));
+ CpuCas01 *sub_cpu = static_cast<CpuCas01*>(sg_host_surfcpu(host_PM));
p_cpu = surf_cpu_model_vm->createCpu(name, // name
sub_cpu->getPowerPeakList(), // host->power_peak,
p_cpu = surf_cpu_model_vm->createCpu(name, // name
sub_cpu->getPowerPeakList(), // host->power_peak,
void VMHL13::migrate(surf_resource_t ind_dst_pm)
{
/* ind_dst_pm equals to smx_host_t */
void VMHL13::migrate(surf_resource_t ind_dst_pm)
{
/* ind_dst_pm equals to smx_host_t */
- HostPtr ws_dst = static_cast<HostPtr>(surf_host_resource_priv(ind_dst_pm));
+ Host *ws_dst = static_cast<Host*>(surf_host_resource_priv(ind_dst_pm));
const char *vm_name = getName();
const char *pm_name_src = p_subWs->getName();
const char *pm_name_dst = ws_dst->getName();
const char *vm_name = getName();
const char *pm_name_src = p_subWs->getName();
const char *pm_name_dst = ws_dst->getName();
xbt_assert(ws_dst);
/* update net_elm with that of the destination physical host */
xbt_assert(ws_dst);
/* update net_elm with that of the destination physical host */
- RoutingEdgePtr old_net_elm = p_netElm;
- RoutingEdgePtr new_net_elm = new RoutingEdgeWrapper(sg_host_edge(sg_host_by_name(pm_name_dst)));
+ RoutingEdge *old_net_elm = p_netElm;
+ RoutingEdge *new_net_elm = new RoutingEdgeWrapper(sg_host_edge(sg_host_by_name(pm_name_dst)));
xbt_assert(new_net_elm);
/* Unregister the current net_elm from host_lib. Do not call the free callback. */
xbt_assert(new_net_elm);
/* Unregister the current net_elm from host_lib. Do not call the free callback. */
#endif
/* create a cpu action bound to the pm model at the destination. */
#endif
/* create a cpu action bound to the pm model at the destination. */
- CpuActionPtr new_cpu_action = static_cast<CpuActionPtr>(
- static_cast<CpuPtr>(sg_host_surfcpu(ind_dst_pm))->execute(0));
+ CpuAction *new_cpu_action = static_cast<CpuAction*>(
+ static_cast<Cpu*>(sg_host_surfcpu(ind_dst_pm))->execute(0));
e_surf_action_state_t state = p_action->getState();
if (state != SURF_ACTION_DONE)
e_surf_action_state_t state = p_action->getState();
if (state != SURF_ACTION_DONE)
p_action->setBound(bound);
}
p_action->setBound(bound);
}
-void VMHL13::setAffinity(CpuPtr cpu, unsigned long mask){
+void VMHL13::setAffinity(Cpu *cpu, unsigned long mask){
p_action->setAffinity(cpu, mask);
}
p_action->setAffinity(cpu, mask);
}
}
/* Adding a task to a VM updates the VCPU task on its physical machine. */
}
/* Adding a task to a VM updates the VCPU task on its physical machine. */
-ActionPtr VMHL13::execute(double size)
+Action *VMHL13::execute(double size)
{
double old_cost = p_action->getCost();
double new_cost = old_cost + size;
{
double old_cost = p_action->getCost();
double new_cost = old_cost + size;
return p_cpu->execute(size);
}
return p_cpu->execute(size);
}
-ActionPtr VMHL13::sleep(double duration) {
+Action *VMHL13::sleep(double duration) {
return p_cpu->sleep(duration);
}
return p_cpu->sleep(duration);
}
***********/
class VMHL13Model;
***********/
class VMHL13Model;
-typedef VMHL13Model *VMHL13ModelPtr;
-
-typedef VMHL13 *VMHL13Ptr;
VMHL13Model();
~VMHL13Model(){};
VMHL13Model();
~VMHL13Model(){};
- VMPtr createVM(const char *name, surf_resource_t host_PM);
+ VM *createVM(const char *name, surf_resource_t host_PM);
double shareResources(double now);
void adjustWeightOfDummyCpuActions() {};
double shareResources(double now);
void adjustWeightOfDummyCpuActions() {};
- ActionPtr communicate(HostPtr src, HostPtr dst, double size, double rate);
- ActionPtr executeParallelTask(int host_nb,
+ Action *communicate(Host *src, Host *dst, double size, double rate);
+ Action *executeParallelTask(int host_nb,
void **host_list,
double *flops_amount,
double *bytes_amount,
void **host_list,
double *flops_amount,
double *bytes_amount,
class VMHL13 : public VM {
public:
class VMHL13 : public VM {
public:
- VMHL13(VMModelPtr model, const char* name, xbt_dict_t props, surf_resource_t host_PM);
+ VMHL13(VMModel *model, const char* name, xbt_dict_t props, surf_resource_t host_PM);
~VMHL13();
void suspend();
~VMHL13();
void suspend();
surf_resource_t getPm(); // will be vm_ws_get_pm()
void setBound(double bound);
surf_resource_t getPm(); // will be vm_ws_get_pm()
void setBound(double bound);
- void setAffinity(CpuPtr cpu, unsigned long mask);
+ void setAffinity(Cpu *cpu, unsigned long mask);
//FIXME: remove
void updateState(tmgr_trace_event_t event_type, double value, double date);
bool isUsed();
//FIXME: remove
void updateState(tmgr_trace_event_t event_type, double value, double date);
bool isUsed();
- ActionPtr execute(double size);
- ActionPtr sleep(double duration);
+ Action *execute(double size);
+ Action *sleep(double duration);
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm, surf,
"Logging specific to the SURF VM module");
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_vm, surf,
"Logging specific to the SURF VM module");
-VMModelPtr surf_vm_model = NULL;
+VMModel *surf_vm_model = NULL;
/*************
* Callbacks *
*************/
/*************
* Callbacks *
*************/
-surf_callback(void, VMPtr) VMCreatedCallbacks;
-surf_callback(void, VMPtr) VMDestructedCallbacks;
-surf_callback(void, VMPtr) VMStateChangedCallbacks;
+surf_callback(void, VM*) VMCreatedCallbacks;
+surf_callback(void, VM*) VMDestructedCallbacks;
+surf_callback(void, VM*) VMStateChangedCallbacks;
* Resource *
************/
* Resource *
************/
-VM::VM(ModelPtr model, const char *name, xbt_dict_t props,
- RoutingEdgePtr netElm, CpuPtr cpu)
+VM::VM(Model *model, const char *name, xbt_dict_t props,
+ RoutingEdge *netElm, Cpu *cpu)
: Host(model, name, props, NULL, netElm, cpu)
{
VMModel::ws_vms.push_back(*this);
: Host(model, name, props, NULL, netElm, cpu)
{
VMModel::ws_vms.push_back(*this);
***********/
class VMModel;
***********/
class VMModel;
-typedef VMModel *VMModelPtr;
-
-typedef VM *VMPtr;
-
-class VMLmm;
-typedef VMLmm *VMLmmPtr;
/*************
* Callbacks *
/*************
* Callbacks *
* @brief Callbacks handler which emit the callbacks after VM creation *
* @details Callback functions have the following signature: `void(VMPtr)`
*/
* @brief Callbacks handler which emit the callbacks after VM creation *
* @details Callback functions have the following signature: `void(VMPtr)`
*/
-extern surf_callback(void, VMPtr) VMCreatedCallbacks;
+extern surf_callback(void, VM*) VMCreatedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after VM destruction *
* @details Callback functions have the following signature: `void(VMPtr)`
*/
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after VM destruction *
* @details Callback functions have the following signature: `void(VMPtr)`
*/
-extern surf_callback(void, VMPtr) VMDestructedCallbacks;
+extern surf_callback(void, VM*) VMDestructedCallbacks;
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after VM State changed *
* @details Callback functions have the following signature: `void(VMActionPtr)`
*/
/** @ingroup SURF_callbacks
* @brief Callbacks handler which emit the callbacks after VM State changed *
* @details Callback functions have the following signature: `void(VMActionPtr)`
*/
-extern surf_callback(void, VMPtr) VMStateChangedCallbacks;
+extern surf_callback(void, VM*) VMStateChangedCallbacks;
- HostPtr createHost(const char *name){DIE_IMPOSSIBLE;}
+ Host *createHost(const char *name){DIE_IMPOSSIBLE;}
/**
* @brief Create a new VM
/**
* @brief Create a new VM
* @param host_PM The real machine hosting the VM
*
*/
* @param host_PM The real machine hosting the VM
*
*/
- virtual VMPtr createVM(const char *name, surf_resource_t host_PM)=0;
+ virtual VM *createVM(const char *name, surf_resource_t host_PM)=0;
void adjustWeightOfDummyCpuActions() {};
typedef boost::intrusive::list<VM,
void adjustWeightOfDummyCpuActions() {};
typedef boost::intrusive::list<VM,
* @param netElm The RoutingEdge associated to this VM
* @param cpu The Cpu associated to this VM
*/
* @param netElm The RoutingEdge associated to this VM
* @param cpu The Cpu associated to this VM
*/
- VM(ModelPtr model, const char *name, xbt_dict_t props,
- RoutingEdgePtr netElm, CpuPtr cpu);
+ VM(Model *model, const char *name, xbt_dict_t props,
+ RoutingEdge *netElm, Cpu *cpu);
/**
* @brief WdorkstationVM destructor
/**
* @brief WdorkstationVM destructor
virtual surf_resource_t getPm()=0;
virtual void setBound(double bound)=0;
virtual surf_resource_t getPm()=0;
virtual void setBound(double bound)=0;
- virtual void setAffinity(CpuPtr cpu, unsigned long mask)=0;
+ virtual void setAffinity(Cpu *cpu, unsigned long mask)=0;
/* The vm object of the lower layer */
/* The vm object of the lower layer */
- CpuActionPtr p_action;
- HostPtr p_subWs; // Pointer to the ''host'' OS
+ CpuAction *p_action;
+ Host *p_subWs; // Pointer to the ''host'' OS
e_surf_vm_state_t p_currentState;
};
e_surf_vm_state_t p_currentState;
};