// =========== user-level functions ===============
XBT_PUBLIC(double) sg_host_speed(sg_host_t host);
XBT_PUBLIC(double) sg_host_get_available_speed(sg_host_t host);
-XBT_PUBLIC(int) sg_host_core_count(sg_host_t host);
-XBT_PUBLIC(int) sg_host_is_on(sg_host_t host);
XBT_PUBLIC(int) sg_host_get_nb_pstates(sg_host_t host);
XBT_PUBLIC(int) sg_host_get_pstate(sg_host_t host);
*/
XBT_PUBLIC(surf_action_t) surf_network_model_communicate(surf_network_model_t model, sg_host_t src, sg_host_t dst, double size, double rate);
-/**
- * @brief Get the name of a surf resource (cpu, host, network, …)
- *
- * @param resource The surf resource
- * @return The name of the surf resource
- */
-XBT_PUBLIC(const char * ) surf_resource_name(surf_cpp_resource_t resource);
-
-/** @brief Get the available speed of cpu associated to a host */
-XBT_PUBLIC(double) surf_host_get_available_speed(sg_host_t host);
-
/** @brief Create a sleep action on the given host */
XBT_PUBLIC(surf_action_t) surf_host_sleep(sg_host_t host, double duration);
*/
int MSG_host_is_on(msg_host_t host)
{
- xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
- return sg_host_is_on(host);
+ return host->isOn();
}
/** @ingroup m_host_management
*/
int MSG_host_is_off(msg_host_t host)
{
- xbt_assert((host != NULL), "Invalid parameters (host is NULL)");
- return !(sg_host_is_on(host));
+ return host->isOff();
}
/** \ingroup m_host_management
for (int i = 0; i < workstation_nb; i++) {
double time = 0.0;
if (flops_amount != NULL)
- time = flops_amount[i] / sg_host_speed(workstation_list[i]);
+ time = flops_amount[i] / workstation_list[i]->speed();
if (bytes_amount != NULL)
for (int j = 0; j < workstation_nb; j++) {
// =========== user-level functions ===============
// ================================================
-
-/** @brief Returns the total speed of a host
- */
+/** @brief Returns the total speed of a host */
double sg_host_speed(sg_host_t host)
{
return host->speed();
}
-double sg_host_get_available_speed(sg_host_t host){
- return surf_host_get_available_speed(host);
-}
-/** @brief Returns the number of cores of a host
-*/
-int sg_host_core_count(sg_host_t host) {
- return host->core_count();
-}
-
-/** @brief Returns the state of a host.
- * @return 1 if the host is active or 0 if it has crashed.
- */
-int sg_host_is_on(sg_host_t host) {
- return host->isOn();
+double sg_host_get_available_speed(sg_host_t host)
+{
+ return host->pimpl_cpu->getAvailableSpeed();
}
/** @brief Returns the number of power states for a host.
char *key,*data;
XBT_INFO("Displaying host %s", sg_host_get_name(host));
- XBT_INFO(" - speed: %.0f", sg_host_speed(host));
+ XBT_INFO(" - speed: %.0f", host->speed());
XBT_INFO(" - available speed: %.2f", sg_host_get_available_speed(host));
props = sg_host_get_properties(host);
arg->argv = xbt_new(char*,argc + 1);
- int i;
- for (i = 0; i < argc; i++) {
+ for (int i = 0; i < argc; i++)
arg->argv[i] = xbt_strdup(argv[i]);
- }
arg->argv[argc] = NULL;
arg->properties = properties;
arg->auto_restart = auto_restart;
- if( ! sg_host_is_on(host)
- && !xbt_dict_get_or_null(watched_hosts_lib,sg_host_get_name(host))){
+ if( host->isOff() && !xbt_dict_get_or_null(watched_hosts_lib,sg_host_get_name(host))){
xbt_dict_set(watched_hosts_lib,sg_host_get_name(host),host,NULL);
- XBT_DEBUG("Have pushed host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_get_name(host));
+ XBT_DEBUG("Push host %s to watched_hosts_lib because state == SURF_RESOURCE_OFF",sg_host_get_name(host));
}
xbt_dynar_push_as(sg_host_simix(host)->auto_restart_processes,smx_process_arg_t,arg);
}
surf_action_t surf_model_extract_done_action_set(surf_model_t model){
if (model->getDoneActionSet()->empty())
- return NULL;
+ return NULL;
surf_action_t res = &model->getDoneActionSet()->front();
model->getDoneActionSet()->pop_front();
return res;
surf_action_t surf_model_extract_failed_action_set(surf_model_t model){
if (model->getFailedActionSet()->empty())
- return NULL;
+ return NULL;
surf_action_t res = &model->getFailedActionSet()->front();
model->getFailedActionSet()->pop_front();
return res;
return model->communicate(src->pimpl_netcard, dst->pimpl_netcard, size, rate);
}
-const char *surf_resource_name(surf_cpp_resource_t resource){
- return resource->getName();
-}
-
surf_action_t surf_host_sleep(sg_host_t host, double duration){
return host->pimpl_cpu->sleep(duration);
}
-
-double surf_host_get_available_speed(sg_host_t host){
- return host->pimpl_cpu->getAvailableSpeed();
-}
-
surf_action_t surf_host_open(sg_host_t host, const char* fullpath){
return get_casted_host(host)->open(fullpath);
}
for (i = 0; i < totalHosts; i++) {
printf(" <host id=\"%s\" speed=\"%.0f\"", sg_host_get_name(hosts[i]), sg_host_speed(hosts[i]));
props = sg_host_get_properties(hosts[i]);
- if (sg_host_core_count(hosts[i])>1) {
- printf(" core=\"%d\"", sg_host_core_count(hosts[i]));
+ if (hosts[i]->core_count()>1) {
+ printf(" core=\"%d\"", hosts[i]->core_count());
}
if (props && !xbt_dict_is_empty(props)) {
printf(">\n");