From: Martin Quinson Date: Sun, 21 Feb 2016 09:46:12 +0000 (+0100) Subject: cosmetics: kill useless functions of the C surf API and the such X-Git-Tag: v3_13~759 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b3b553ed36fe1119ceee50c0c6c5ac1cc6d47fd3 cosmetics: kill useless functions of the C surf API and the such --- diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index d0c563fcbf..c3c8fa6f62 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -251,9 +251,6 @@ XBT_PUBLIC(surf_action_t) surf_network_model_communicate(surf_network_model_t mo * @return The name of the surf resource */ XBT_PUBLIC(const char * ) surf_resource_name(surf_cpp_resource_t resource); -static inline const char * surf_cpu_name(surf_cpu_t cpu) { - return surf_resource_name((surf_cpp_resource_t)cpu); -} /** @brief Get the available speed of cpu associated to a host */ XBT_PUBLIC(double) surf_host_get_available_speed(sg_host_t host); @@ -306,19 +303,6 @@ XBT_PUBLIC(sg_size_t) surf_host_get_free_size(sg_host_t resource, const char* na */ XBT_PUBLIC(sg_size_t) surf_host_get_used_size(sg_host_t resource, const char* name); -/** @brief Get the list of VMs hosted on the host */ -XBT_PUBLIC(xbt_dynar_t) surf_host_get_vms(sg_host_t resource); - -/** @brief Retrieve the params of that VM - * @details You can use fields ramsize and overcommit on a PM, too. - */ -XBT_PUBLIC(void) surf_host_get_params(sg_host_t resource, vm_params_t params); - -/** @brief Sets the params of that VM/PM - * @details You can use fields ramsize and overcommit on a PM, too. - */ -XBT_PUBLIC(void) surf_host_set_params(sg_host_t resource, vm_params_t params); - /** * @brief Destroy a VM * @@ -381,14 +365,6 @@ XBT_PUBLIC(void) surf_vm_set_bound(sg_host_t resource, double bound); */ XBT_PUBLIC(void) surf_vm_set_affinity(sg_host_t resource, sg_host_t cpu, unsigned long mask); -/** - * @brief Get the list of storages attached to an host - * - * @param host The surf host - * @return Dictionary of storage - */ -XBT_PUBLIC(xbt_dynar_t) surf_host_get_attached_storage_list(sg_host_t host); - /** * @brief Unlink a file descriptor * @@ -482,82 +458,6 @@ XBT_PUBLIC(sg_size_t) surf_storage_get_used_size(surf_resource_t resource); /** @brief return the properties set associated to that storage */ XBT_PUBLIC(xbt_dict_t) surf_storage_get_properties(surf_resource_t resource); -/** - * @brief Get the data associated to the action - * - * @param action The surf action - * @return The data associated to the action - */ -XBT_PUBLIC(void*) surf_action_get_data(surf_action_t action); - -/** - * @brief Set the data associated to the action - * @details [long description] - * - * @param action The surf action - * @param data The new data associated to the action - */ -XBT_PUBLIC(void) surf_action_set_data(surf_action_t action, void *data); - -/** - * @brief Get the start time of an action - * - * @param action The surf action - * @return The start time in seconds from the beginning of the simulation - */ -XBT_PUBLIC(double) surf_action_get_start_time(surf_action_t action); - -/** - * @brief Get the finish time of an action - * - * @param action The surf action - * @return The finish time in seconds from the beginning of the simulation - */ -XBT_PUBLIC(double) surf_action_get_finish_time(surf_action_t action); - -/** - * @brief Get the remains amount of work to do of an action - * - * @param action The surf action - * @return The remains amount of work to do - */ -XBT_PUBLIC(double) surf_action_get_remains(surf_action_t action); - -/** - * @brief Set the category of an action - * @details [long description] - * - * @param action The surf action - * @param category The new category of the action - */ -XBT_PUBLIC(void) surf_action_set_category(surf_action_t action, const char *category); - -/** - * @brief Get the state of an action - * - * @param action The surf action - * @return The state of the action - */ -XBT_PUBLIC(e_surf_action_state_t) surf_action_get_state(surf_action_t action); - -/** - * @brief Get the cost of an action - * - * @param action The surf action - * @return The cost of the action - */ -XBT_PUBLIC(double) surf_action_get_cost(surf_action_t action); - -/** - * @brief [brief desrciption] - * @details [long description] - * - * @param action The surf cpu action - * @param cpu [description] - * @param mask [description] - */ -XBT_PUBLIC(void) surf_cpu_action_set_affinity(surf_action_t action, sg_host_t cpu, unsigned long mask); - /** * @brief [brief description] * @details [long description] diff --git a/src/simdag/sd_global.cpp b/src/simdag/sd_global.cpp index 426db94799..f8b6d504e9 100644 --- a/src/simdag/sd_global.cpp +++ b/src/simdag/sd_global.cpp @@ -222,7 +222,7 @@ xbt_dynar_t SD_simulate(double how_long) { /* let's see which tasks have just failed */ while ((action = surf_model_extract_failed_action_set(model))) { task = (SD_task_t) action->getData(); - task->start_time = surf_action_get_start_time(task->surf_action); + task->start_time = task->surf_action->getStartTime(); task->finish_time = surf_get_clock(); XBT_VERB("Task '%s' failed", SD_task_get_name(task)); SD_task_set_state(task, SD_FAILED); diff --git a/src/simdag/sd_task.cpp b/src/simdag/sd_task.cpp index c5e72f2ae4..ce725ece20 100644 --- a/src/simdag/sd_task.cpp +++ b/src/simdag/sd_task.cpp @@ -472,7 +472,7 @@ double SD_task_get_alpha(SD_task_t task) double SD_task_get_remaining_amount(SD_task_t task) { if (task->surf_action) - return surf_action_get_remains(task->surf_action); + return task->surf_action->getRemains(); else return task->remains; } diff --git a/src/simix/smx_host.cpp b/src/simix/smx_host.cpp index 592a10156a..9b81242085 100644 --- a/src/simix/smx_host.cpp +++ b/src/simix/smx_host.cpp @@ -370,7 +370,7 @@ double SIMIX_execution_get_remains(smx_synchro_t synchro) double result = 0.0; if (synchro->state == SIMIX_RUNNING) - result = surf_action_get_remains(synchro->execution.surf_exec); + result = synchro->execution.surf_exec->getRemains(); return result; } diff --git a/src/simix/smx_network.cpp b/src/simix/smx_network.cpp index f62fa0a48c..83c71075d2 100644 --- a/src/simix/smx_network.cpp +++ b/src/simix/smx_network.cpp @@ -983,7 +983,7 @@ double SIMIX_comm_get_remains(smx_synchro_t synchro) switch (synchro->state) { case SIMIX_RUNNING: - remains = surf_action_get_remains(synchro->comm.surf_comm); + remains = synchro->comm.surf_comm->getRemains(); break; case SIMIX_WAITING: diff --git a/src/simix/smx_vm.cpp b/src/simix/smx_vm.cpp index 69088f1809..fe322159a9 100644 --- a/src/simix/smx_vm.cpp +++ b/src/simix/smx_vm.cpp @@ -40,7 +40,7 @@ sg_host_t SIMIX_vm_create(const char *name, sg_host_t ind_phys_host) static long host_get_ramsize(sg_host_t vm, int *overcommit) { s_vm_params_t params; - surf_host_get_params(vm, ¶ms); + vm->extension()->getParams(¶ms); if (overcommit) *overcommit = params.overcommit; @@ -68,7 +68,7 @@ static int __can_be_started(sg_host_t vm) } long total_ramsize_of_vms = 0; - xbt_dynar_t dyn_vms = surf_host_get_vms(pm); + xbt_dynar_t dyn_vms = pm->extension()->getVms(); { unsigned int cursor = 0; sg_host_t another_vm; @@ -86,7 +86,6 @@ static int __can_be_started(sg_host_t vm) return 0; } - xbt_dynar_free(&dyn_vms); return 1; } diff --git a/src/surf/instr_surf.cpp b/src/surf/instr_surf.cpp index b0003d6cc5..230805a286 100644 --- a/src/surf/instr_surf.cpp +++ b/src/surf/instr_surf.cpp @@ -5,7 +5,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "src/instr/instr_private.h" -#include "src/surf/surf_private.h" +#include "src/surf/surf_interface.hpp" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_surf, instr, "Tracing Surf"); @@ -46,5 +46,5 @@ void TRACE_surf_action(surf_action_t surf_action, const char *category) if (!category) return; - surf_action_set_category(surf_action, category); + surf_action->setCategory(category); } diff --git a/src/surf/network_cm02.cpp b/src/surf/network_cm02.cpp index a178748083..62c2f41063 100644 --- a/src/surf/network_cm02.cpp +++ b/src/surf/network_cm02.cpp @@ -20,20 +20,6 @@ double sg_weight_S_parameter = 0.0; /* default value; can be set by model or double sg_tcp_gamma = 0.0; int sg_network_crosstraffic = 0; -/************* - * CallBacks * - *************/ - -void net_define_callbacks(void) -{ - /* Figuring out the network links */ - simgrid::surf::on_link.connect(netlink_parse_init); -} - -/********* - * Model * - *********/ - /************************************************************************/ /* New model based on optimizations discussed during Pedro Velho's thesis*/ /************************************************************************/ @@ -53,16 +39,13 @@ void surf_network_model_init_LegrandVelho(void) if (surf_network_model) return; + simgrid::surf::on_link.connect(netlink_parse_init); surf_network_model = new simgrid::surf::NetworkCm02Model(); - net_define_callbacks(); - simgrid::surf::Model *model = surf_network_model; - xbt_dynar_push(all_existing_models, &model); - - xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", - 13.01); - xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", - 0.97); - xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 20537); + xbt_dynar_push(all_existing_models, &surf_network_model); + + xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 13.01); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 0.97); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 20537); } /***************************************************************************/ @@ -82,13 +65,13 @@ void surf_network_model_init_CM02(void) if (surf_network_model) return; + simgrid::surf::on_link.connect(netlink_parse_init); surf_network_model = new simgrid::surf::NetworkCm02Model(); xbt_dynar_push(all_existing_models, &surf_network_model); - net_define_callbacks(); - xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 1.0); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 1.0); xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 1.0); - xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 0.0); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 0.0); } /***************************************************************************/ @@ -106,15 +89,16 @@ void surf_network_model_init_Reno(void) if (surf_network_model) return; + simgrid::surf::on_link.connect(netlink_parse_init); surf_network_model = new simgrid::surf::NetworkCm02Model(); xbt_dynar_push(all_existing_models, &surf_network_model); - net_define_callbacks(); + lmm_set_default_protocol_function(func_reno_f, func_reno_fp, func_reno_fpi); surf_network_model->f_networkSolve = lagrange_solve; - xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 10.4); - xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 0.92); - xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 10.4); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 0.92); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); } @@ -123,15 +107,16 @@ void surf_network_model_init_Reno2(void) if (surf_network_model) return; + simgrid::surf::on_link.connect(netlink_parse_init); surf_network_model = new simgrid::surf::NetworkCm02Model(); xbt_dynar_push(all_existing_models, &surf_network_model); - net_define_callbacks(); + lmm_set_default_protocol_function(func_reno2_f, func_reno2_fp, func_reno2_fpi); surf_network_model->f_networkSolve = lagrange_solve; - xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 10.4); - xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 0.92); - xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 10.4); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 0.92); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); } void surf_network_model_init_Vegas(void) @@ -139,15 +124,16 @@ void surf_network_model_init_Vegas(void) if (surf_network_model) return; + simgrid::surf::on_link.connect(netlink_parse_init); surf_network_model = new simgrid::surf::NetworkCm02Model(); xbt_dynar_push(all_existing_models, &surf_network_model); - net_define_callbacks(); + lmm_set_default_protocol_function(func_vegas_f, func_vegas_fp, func_vegas_fpi); surf_network_model->f_networkSolve = lagrange_solve; - xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 10.4); - xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 0.92); - xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/latency_factor", 10.4); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/bandwidth_factor", 0.92); + xbt_cfg_setdefault_double(_sg_cfg_set, "network/weight_S", 8775); } namespace simgrid { @@ -188,14 +174,10 @@ NetworkCm02Model::NetworkCm02Model() } Link* NetworkCm02Model::createLink(const char *name, - double bw_initial, - tmgr_trace_t bw_trace, - double lat_initial, - tmgr_trace_t lat_trace, - int initiallyOn, - tmgr_trace_t state_trace, - e_surf_link_sharing_policy_t policy, - xbt_dict_t properties) + double bw_initial, tmgr_trace_t bw_trace, + double lat_initial, tmgr_trace_t lat_trace, + int initiallyOn, tmgr_trace_t state_trace, + e_surf_link_sharing_policy_t policy, xbt_dict_t properties) { xbt_assert(NULL == Link::byName(name), "Link '%s' declared several times in the platform", @@ -216,11 +198,9 @@ void NetworkCm02Model::updateActionsStateLazy(double now, double /*delta*/) 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()); - int i; - for (i = 0; i < n; i++){ - lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem, - action->getVariable(), - i); + + for (int i = 0; i < n; i++){ + lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem, action->getVariable(), i); NetworkCm02Link *link = static_cast(lmm_constraint_id(constraint)); TRACE_surf_link_set_utilization(link->getName(), action->getCategory(), @@ -284,11 +264,9 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta) } if (TRACE_is_enabled()) { int n = lmm_get_number_of_cnst_from_var(p_maxminSystem, action->getVariable()); - int i; - for (i = 0; i < n; i++){ - lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem, - action->getVariable(), - i); + for (int i = 0; i < n; i++){ + lmm_constraint_t constraint = lmm_get_cnst_from_var(p_maxminSystem, action->getVariable(), i); + NetworkCm02Link* link = static_cast(lmm_constraint_id(constraint)); TRACE_surf_link_set_utilization(link->getName(), action->getCategory(), @@ -300,8 +278,7 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta) now - action->getLastUpdate()); } } - if (!lmm_get_number_of_cnst_from_var - (p_maxminSystem, action->getVariable())) { + if (!lmm_get_number_of_cnst_from_var (p_maxminSystem, action->getVariable())) { /* There is actually no link used, hence an infinite bandwidth. * This happens often when using models like vivaldi. * In such case, just make sure that the action completes immediately. @@ -325,7 +302,6 @@ void NetworkCm02Model::updateActionsStateFull(double now, double delta) action->gapRemove(); } } - return; } Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, @@ -389,7 +365,7 @@ Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, } } xbt_dynar_foreach(route, i, _link) { - link = static_cast(_link); + link = static_cast(_link); double bb = bandwidthFactor(size) * link->getBandwidth(); bandwidth_bound = (bandwidth_bound < 0.0) ? bb : std::min(bandwidth_bound, bb); @@ -432,7 +408,7 @@ Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, } xbt_dynar_foreach(route, i, _link) { - link = static_cast(_link); + link = static_cast(_link); lmm_expand(p_maxminSystem, link->getConstraint(), action->getVariable(), 1.0); } @@ -456,12 +432,12 @@ Action *NetworkCm02Model::communicate(NetCard *src, NetCard *dst, * Resource * ************/ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_dict_t props, - lmm_system_t system, - double constraint_value, - int initiallyOn, tmgr_trace_t state_trace, - double bw_peak, tmgr_trace_t bw_trace, - double lat_initial, tmgr_trace_t lat_trace, - e_surf_link_sharing_policy_t policy) + lmm_system_t system, + double constraint_value, + int initiallyOn, tmgr_trace_t state_trace, + double bw_peak, tmgr_trace_t bw_trace, + double lat_initial, tmgr_trace_t lat_trace, + e_surf_link_sharing_policy_t policy) : Link(model, name, props, lmm_constraint_new(system, this, constraint_value), state_trace) { if (initiallyOn) @@ -482,7 +458,7 @@ NetworkCm02Link::NetworkCm02Link(NetworkCm02Model *model, const char *name, xbt_ m_latency.event = future_evt_set->add_trace(lat_trace, 0.0, this); if (policy == SURF_LINK_FATPIPE) - lmm_constraint_shared(getConstraint()); + lmm_constraint_shared(getConstraint()); } @@ -523,30 +499,26 @@ void NetworkCm02Link::apply_event(tmgr_trace_iterator_t triggered, double value) xbt_die("Unknown event!\n"); } - XBT_DEBUG - ("There was a resource state event, need to update actions related to the constraint (%p)", + XBT_DEBUG("There was a resource state event, need to update actions related to the constraint (%p)", getConstraint()); } void NetworkCm02Link::updateBandwidth(double value) { - double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / - (m_bandwidth.peak * m_bandwidth.scale); - lmm_variable_t var = NULL; - lmm_element_t elem = NULL; - lmm_element_t nextelem = NULL; - int numelem = 0; - - NetworkCm02Action *action = NULL; m_bandwidth.peak = value; - lmm_update_constraint_bound(getModel()->getMaxminSystem(), - getConstraint(), - sg_bandwidth_factor * - (m_bandwidth.peak * m_bandwidth.scale)); + + lmm_update_constraint_bound(getModel()->getMaxminSystem(), getConstraint(), + sg_bandwidth_factor * (m_bandwidth.peak * m_bandwidth.scale)); TRACE_surf_link_set_bandwidth(surf_get_clock(), getName(), sg_bandwidth_factor * m_bandwidth.peak * m_bandwidth.scale); + if (sg_weight_S_parameter > 0) { + double delta = sg_weight_S_parameter / value - sg_weight_S_parameter / (m_bandwidth.peak * m_bandwidth.scale); + + lmm_variable_t var; + lmm_element_t elem = NULL, nextelem = NULL; + int numelem = 0; while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) { - action = (NetworkCm02Action*) lmm_variable_id(var); + NetworkCm02Action *action = (NetworkCm02Action*) lmm_variable_id(var); action->m_weight += delta; if (!action->isSuspended()) lmm_update_variable_weight(getModel()->getMaxminSystem(), action->getVariable(), action->m_weight); @@ -560,11 +532,11 @@ void NetworkCm02Link::updateLatency(double value){ lmm_element_t elem = NULL; lmm_element_t nextelem = NULL; int numelem = 0; - NetworkCm02Action *action = NULL; m_latency.peak = value; + while ((var = lmm_get_var_from_cnst_safe(getModel()->getMaxminSystem(), getConstraint(), &elem, &nextelem, &numelem))) { - action = (NetworkCm02Action*) lmm_variable_id(var); + NetworkCm02Action *action = (NetworkCm02Action*) lmm_variable_id(var); action->m_latCurrent += delta; action->m_weight += delta; if (action->m_rate < 0) @@ -576,8 +548,7 @@ void NetworkCm02Link::updateLatency(double value){ if (action->m_rate < sg_tcp_gamma / (2.0 * action->m_latCurrent)) { XBT_INFO("Flow is limited BYBANDWIDTH"); } else { - XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", - action->m_latCurrent); + XBT_INFO("Flow is limited BYLATENCY, latency of flow is %f", action->m_latCurrent); } } if (!action->isSuspended()) diff --git a/src/surf/network_cm02.hpp b/src/surf/network_cm02.hpp index 1fb97de3cd..7637d0e8cf 100644 --- a/src/surf/network_cm02.hpp +++ b/src/surf/network_cm02.hpp @@ -29,12 +29,6 @@ class XBT_PRIVATE NetworkSmpiModel; } } -/********* - * Tools * - *********/ - -XBT_PRIVATE void net_define_callbacks(void); - /********* * Model * *********/ diff --git a/src/surf/network_ib.cpp b/src/surf/network_ib.cpp index 5e995d1582..43efa0422a 100644 --- a/src/surf/network_ib.cpp +++ b/src/surf/network_ib.cpp @@ -94,8 +94,9 @@ void surf_network_model_init_IB(void) if (surf_network_model) return; + + simgrid::surf::on_link.connect(netlink_parse_init); surf_network_model = new simgrid::surf::NetworkIBModel(); - net_define_callbacks(); xbt_dynar_push(all_existing_models, &surf_network_model); networkActionStateChangedCallbacks.connect(IB_action_state_changed_callback); networkCommunicateCallbacks.connect(IB_action_init_callback); diff --git a/src/surf/network_smpi.cpp b/src/surf/network_smpi.cpp index b9d8d15d69..17a09e1127 100644 --- a/src/surf/network_smpi.cpp +++ b/src/surf/network_smpi.cpp @@ -88,8 +88,8 @@ void surf_network_model_init_SMPI(void) if (surf_network_model) return; + simgrid::surf::on_link.connect(netlink_parse_init); surf_network_model = new simgrid::surf::NetworkSmpiModel(); - net_define_callbacks(); xbt_dynar_push(all_existing_models, &surf_network_model); xbt_cfg_setdefault_double(_sg_cfg_set, "network/sender_gap", 10e-6); diff --git a/src/surf/surf_c_bindings.cpp b/src/surf/surf_c_bindings.cpp index bd807adb75..25e73e8334 100644 --- a/src/surf/surf_c_bindings.cpp +++ b/src/surf/surf_c_bindings.cpp @@ -209,10 +209,6 @@ double surf_host_get_available_speed(sg_host_t host){ return host->pimpl_cpu->getAvailableSpeed(); } -xbt_dynar_t surf_host_get_attached_storage_list(sg_host_t host){ - return get_casted_host(host)->getAttachedStorageList(); -} - surf_action_t surf_host_open(sg_host_t host, const char* fullpath){ return get_casted_host(host)->open(fullpath); } @@ -254,27 +250,6 @@ int surf_host_file_move(sg_host_t host, surf_file_t fd, const char* fullpath){ return get_casted_host(host)->fileMove(fd, fullpath); } -xbt_dynar_t surf_host_get_vms(sg_host_t host){ - xbt_dynar_t vms = get_casted_host(host)->getVms(); - xbt_dynar_t vms_ = xbt_dynar_new(sizeof(sg_host_t), NULL); - unsigned int cpt; - simgrid::surf::VirtualMachine *vm; - xbt_dynar_foreach(vms, cpt, vm) { - sg_host_t cpy_ = vm->getHost(); - xbt_dynar_push(vms_, &cpy_); - } - xbt_dynar_free(&vms); - return vms_; -} - -void surf_host_get_params(sg_host_t host, vm_params_t params){ - get_casted_host(host)->getParams(params); -} - -void surf_host_set_params(sg_host_t host, vm_params_t params){ - get_casted_host(host)->setParams(params); -} - void surf_vm_destroy(sg_host_t vm){ // FIXME:DEADCODE vm->pimpl_cpu = nullptr; vm->pimpl_netcard = nullptr; @@ -336,42 +311,6 @@ const char* surf_storage_get_host(surf_resource_t resource){ return static_cast(surf_storage_resource_priv(resource))->p_attach; } -double surf_action_get_start_time(surf_action_t action){ - return action->getStartTime(); -} - -double surf_action_get_finish_time(surf_action_t action){ - return action->getFinishTime(); -} - -double surf_action_get_remains(surf_action_t action){ - return action->getRemains(); -} - -void surf_action_set_category(surf_action_t action, const char *category){ - action->setCategory(category); -} - -void *surf_action_get_data(surf_action_t action){ - return action->getData(); -} - -void surf_action_set_data(surf_action_t action, void *data){ - action->setData(data); -} - -e_surf_action_state_t surf_action_get_state(surf_action_t action){ - return action->getState(); -} - -double surf_action_get_cost(surf_action_t action){ - return action->getCost(); -} - -void surf_cpu_action_set_affinity(surf_action_t action, sg_host_t host, unsigned long mask) { - static_cast(action)->setAffinity(host->pimpl_cpu, mask); -} - void surf_cpu_action_set_bound(surf_action_t action, double bound) { static_cast(action)->setBound(bound); } diff --git a/teshsuite/surf/surf_usage/surf_usage.cpp b/teshsuite/surf/surf_usage/surf_usage.cpp index 37a90b4609..c05e66ba92 100644 --- a/teshsuite/surf/surf_usage/surf_usage.cpp +++ b/teshsuite/surf/surf_usage/surf_usage.cpp @@ -57,8 +57,8 @@ void test(char *platform) hostB = sg_host_by_name("Cpu B"); /* Let's check that those two processors exist */ - XBT_DEBUG("%s : %p", surf_cpu_name(hostA->pimpl_cpu), hostA); - XBT_DEBUG("%s : %p", surf_cpu_name(hostB->pimpl_cpu), hostB); + XBT_DEBUG("%s : %p", sg_host_get_name(hostA), hostA); + XBT_DEBUG("%s : %p", sg_host_get_name(hostB), hostB); /* Let's do something on it */ actionA = hostA->pimpl_cpu->execution_start(1000.0);