-/* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
+/* Copyright (c) 2007-2013. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
free(((surf_action_workstation_L07_t) action)->workstation_list);
free(((surf_action_workstation_L07_t) action)->communication_amount);
free(((surf_action_workstation_L07_t) action)->computation_amount);
+#ifdef HAVE_TRACING
+ xbt_free(action->category);
+#endif
surf_action_free(&action);
return 1;
}
}
-static double ptask_share_resources(double now)
+static double ptask_share_resources(surf_model_t workstation_model, double now)
{
s_surf_action_workstation_L07_t s_action;
surf_action_workstation_L07_t action = NULL;
xbt_swag_t running_actions =
- surf_workstation_model->states.running_action_set;
+ workstation_model->states.running_action_set;
double min = generic_maxmin_share_resources(running_actions,
xbt_swag_offset(s_action,
variable),
return min;
}
-static void ptask_update_actions_state(double now, double delta)
+static void ptask_update_actions_state(surf_model_t workstation_model, double now, double delta)
{
double deltap = 0.0;
surf_action_workstation_L07_t action = NULL;
surf_action_workstation_L07_t next_action = NULL;
xbt_swag_t running_actions =
- surf_workstation_model->states.running_action_set;
+ workstation_model->states.running_action_set;
xbt_swag_foreach_safe(action, next_action, running_actions) {
deltap = delta;
return;
}
-static void ptask_finalize(void)
+static void ptask_finalize(surf_model_t workstation_model)
{
xbt_dict_free(&ptask_parallel_task_link_set);
- surf_model_exit(surf_workstation_model);
- surf_workstation_model = NULL;
+ surf_model_exit(workstation_model);
+ workstation_model = NULL;
surf_model_exit(surf_network_model);
surf_network_model = NULL;
return ((cpu_L07_t)surf_workstation_resource_priv(cpu))->power_current;
}
+static double ws_get_current_power_peak(void *cpu)
+{
+ return ((cpu_L07_t)surf_workstation_resource_priv(cpu))->power_current;
+}
+
+static double ws_get_power_peak_at(void *cpu, int pstate_index)
+{
+ XBT_DEBUG("[ws_get_power_peak_at] Not implemented for workstation_ptask_L07");
+ return 0.0;
+}
+
+static int ws_get_nb_pstates(void *workstation)
+{
+ XBT_DEBUG("[ws_get_nb_pstates] Not implemented for workstation_ptask_L07");
+ return 0.0;
+}
+
+static void ws_set_power_peak_at(void *cpu, int pstate_index)
+{
+ XBT_DEBUG("[ws_set_power_peak_at] Not implemented for workstation_ptask_L07");
+}
+
+static double ws_get_consumed_energy(void *cpu)
+{
+ XBT_DEBUG("[ws_get_consumed_energy] Not implemented for workstation_ptask_L07");
+ return 0.0;
+}
+
static surf_action_t ptask_execute_parallel_task(int workstation_nb,
void **workstation_list,
double
name);
cpu = (cpu_L07_t) surf_resource_new(sizeof(s_cpu_L07_t),
- surf_workstation_model, name,cpu_properties);
+ surf_workstation_model, name,cpu_properties, NULL);
cpu->type = SURF_WORKSTATION_RESOURCE_CPU;
cpu->info = xbt_lib_get_or_null(host_lib, name, ROUTING_HOST_LEVEL);
static void ptask_parse_cpu_init(sg_platf_host_cbarg_t host)
{
+ double power_peak = xbt_dynar_get_as(host->power_peak, host->pstate, double);
+ //cpu->power_peak = power_peak;
+ xbt_dynar_free(&(host->power_peak)); /* kill memory leak */
ptask_cpu_create_resource(
host->id,
- host->power_peak,
+ power_peak,
host->power_scale,
host->power_trace,
host->initial_state,
surf_workstation_model->set_priority = ptask_action_set_priority;
surf_workstation_model->get_remains = ptask_action_get_remains;
surf_workstation_model->name = "Workstation ptask_L07";
+ surf_workstation_model->type = SURF_MODEL_TYPE_WORKSTATION;
surf_workstation_model->model_private->resource_used =
ptask_resource_used;
ptask_get_speed;
surf_workstation_model->extension.workstation.get_available_speed =
ptask_get_available_speed;
+ surf_workstation_model->extension.workstation.get_current_power_peak = ws_get_current_power_peak;
+ surf_workstation_model->extension.workstation.get_power_peak_at = ws_get_power_peak_at;
+ surf_workstation_model->extension.workstation.get_nb_pstates = ws_get_nb_pstates;
+ surf_workstation_model->extension.workstation.set_power_peak_at = ws_set_power_peak_at;
+ surf_workstation_model->extension.workstation.get_consumed_energy = ws_get_consumed_energy;
+
surf_workstation_model->extension.workstation.communicate =
ptask_communicate;
surf_workstation_model->extension.workstation.get_route =
void surf_workstation_model_init_ptask_L07(void)
{
XBT_INFO("surf_workstation_model_init_ptask_L07");
- xbt_assert(!surf_cpu_model, "CPU model type already defined");
+ xbt_assert(!surf_cpu_model_pm, "CPU model type already defined");
xbt_assert(!surf_network_model, "network model type already defined");
ptask_define_callbacks();
ptask_model_init_internal();