-/* Copyright (c) 2007, 2008, 2009, 2010. The SimGrid Team.
+/* Copyright (c) 2007-2010, 2012-2015. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
#include <stdio.h>
-#include "msg/msg.h" /* Yeah! If you want to use msg, you need to include msg/msg.h */
+#include "simgrid/msg.h" /* Yeah! If you want to use msg, you need to include simgrid/msg.h */
#include "xbt/sysdep.h" /* calloc, printf */
/* Create a log channel to have nice outputs. */
static int master_choosen = FALSE;
host_parameters.id = NULL;
- host_parameters.power_peak = 1000000;
-
+ host_parameters.speed_peak = xbt_dynar_new(sizeof(double), NULL);
+ xbt_dynar_push_as(host_parameters.speed_peak, double, 25000000.0);
host_parameters.core_amount = 1;
- host_parameters.power_scale = 1;
- host_parameters.power_trace = NULL;
- host_parameters.initial_state = SURF_RESOURCE_ON;
+ host_parameters.speed_scale = 1;
+ host_parameters.speed_trace = NULL;
+ host_parameters.initiallyOn = 1;
host_parameters.state_trace = NULL;
host_parameters.coord = NULL;
host_parameters.properties = NULL;
master_choosen = TRUE;
host_parameters.id = "host_master";
} else {
- /*
- * The bug #14699 cannot allow us to set up an event trace which
- * begin by SURF_RESOURCE_OFF, otherwise, the host will be down at startup
- * and the associate process will fail to start. So, here, we generate a
- * first useless event.
- */
- //Set a availability trace for the node
- char* generator_id = bprintf("state_host_%ld", node->id);
- probabilist_event_generator_t date_generator =
- tmgr_event_generator_new_weibull(generator_id, 80, 1.5);
- host_parameters.state_trace = tmgr_trace_generator_state(generator_id,
- date_generator,
- SURF_RESOURCE_ON);
-
//Set a power trace
char* pw_date_generator_id = bprintf("pw_date_host_%ld", node->id);
char* pw_value_generator_id = bprintf("pw_value_host_%ld", node->id);
tmgr_event_generator_new_uniform(pw_date_generator_id, 5, 10);
probabilist_event_generator_t pw_value_generator =
tmgr_event_generator_new_uniform(pw_value_generator_id, 0.6, 1.0);
- host_parameters.power_trace =
+ host_parameters.speed_trace =
tmgr_trace_generator_value(bprintf("pw_host_%ld", node->id),
pw_date_generator,
pw_value_generator);
link_parameters.bandwidth_trace = NULL;
link_parameters.latency = 0.01;
link_parameters.latency_trace = NULL;
- link_parameters.state = SURF_RESOURCE_ON;
+ link_parameters.initiallyOn = 1;
link_parameters.state_trace = NULL;
link_parameters.policy = SURF_LINK_SHARED;
link_parameters.properties = NULL;
tmgr_trace_generator_avail_unavail(bprintf("state_link_%ld", edge->id),
avail_generator,
unavail_generator,
- SURF_RESOURCE_ON);
+ 1/*ON*/);
platf_graph_link_label(edge, &link_parameters);
}
-/** Emitter function */
int master(int argc, char *argv[])
{
int slaves_count = 0;
task_comp_size = TASK_COMP_SIZE;
task_comm_size = TASK_COMM_SIZE;
- { /* Process organisation */
+ { /* Process organization */
slaves_count = argc;
slaves = xbt_new0(msg_host_t, slaves_count);
for (i = 0; i < argc; i++) {
- slaves[i] = MSG_get_host_by_name(argv[i]);
+ slaves[i] = MSG_host_by_name(argv[i]);
if (slaves[i] == NULL) {
XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
abort();
return 0;
} /* end_of_master */
-/** Receiver function */
int slave(int argc, char *argv[])
{
while (1) {
int connected;
int max_tries = 10;
- //MSG initialisation
+ //MSG initialization
MSG_init(&argc, argv);
//Set up the seed for the platform generation
platf_graph_promoter(promoter_1);
platf_graph_labeler(labeler_1);
- XBT_INFO("protmoting...");
+ XBT_INFO("promoting...");
platf_do_promote();
XBT_INFO("labeling...");
msg_host_t host_master = NULL;
msg_process_t process = NULL;
xbt_dynar_t host_dynar = MSG_hosts_as_dynar();
- char** hostname_list = xbt_malloc(sizeof(char*) * xbt_dynar_length(host_dynar));
+ char** hostname_list =
+ xbt_malloc(sizeof(char*) * xbt_dynar_length(host_dynar));
xbt_dynar_foreach(host_dynar, i, host) {
process = MSG_process_create("slave", slave, NULL, host);
MSG_process_auto_restart_set(process, TRUE);
hostname_list[i] = (char*) MSG_host_get_name(host);
}
- host_master = MSG_get_host_by_name("host_master");
- MSG_process_create_with_arguments("master", master, NULL, host_master, xbt_dynar_length(host_dynar), hostname_list);
+ host_master = MSG_host_by_name("host_master");
+ MSG_process_create_with_arguments("master", master, NULL, host_master,
+ xbt_dynar_length(host_dynar),
+ hostname_list);
res = MSG_main();