src/instr/instr_msg_task.c
src/instr/instr_paje_containers.c
src/instr/instr_paje_trace.c
+ src/instr/instr_paje_header.c
src/instr/instr_paje_types.c
src/instr/instr_paje_values.c
src/instr/instr_private.h
add_executable(bittorrent
"bittorrent.c" "messages.c" "peer.c" "tracker.c" "connection.c")
+add_executable(bittorrent_platfgen
+ "bittorrent_platfgen.c" "messages.c" "peer.c" "tracker.c" "connection.c")
### Add definitions for compile
target_link_libraries(bittorrent simgrid )
+target_link_libraries(bittorrent_platfgen simgrid )
set(tesh_files
${tesh_files}
set(examples_src
${examples_src}
${CMAKE_CURRENT_SOURCE_DIR}/bittorrent.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/bittorrent_platfgen.c
${CMAKE_CURRENT_SOURCE_DIR}/bittorrent.h
${CMAKE_CURRENT_SOURCE_DIR}/connection.c
${CMAKE_CURRENT_SOURCE_DIR}/connection.h
--- /dev/null
+/* Copyright (c) 2012. 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 "bittorrent.h"
+#include "peer.h"
+#include "tracker.h"
+#include <msg/msg.h>
+#include <simgrid/platf_generator.h>
+/**
+ * Bittorrent example launcher, using a generated platform
+ */
+
+static RngStream rng_stream;
+
+void promoter(context_node_t node);
+void labeler(context_edge_t edge);
+void create_environment(int node_count);
+void dispatch_jobs(double tracker_deadline, double peer_deadline, double seed_percentage);
+
+void promoter(context_node_t node) {
+ s_sg_platf_host_cbarg_t host_parameters;
+
+ if(node->degree == 1) {
+ //We promote only the leaf; as we use a star topology, all the nodes
+ //will be promoted except the first one, which will be a router with
+ //every hosts connected on.
+ host_parameters.id = NULL;
+
+ //Power from 3,000,000 to 10,000,000
+ host_parameters.power_peak = 7000000 * RngStream_RandU01(rng_stream) + 3000000;
+ host_parameters.core_amount = 1;
+ host_parameters.power_scale = 1;
+ host_parameters.power_trace = NULL;
+ host_parameters.initial_state = SURF_RESOURCE_ON;
+ host_parameters.state_trace = NULL;
+ host_parameters.coord = NULL;
+ host_parameters.properties = NULL;
+
+ platf_graph_promote_to_host(node, &host_parameters);
+ }
+}
+
+void labeler(context_edge_t edge) {
+
+ s_sg_platf_link_cbarg_t link_parameters;
+ link_parameters.id = NULL;
+
+ //bandwidth from 3,000,000 to 10,000,000
+ link_parameters.bandwidth = 7000000 * RngStream_RandU01(rng_stream) + 3000000;
+ link_parameters.bandwidth_trace = NULL;
+
+ //Latency from 0ms to 100ms
+ link_parameters.latency = RngStream_RandU01(rng_stream) / 10.0;
+ link_parameters.latency_trace = NULL;
+ link_parameters.state = SURF_RESOURCE_ON;
+ link_parameters.state_trace = NULL;
+ link_parameters.policy = SURF_LINK_SHARED;
+ link_parameters.properties = NULL;
+
+ platf_graph_link_label(edge, &link_parameters);
+}
+
+void create_environment(int node_count) {
+
+ platf_graph_uniform(node_count);
+
+ //every nodes are connected to the first one
+ platf_graph_interconnect_star();
+ //No need to check if the graph is connected, the star topology implies it.
+
+ //register promoter and labeler
+ platf_graph_promoter(promoter);
+ platf_graph_labeler(labeler);
+
+ //promoting and labeling
+ platf_do_promote();
+ platf_do_label();
+
+ //Put the platform into the simulator
+ platf_generate();
+}
+
+void dispatch_jobs(double tracker_deadline, double peer_deadline, double seed_percentage) {
+
+ xbt_dynar_t available_nodes = MSG_hosts_as_dynar();
+ msg_host_t host;
+ unsigned int i;
+
+ char** arguments_tracker;
+ char** arguments_peer;
+
+ unsigned int seed_count = (seed_percentage/100.0) * xbt_dynar_length(available_nodes);
+
+ xbt_dynar_foreach(available_nodes, i, host) {
+ if(i==0) {
+ //The fisrt node is the tracker
+ arguments_tracker = xbt_malloc0(sizeof(char*) * 2);
+ arguments_tracker[0] = bprintf("tracker");
+ arguments_tracker[1] = bprintf("%f", tracker_deadline);
+ MSG_process_create_with_arguments("tracker", tracker, NULL, host, 2, arguments_tracker);
+ } else {
+ //Other nodes are peers
+ int argument_size;
+ arguments_peer = xbt_malloc0(sizeof(char*) * 4);
+ arguments_peer[0] = bprintf("peer");
+ arguments_peer[1] = bprintf("%d", i);
+ arguments_peer[2] = bprintf("%f", peer_deadline);
+
+ //The first peers will be seeders
+ if(seed_count > 0) {
+ seed_count--;
+ arguments_peer[3] = bprintf("1");
+ argument_size = 4;
+ } else {
+ //Other ars leechers
+ arguments_peer[3] = NULL;
+ argument_size = 3;
+ }
+ MSG_process_create_with_arguments("peer", peer, NULL, host, argument_size, arguments_peer);
+ }
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ MSG_init(&argc, argv);
+
+ rng_stream = RngStream_CreateStream(NULL);
+
+ //Maybe these parameters should be set from the command line...
+ //create_environment(<node_count>)
+ create_environment(20);
+
+ //dispatch_jobs(<tracker_deadline>, <peer_deadline>, <seed_percentage>)
+ dispatch_jobs(2000, 2000, 10);
+
+ MSG_main();
+
+ MSG_clean();
+
+ return 0;
+}
add_executable(masterslave_kill "masterslave_kill.c")
add_executable(masterslave_arg "masterslave_arg.c")
add_executable(masterslave_platfgen "masterslave_platfgen.c")
+add_executable(masterslave_failure_platfgen "masterslave_failure_platfgen.c")
### Add definitions for compile
if(WIN32)
target_link_libraries(masterslave_kill simgrid )
target_link_libraries(masterslave_arg simgrid )
target_link_libraries(masterslave_platfgen simgrid )
+ target_link_libraries(masterslave_failure_platfgen simgrid )
else(WIN32)
target_link_libraries(masterslave_forwarder simgrid m )
target_link_libraries(masterslave_failure simgrid m )
target_link_libraries(masterslave_kill simgrid m )
target_link_libraries(masterslave_arg simgrid m )
target_link_libraries(masterslave_platfgen simgrid m )
+ target_link_libraries(masterslave_failure_platfgen simgrid m )
endif(WIN32)
target_link_libraries(masterslave_cluster simgrid)
${CMAKE_CURRENT_SOURCE_DIR}/masterslave_kill.c
${CMAKE_CURRENT_SOURCE_DIR}/masterslave_mailbox.c
${CMAKE_CURRENT_SOURCE_DIR}/masterslave_platfgen.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/masterslave_failure_platfgen.c
PARENT_SCOPE
)
set(bin_files
--- /dev/null
+/* Copyright (c) 2007, 2008, 2009, 2010. 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 "xbt/sysdep.h" /* calloc, printf */
+
+/* Create a log channel to have nice outputs. */
+#include "xbt/log.h"
+#include "xbt/asserts.h"
+
+/* we are going to use a generated platform */
+#include "simgrid/platf_generator.h"
+#include "simgrid/platf_interface.h"
+
+XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test,
+ "Messages specific for this msg example");
+
+int master(int argc, char *argv[]);
+int slave(int argc, char *argv[]);
+void promoter_1(context_node_t node);
+void labeler_1(context_edge_t edge);
+
+#define FINALIZE ((void*)221297) /* a magic number to tell people to stop working */
+
+#define TASK_COUNT_PER_HOST 5 /* Number of tasks each slave has to do */
+#define TASK_COMP_SIZE 15000000 /* computation cost of each task */
+#define TASK_COMM_SIZE 1200000 /* communication time of task */
+
+/** Promoter function
+ * Just promote each node into a host, with fixed power
+ * Set one node as master
+ * Add a state trace on other nodes
+ */
+void promoter_1(context_node_t node) {
+
+ s_sg_platf_host_cbarg_t host_parameters;
+ static int master_choosen = FALSE;
+
+ host_parameters.id = NULL;
+ host_parameters.power_peak = 1000000;
+
+ host_parameters.core_amount = 1;
+ host_parameters.power_scale = 1;
+ host_parameters.power_trace = NULL;
+ host_parameters.initial_state = SURF_RESOURCE_ON;
+ host_parameters.state_trace = NULL;
+ host_parameters.coord = NULL;
+ host_parameters.properties = NULL;
+
+ if(!master_choosen) {
+ 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);
+ probabilist_event_generator_t pw_date_generator =
+ 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 =
+ tmgr_trace_generator_value(bprintf("pw_host_%ld", node->id),
+ pw_date_generator,
+ pw_value_generator);
+ }
+
+ platf_graph_promote_to_host(node, &host_parameters);
+
+}
+
+/** Labeler function
+ * Set all links with the same bandwidth and latency
+ * Add a state trace to each link
+ */
+void labeler_1(context_edge_t edge) {
+ s_sg_platf_link_cbarg_t link_parameters;
+ link_parameters.id = NULL;
+ link_parameters.bandwidth = 100000000;
+ link_parameters.bandwidth_trace = NULL;
+ link_parameters.latency = 0.01;
+ link_parameters.latency_trace = NULL;
+ link_parameters.state = SURF_RESOURCE_ON;
+ link_parameters.state_trace = NULL;
+ link_parameters.policy = SURF_LINK_SHARED;
+ link_parameters.properties = NULL;
+
+ char* avail_generator_id = bprintf("avail_link_%ld", edge->id);
+ char* unavail_generator_id = bprintf("unavail_link_%ld", edge->id);
+
+ probabilist_event_generator_t avail_generator =
+ tmgr_event_generator_new_exponential(avail_generator_id, 0.0001);
+ probabilist_event_generator_t unavail_generator =
+ tmgr_event_generator_new_uniform(unavail_generator_id, 10, 20);
+
+ link_parameters.state_trace =
+ tmgr_trace_generator_avail_unavail(bprintf("state_link_%ld", edge->id),
+ avail_generator,
+ unavail_generator,
+ SURF_RESOURCE_ON);
+
+
+ platf_graph_link_label(edge, &link_parameters);
+
+}
+
+/** Emitter function */
+int master(int argc, char *argv[])
+{
+ int slaves_count = 0;
+ msg_host_t *slaves = NULL;
+ int number_of_tasks = 0;
+ double task_comp_size = 0;
+ double task_comm_size = 0;
+ int i;
+ _XBT_GNUC_UNUSED int read;
+
+ number_of_tasks = TASK_COUNT_PER_HOST*argc;
+ task_comp_size = TASK_COMP_SIZE;
+ task_comm_size = TASK_COMM_SIZE;
+
+ { /* Process organisation */
+ 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]);
+ if (slaves[i] == NULL) {
+ XBT_INFO("Unknown host %s. Stopping Now! ", argv[i]);
+ abort();
+ }
+ }
+ }
+
+ XBT_INFO("Got %d slave(s) :", slaves_count);
+ for (i = 0; i < slaves_count; i++)
+ XBT_INFO("%s", MSG_host_get_name(slaves[i]));
+
+ XBT_INFO("Got %d task to process :", number_of_tasks);
+
+ for (i = 0; i < number_of_tasks; i++) {
+ msg_task_t task = MSG_task_create("Task", task_comp_size, task_comm_size,
+ xbt_new0(double, 1));
+ int a;
+ *((double *) task->data) = MSG_get_clock();
+
+ a = MSG_task_send_with_timeout(task,MSG_host_get_name(slaves[i % slaves_count]),10.0);
+
+ if (a == MSG_OK) {
+ XBT_INFO("Send completed");
+ } else if (a == MSG_HOST_FAILURE) {
+ XBT_INFO
+ ("Gloups. The cpu on which I'm running just turned off!. See you!");
+ free(task->data);
+ MSG_task_destroy(task);
+ free(slaves);
+ return 0;
+ } else if (a == MSG_TRANSFER_FAILURE) {
+ XBT_INFO
+ ("Mmh. Something went wrong with '%s'. Nevermind. Let's keep going!",
+ MSG_host_get_name(slaves[i % slaves_count]));
+ free(task->data);
+ MSG_task_destroy(task);
+ } else if (a == MSG_TIMEOUT) {
+ XBT_INFO
+ ("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
+ MSG_host_get_name(slaves[i % slaves_count]));
+ free(task->data);
+ MSG_task_destroy(task);
+ } else {
+ XBT_INFO("Hey ?! What's up ? ");
+ xbt_die( "Unexpected behavior");
+ }
+ }
+
+ XBT_INFO
+ ("All tasks have been dispatched. Let's tell everybody the computation is over.");
+ for (i = 0; i < slaves_count; i++) {
+ msg_task_t task = MSG_task_create("finalize", 0, 0, FINALIZE);
+ int a = MSG_task_send_with_timeout(task,MSG_host_get_name(slaves[i]),1.0);
+ if (a == MSG_OK)
+ continue;
+ if (a == MSG_HOST_FAILURE) {
+ XBT_INFO
+ ("Gloups. The cpu on which I'm running just turned off!. See you!");
+ MSG_task_destroy(task);
+ free(slaves);
+ return 0;
+ } else if (a == MSG_TRANSFER_FAILURE) {
+ XBT_INFO("Mmh. Can't reach '%s'! Nevermind. Let's keep going!",
+ MSG_host_get_name(slaves[i]));
+ MSG_task_destroy(task);
+ } else if (a == MSG_TIMEOUT) {
+ XBT_INFO
+ ("Mmh. Got timeouted while speaking to '%s'. Nevermind. Let's keep going!",
+ MSG_host_get_name(slaves[i % slaves_count]));
+ MSG_task_destroy(task);
+ } else {
+ XBT_INFO("Hey ?! What's up ? ");
+ xbt_die("Unexpected behavior with '%s': %d", MSG_host_get_name(slaves[i]), a);
+ }
+ }
+
+ XBT_INFO("Goodbye now!");
+ free(slaves);
+ return 0;
+} /* end_of_master */
+
+/** Receiver function */
+int slave(int argc, char *argv[])
+{
+ while (1) {
+ msg_task_t task = NULL;
+ int a;
+ double time1, time2;
+
+ time1 = MSG_get_clock();
+ a = MSG_task_receive( &(task), MSG_host_get_name(MSG_host_self()) );
+ time2 = MSG_get_clock();
+ if (a == MSG_OK) {
+ XBT_INFO("Received \"%s\"", MSG_task_get_name(task));
+ if (MSG_task_get_data(task) == FINALIZE) {
+ MSG_task_destroy(task);
+ break;
+ }
+ if (time1 < *((double *) task->data))
+ time1 = *((double *) task->data);
+ XBT_INFO("Communication time : \"%f\"", time2 - time1);
+ XBT_INFO("Processing \"%s\"", MSG_task_get_name(task));
+ a = MSG_task_execute(task);
+ if (a == MSG_OK) {
+ XBT_INFO("\"%s\" done", MSG_task_get_name(task));
+ free(task->data);
+ MSG_task_destroy(task);
+ } else if (a == MSG_HOST_FAILURE) {
+ XBT_INFO
+ ("Gloups. The cpu on which I'm running just turned off!. See you!");
+ return 0;
+ } else {
+ XBT_INFO("Hey ?! What's up ? ");
+ xbt_die("Unexpected behavior");
+ }
+ } else if (a == MSG_HOST_FAILURE) {
+ XBT_INFO
+ ("Gloups. The cpu on which I'm running just turned off!. See you!");
+ return 0;
+ } else if (a == MSG_TRANSFER_FAILURE) {
+ XBT_INFO("Mmh. Something went wrong. Nevermind. Let's keep going!");
+ } else if (a == MSG_TIMEOUT) {
+ XBT_INFO("Mmh. Got a timeout. Nevermind. Let's keep going!");
+ } else {
+ XBT_INFO("Hey ?! What's up ? ");
+ xbt_die("Unexpected behavior");
+ }
+ }
+ XBT_INFO("I'm done. See you!");
+ return 0;
+} /* end_of_slave */
+
+/** Main function */
+int main(int argc, char *argv[])
+{
+ msg_error_t res = MSG_OK;
+ unsigned long seed_platf_gen[] = {134, 233445, 865, 2634, 424242, 876543};
+ unsigned long seed_trace_gen[] = {8865244, 356772, 42, 77465, 2098754, 8725442};
+ int connected;
+ int max_tries = 10;
+
+ //MSG initialisation
+ MSG_init(&argc, argv);
+
+ //Set up the seed for the platform generation
+ platf_random_seed(seed_platf_gen);
+
+ //Set up the RngStream for trace generation
+ sg_platf_rng_stream_init(seed_trace_gen);
+
+ XBT_INFO("creating nodes...");
+ platf_graph_uniform(10);
+
+ do {
+ max_tries--;
+ XBT_INFO("creating links...");
+ platf_graph_clear_links();
+ platf_graph_interconnect_waxman(0.9, 0.4);
+ XBT_INFO("done. Check connectedness...");
+ connected = platf_graph_is_connected();
+ XBT_INFO("Is it connected : %s", connected ? "yes" : (max_tries ? "no, retrying" : "no"));
+ } while(!connected && max_tries);
+
+ if(!connected && !max_tries) {
+ xbt_die("Impossible to connect the graph, aborting.");
+ }
+
+ XBT_INFO("registering callbacks...");
+ platf_graph_promoter(promoter_1);
+ platf_graph_labeler(labeler_1);
+
+ XBT_INFO("protmoting...");
+ platf_do_promote();
+
+ XBT_INFO("labeling...");
+ platf_do_label();
+
+ XBT_INFO("Putting it in surf...");
+ platf_generate();
+
+ XBT_INFO("Let's get the available hosts and dispatch work:");
+
+ unsigned int i;
+ msg_host_t host = NULL;
+ msg_host_t host_master = NULL;
+ msg_process_t process = NULL;
+ xbt_dynar_t host_dynar = MSG_hosts_as_dynar();
+ char** hostname_list = 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);
+
+ res = MSG_main();
+
+ if (res == MSG_OK)
+ return 0;
+ else
+ return 1;
+} /* end_of_main */
max_tries--;
XBT_INFO("creating links...");
platf_graph_clear_links();
- platf_graph_interconnect_uniform(0.15); //Unrealistic, but simple
- XBT_INFO("done. Check connectivity...");
+ platf_graph_interconnect_uniform(0.07); //Unrealistic, but simple
+ XBT_INFO("done. Check connectedness...");
connected = platf_graph_is_connected();
XBT_INFO("Is it connected : %s", connected ? "yes" : (max_tries ? "no, retrying" : "no"));
} while(!connected && max_tries);
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/categorized' to '1'
$ cat simgrid.trace
-> %EventDef PajeDefineContainerType 0
-> % Alias string
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineVariableType 1
-> % Alias string
-> % Type string
-> % Name string
-> % Color color
-> %EndEventDef
-> %EventDef PajeDefineStateType 2
-> % Alias string
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineEventType 3
-> % Alias string
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineLinkType 4
-> % Alias string
-> % Type string
-> % StartContainerType string
-> % EndContainerType string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineEntityValue 5
-> % Alias string
-> % Type string
-> % Name string
-> % Color color
-> %EndEventDef
-> %EventDef PajeCreateContainer 6
-> % Time date
-> % Alias string
-> % Type string
-> % Container string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDestroyContainer 7
-> % Time date
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeSetVariable 8
-> % Time date
-> % Type string
-> % Container string
-> % Value double
+> %EventDef PajeDefineContainerType 0
+> % Alias string
+> % Type string
+> % Name string
> %EndEventDef
-> %EventDef PajeAddVariable 9
-> % Time date
-> % Type string
-> % Container string
-> % Value double
+> %EventDef PajeDefineVariableType 1
+> % Alias string
+> % Type string
+> % Name string
+> % Color string
> %EndEventDef
-> %EventDef PajeSubVariable 10
-> % Time date
-> % Type string
-> % Container string
-> % Value double
+> %EventDef PajeDefineStateType 2
+> % Alias string
+> % Type string
+> % Name string
> %EndEventDef
-> %EventDef PajeSetState 11
-> % Time date
-> % Type string
-> % Container string
-> % Value string
+> %EventDef PajeDefineEventType 3
+> % Alias string
+> % Type string
+> % Name string
> %EndEventDef
-> %EventDef PajePushState 12
-> % Time date
-> % Type string
-> % Container string
-> % Value string
+> %EventDef PajeDefineLinkType 4
+> % Alias string
+> % Type string
+> % StartContainerType string
+> % EndContainerType string
+> % Name string
> %EndEventDef
-> %EventDef PajePopState 13
-> % Time date
-> % Type string
-> % Container string
+> %EventDef PajeDefineEntityValue 5
+> % Alias string
+> % Type string
+> % Name string
+> % Color string
> %EndEventDef
-> %EventDef PajeResetState 14
-> % Time date
-> % Type string
-> % Container string
+> %EventDef PajeCreateContainer 6
+> % Time date
+> % Alias string
+> % Type string
+> % Container string
+> % Name string
> %EndEventDef
-> %EventDef PajeStartLink 15
-> % Time date
-> % Type string
-> % Container string
-> % Value string
-> % StartContainer string
-> % Key string
+> %EventDef PajeDestroyContainer 7
+> % Time date
+> % Type string
+> % Name string
> %EndEventDef
-> %EventDef PajeEndLink 16
-> % Time date
-> % Type string
-> % Container string
-> % Value string
-> % EndContainer string
-> % Key string
+> %EventDef PajeSetVariable 8
+> % Time date
+> % Type string
+> % Container string
+> % Value double
> %EndEventDef
-> %EventDef PajeNewEvent 17
-> % Time date
-> % Type string
-> % Container string
-> % Value string
+> %EventDef PajeAddVariable 9
+> % Time date
+> % Type string
+> % Container string
+> % Value double
+> %EndEventDef
+> %EventDef PajeSubVariable 10
+> % Time date
+> % Type string
+> % Container string
+> % Value double
+> %EndEventDef
+> %EventDef PajeSetState 11
+> % Time date
+> % Type string
+> % Container string
+> % Value string
+> %EndEventDef
+> %EventDef PajePushState 12
+> % Time date
+> % Type string
+> % Container string
+> % Value string
+> %EndEventDef
+> %EventDef PajePopState 13
+> % Time date
+> % Type string
+> % Container string
+> %EndEventDef
+> %EventDef PajeResetState 14
+> % Time date
+> % Type string
+> % Container string
+> %EndEventDef
+> %EventDef PajeStartLink 15
+> % Time date
+> % Type string
+> % Container string
+> % Value string
+> % StartContainer string
+> % Key string
+> %EndEventDef
+> %EventDef PajeEndLink 16
+> % Time date
+> % Type string
+> % Container string
+> % Value string
+> % EndContainer string
+> % Key string
+> %EndEventDef
+> %EventDef PajeNewEvent 17
+> % Time date
+> % Type string
+> % Container string
+> % Value string
> %EndEventDef
> 0 1 0 HOST
> 6 0 1 1 0 "Tremblay"
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'tracing/categorized' to '1'
$ cat simgrid.trace
-> %EventDef PajeDefineContainerType 0
-> % Alias string
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineVariableType 1
-> % Alias string
-> % Type string
-> % Name string
-> % Color color
-> %EndEventDef
-> %EventDef PajeDefineStateType 2
-> % Alias string
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineEventType 3
-> % Alias string
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineLinkType 4
-> % Alias string
-> % Type string
-> % StartContainerType string
-> % EndContainerType string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineEntityValue 5
-> % Alias string
-> % Type string
-> % Name string
-> % Color color
-> %EndEventDef
-> %EventDef PajeCreateContainer 6
-> % Time date
-> % Alias string
-> % Type string
-> % Container string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDestroyContainer 7
-> % Time date
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeSetVariable 8
-> % Time date
-> % Type string
-> % Container string
-> % Value double
+> %EventDef PajeDefineContainerType 0
+> % Alias string
+> % Type string
+> % Name string
+> %EndEventDef
+> %EventDef PajeDefineVariableType 1
+> % Alias string
+> % Type string
+> % Name string
+> % Color string
+> %EndEventDef
+> %EventDef PajeDefineStateType 2
+> % Alias string
+> % Type string
+> % Name string
+> %EndEventDef
+> %EventDef PajeDefineEventType 3
+> % Alias string
+> % Type string
+> % Name string
+> %EndEventDef
+> %EventDef PajeDefineLinkType 4
+> % Alias string
+> % Type string
+> % StartContainerType string
+> % EndContainerType string
+> % Name string
+> %EndEventDef
+> %EventDef PajeDefineEntityValue 5
+> % Alias string
+> % Type string
+> % Name string
+> % Color string
+> %EndEventDef
+> %EventDef PajeCreateContainer 6
+> % Time date
+> % Alias string
+> % Type string
+> % Container string
+> % Name string
+> %EndEventDef
+> %EventDef PajeDestroyContainer 7
+> % Time date
+> % Type string
+> % Name string
+> %EndEventDef
+> %EventDef PajeSetVariable 8
+> % Time date
+> % Type string
+> % Container string
+> % Value double
> %EndEventDef
-> %EventDef PajeAddVariable 9
-> % Time date
-> % Type string
-> % Container string
-> % Value double
+> %EventDef PajeAddVariable 9
+> % Time date
+> % Type string
+> % Container string
+> % Value double
> %EndEventDef
-> %EventDef PajeSubVariable 10
-> % Time date
-> % Type string
-> % Container string
-> % Value double
+> %EventDef PajeSubVariable 10
+> % Time date
+> % Type string
+> % Container string
+> % Value double
> %EndEventDef
-> %EventDef PajeSetState 11
-> % Time date
-> % Type string
-> % Container string
-> % Value string
+> %EventDef PajeSetState 11
+> % Time date
+> % Type string
+> % Container string
+> % Value string
> %EndEventDef
-> %EventDef PajePushState 12
-> % Time date
-> % Type string
-> % Container string
-> % Value string
+> %EventDef PajePushState 12
+> % Time date
+> % Type string
+> % Container string
+> % Value string
> %EndEventDef
-> %EventDef PajePopState 13
-> % Time date
-> % Type string
-> % Container string
+> %EventDef PajePopState 13
+> % Time date
+> % Type string
+> % Container string
> %EndEventDef
-> %EventDef PajeResetState 14
-> % Time date
-> % Type string
-> % Container string
+> %EventDef PajeResetState 14
+> % Time date
+> % Type string
+> % Container string
> %EndEventDef
-> %EventDef PajeStartLink 15
-> % Time date
-> % Type string
-> % Container string
-> % Value string
-> % StartContainer string
-> % Key string
+> %EventDef PajeStartLink 15
+> % Time date
+> % Type string
+> % Container string
+> % Value string
+> % StartContainer string
+> % Key string
> %EndEventDef
-> %EventDef PajeEndLink 16
-> % Time date
-> % Type string
-> % Container string
-> % Value string
-> % EndContainer string
-> % Key string
+> %EventDef PajeEndLink 16
+> % Time date
+> % Type string
+> % Container string
+> % Value string
+> % EndContainer string
+> % Key string
> %EndEventDef
-> %EventDef PajeNewEvent 17
-> % Time date
-> % Type string
-> % Container string
-> % Value string
+> %EventDef PajeNewEvent 17
+> % Time date
+> % Type string
+> % Container string
+> % Value string
> %EndEventDef
> 0 1 0 L1
> 6 0 1 1 0 "AS_interne"
+<!-- This platform was automatically converted from the OptorSim platform.
+
+ As such, it only contains information of the cluster interconnexion,
+ not on the caracteristics of each cluster. In a sense, it describes
+ the network of a National Research and Education Network (NREN), but
+ not of a computational platform.
+
+ We hope that you find it useful anyway. I you know how to complete
+ this information with data on the cluster configurations, please
+ drop us a mail so that we can add this information. -->
+
<?xml version='1.0'?>
<!DOCTYPE platform SYSTEM "http://simgrid.gforge.inria.fr/simgrid.dtd">
<platform version="3">
> [30.800300] [sd_seq_access/INFO] There is no task running on C2-06
$ cat ./simgrid.trace
-> %EventDef PajeDefineContainerType 0
-> % Alias string
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineVariableType 1
-> % Alias string
-> % Type string
-> % Name string
-> % Color color
-> %EndEventDef
-> %EventDef PajeDefineStateType 2
-> % Alias string
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineEventType 3
-> % Alias string
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineLinkType 4
-> % Alias string
-> % Type string
-> % StartContainerType string
-> % EndContainerType string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDefineEntityValue 5
-> % Alias string
-> % Type string
-> % Name string
-> % Color color
-> %EndEventDef
-> %EventDef PajeCreateContainer 6
-> % Time date
-> % Alias string
-> % Type string
-> % Container string
-> % Name string
-> %EndEventDef
-> %EventDef PajeDestroyContainer 7
-> % Time date
-> % Type string
-> % Name string
-> %EndEventDef
-> %EventDef PajeSetVariable 8
-> % Time date
-> % Type string
-> % Container string
-> % Value double
+> %EventDef PajeDefineContainerType 0
+> % Alias string
+> % Type string
+> % Name string
> %EndEventDef
-> %EventDef PajeAddVariable 9
-> % Time date
-> % Type string
-> % Container string
-> % Value double
+> %EventDef PajeDefineVariableType 1
+> % Alias string
+> % Type string
+> % Name string
+> % Color string
> %EndEventDef
-> %EventDef PajeSubVariable 10
-> % Time date
-> % Type string
-> % Container string
-> % Value double
+> %EventDef PajeDefineStateType 2
+> % Alias string
+> % Type string
+> % Name string
> %EndEventDef
-> %EventDef PajeSetState 11
-> % Time date
-> % Type string
-> % Container string
-> % Value string
+> %EventDef PajeDefineEventType 3
+> % Alias string
+> % Type string
+> % Name string
> %EndEventDef
-> %EventDef PajePushState 12
-> % Time date
-> % Type string
-> % Container string
-> % Value string
+> %EventDef PajeDefineLinkType 4
+> % Alias string
+> % Type string
+> % StartContainerType string
+> % EndContainerType string
+> % Name string
> %EndEventDef
-> %EventDef PajePopState 13
-> % Time date
-> % Type string
-> % Container string
+> %EventDef PajeDefineEntityValue 5
+> % Alias string
+> % Type string
+> % Name string
+> % Color string
> %EndEventDef
-> %EventDef PajeResetState 14
-> % Time date
-> % Type string
-> % Container string
+> %EventDef PajeCreateContainer 6
+> % Time date
+> % Alias string
+> % Type string
+> % Container string
+> % Name string
> %EndEventDef
-> %EventDef PajeStartLink 15
-> % Time date
-> % Type string
-> % Container string
-> % Value string
-> % StartContainer string
-> % Key string
+> %EventDef PajeDestroyContainer 7
+> % Time date
+> % Type string
+> % Name string
> %EndEventDef
-> %EventDef PajeEndLink 16
-> % Time date
-> % Type string
-> % Container string
-> % Value string
-> % EndContainer string
-> % Key string
+> %EventDef PajeSetVariable 8
+> % Time date
+> % Type string
+> % Container string
+> % Value double
> %EndEventDef
-> %EventDef PajeNewEvent 17
-> % Time date
-> % Type string
-> % Container string
-> % Value string
+> %EventDef PajeAddVariable 9
+> % Time date
+> % Type string
+> % Container string
+> % Value double
+> %EndEventDef
+> %EventDef PajeSubVariable 10
+> % Time date
+> % Type string
+> % Container string
+> % Value double
+> %EndEventDef
+> %EventDef PajeSetState 11
+> % Time date
+> % Type string
+> % Container string
+> % Value string
+> %EndEventDef
+> %EventDef PajePushState 12
+> % Time date
+> % Type string
+> % Container string
+> % Value string
+> %EndEventDef
+> %EventDef PajePopState 13
+> % Time date
+> % Type string
+> % Container string
+> %EndEventDef
+> %EventDef PajeResetState 14
+> % Time date
+> % Type string
+> % Container string
+> %EndEventDef
+> %EventDef PajeStartLink 15
+> % Time date
+> % Type string
+> % Container string
+> % Value string
+> % StartContainer string
+> % Key string
+> %EndEventDef
+> %EventDef PajeEndLink 16
+> % Time date
+> % Type string
+> % Container string
+> % Value string
+> % EndContainer string
+> % Key string
+> %EndEventDef
+> %EventDef PajeNewEvent 17
+> % Time date
+> % Type string
+> % Container string
+> % Value string
> %EndEventDef
> 0 1 0 HOST
> 6 0 1 1 0 "C2-06"
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'triva/categorized' to 'smpi_cat.plist'
> [0.000000] [xbt_cfg/INFO] Configuration change: Set 'triva/uncategorized' to 'smpi_uncat.plist'
> [0.000000] [surf_config/INFO] Switching workstation model to compound since you changed the network and/or cpu model(s)
-> [1.003981] [instr_config/INFO] No categories declared, ignoring generation of triva graph configuration
+> [0.013981] [instr_config/INFO] No categories declared, ignoring generation of triva graph configuration
p Testing with parameters but without activating them with the safe switch (-trace)
$ ../../bin/smpirun -trace-resource -trace-triva -trace-file smpi_traced.trace -hostfile ${srcdir:=.}/hostfile -platform ${srcdir:=.}/../msg/tracing/platform.xml -np 3 ./smpi_traced_simple
XBT_PUBLIC(sg_routing_edge_t) sg_routing_edge_by_name_or_null(const char *name);
-
-
-typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
-
-/** opaque structure defining a event generator for availability based on a probability distribution */
-typedef struct probabilist_event_generator *probabilist_event_generator_t;
-
-XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_file(const char *filename);
-XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id,
- const char *input,
- double periodicity);
-XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_generator(const char *id,
- probabilist_event_generator_t generator1,
- probabilist_event_generator_t generator2,
- int is_state_trace);
-
-XBT_PUBLIC(probabilist_event_generator_t) tmgr_event_generator_new_uniform(const char* id,
- double min,
- double max);
-XBT_PUBLIC(probabilist_event_generator_t) tmgr_event_generator_new_exponential(const char* id,
- double rate);
-XBT_PUBLIC(probabilist_event_generator_t) tmgr_event_generator_new_weibull(const char* id,
- double scale,
- double shape);
-
/** Defines whether a given resource is working or not */
typedef enum {
SURF_RESOURCE_ON = 1, /**< Up & ready */
SURF_PROCESS_ON_FAILURE_RESTART = 0
} e_surf_process_on_failure_t;
+
+typedef struct tmgr_trace *tmgr_trace_t; /**< Opaque structure defining an availability trace */
+
+/** opaque structure defining a event generator for availability based on a probability distribution */
+typedef struct probabilist_event_generator *probabilist_event_generator_t;
+
+XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_file(const char *filename);
+XBT_PUBLIC(tmgr_trace_t) tmgr_trace_new_from_string(const char *id,
+ const char *input,
+ double periodicity);
+
+XBT_PUBLIC(tmgr_trace_t) tmgr_trace_generator_value(const char *id,
+ probabilist_event_generator_t date_generator,
+ probabilist_event_generator_t value_generator);
+XBT_PUBLIC(tmgr_trace_t) tmgr_trace_generator_state(const char *id,
+ probabilist_event_generator_t date_generator,
+ e_surf_resource_state_t first_event_value);
+XBT_PUBLIC(tmgr_trace_t) tmgr_trace_generator_avail_unavail(const char *id,
+ probabilist_event_generator_t avail_duration_generator,
+ probabilist_event_generator_t unavail_duration_generator,
+ e_surf_resource_state_t first_event_value);
+
+XBT_PUBLIC(probabilist_event_generator_t) tmgr_event_generator_new_uniform(const char* id,
+ double min,
+ double max);
+XBT_PUBLIC(probabilist_event_generator_t) tmgr_event_generator_new_exponential(const char* id,
+ double rate);
+XBT_PUBLIC(probabilist_event_generator_t) tmgr_event_generator_new_weibull(const char* id,
+ double scale,
+ double shape);
+
/*
* Platform creation functions. Instead of passing 123 arguments to the creation functions
* (one for each possible XML attribute), we pass structures containing them all. It removes the
#define OPT_TRACING_BUFFER "tracing/buffer"
#define OPT_TRACING_ONELINK_ONLY "tracing/onelink_only"
#define OPT_TRACING_DISABLE_DESTROY "tracing/disable_destroy"
+#define OPT_TRACING_BASIC "tracing/basic"
#define OPT_TRIVA_UNCAT_CONF "triva/uncategorized"
#define OPT_TRIVA_CAT_CONF "triva/categorized"
#define OPT_VIVA_UNCAT_CONF "viva/uncategorized"
static int trace_buffer;
static int trace_onelink_only;
static int trace_disable_destroy;
+static int trace_basic;
static int trace_configured = 0;
static int trace_active = 0;
trace_buffer = xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_BUFFER);
trace_onelink_only = xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_ONELINK_ONLY);
trace_disable_destroy = xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_DISABLE_DESTROY);
+ trace_basic = xbt_cfg_get_int(_surf_cfg_set, OPT_TRACING_BASIC);
}
int TRACE_start()
return trace_disable_destroy && TRACE_is_enabled();
}
+int TRACE_basic (void)
+{
+ return trace_basic && TRACE_is_enabled();
+}
+
+
char *TRACE_get_filename(void)
{
return xbt_cfg_get_string(_surf_cfg_set, OPT_TRACING_FILENAME);
xbt_cfgelm_int, &default_disable_destroy, 0, 1,
NULL, NULL);
+ /* basic -- Avoid extended events (impoverished trace file) */
+ int default_basic = 0;
+ xbt_cfg_register(&_surf_cfg_set, OPT_TRACING_BASIC,
+ "Avoid extended events (impoverished trace file).",
+ xbt_cfgelm_int, &default_basic, 0, 1,
+ NULL, NULL);
+
/* Triva graph configuration for uncategorized tracing */
char *default_triva_uncat_conf_file = xbt_strdup ("");
xbt_cfg_register(&_surf_cfg_set, OPT_TRIVA_UNCAT_CONF,
" used with simulators that have a different notion of time (different from\n"
" the simulated time).",
detailed);
+ print_line (OPT_TRACING_BASIC, "Avoid extended events (impoverished trace file).",
+ " Some visualization tools are not able to parse correctly the Paje file format.\n"
+ " Use this option if you are using one of these tools to visualize the simulation\n"
+ " trace. Keep in mind that the trace might be incomplete, without all the\n"
+ " information that would be registered otherwise.",
+ detailed);
print_line (OPT_TRIVA_UNCAT_CONF, "Generate graph configuration for Triva",
" This option can be used in all types of simulators build with SimGrid\n"
" to generate a uncategorized resource utilization graph to be used as\n"
--- /dev/null
+/* Copyright (c) 2010. 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 "instr/instr_private.h"
+
+#ifdef HAVE_TRACING
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_header, instr, "Paje tracing event system (header)");
+
+extern FILE *tracing_file;
+
+static void TRACE_header_PajeDefineContainerType (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeDefineContainerType %d\n", PAJE_DefineContainerType);
+ fprintf(tracing_file, "%% Alias string\n");
+ if (basic){
+ fprintf(tracing_file, "%% ContainerType string\n");
+ }else{
+ fprintf(tracing_file, "%% Type string\n");
+ }
+ fprintf(tracing_file, "%% Name string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeDefineVariableType (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeDefineVariableType %d\n", PAJE_DefineVariableType);
+ fprintf(tracing_file, "%% Alias string\n");
+ if (basic){
+ fprintf(tracing_file, "%% ContainerType string\n");
+ }else{
+ fprintf(tracing_file, "%% Type string\n");
+ }
+ fprintf(tracing_file, "%% Name string\n");
+ fprintf(tracing_file, "%% Color string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeDefineStateType (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeDefineStateType %d\n", PAJE_DefineStateType);
+ fprintf(tracing_file, "%% Alias string\n");
+ if (basic){
+ fprintf(tracing_file, "%% ContainerType string\n");
+ }else{
+ fprintf(tracing_file, "%% Type string\n");
+ }
+ fprintf(tracing_file, "%% Name string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeDefineEventType (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeDefineEventType %d\n", PAJE_DefineEventType);
+ fprintf(tracing_file, "%% Alias string\n");
+ if (basic){
+ fprintf(tracing_file, "%% ContainerType string\n");
+ }else{
+ fprintf(tracing_file, "%% Type string\n");
+ }
+ fprintf(tracing_file, "%% Name string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeDefineLinkType (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeDefineLinkType %d\n", PAJE_DefineLinkType);
+ fprintf(tracing_file, "%% Alias string\n");
+ if (basic){
+ fprintf(tracing_file, "%% ContainerType string\n");
+ fprintf(tracing_file, "%% SourceContainerType string\n");
+ fprintf(tracing_file, "%% DestContainerType string\n");
+ }else{
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% StartContainerType string\n");
+ fprintf(tracing_file, "%% EndContainerType string\n");
+ }
+ fprintf(tracing_file, "%% Name string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeDefineEntityValue (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeDefineEntityValue %d\n", PAJE_DefineEntityValue);
+ fprintf(tracing_file, "%% Alias string\n");
+ if (basic){
+ fprintf(tracing_file, "%% EntityType string\n");
+ }else{
+ fprintf(tracing_file, "%% Type string\n");
+ }
+ fprintf(tracing_file, "%% Name string\n");
+ fprintf(tracing_file, "%% Color string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeCreateContainer (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeCreateContainer %d\n", PAJE_CreateContainer);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Alias string\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%% Name string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeDestroyContainer (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeDestroyContainer %d\n", PAJE_DestroyContainer);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Name string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeSetVariable (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeSetVariable %d\n", PAJE_SetVariable);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%% Value double\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeAddVariable (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeAddVariable %d\n", PAJE_AddVariable);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%% Value double\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeSubVariable (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeSubVariable %d\n", PAJE_SubVariable);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%% Value double\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+
+static void TRACE_header_PajeSetState (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeSetState %d\n", PAJE_SetState);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%% Value string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajePushState (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajePushState %d\n", PAJE_PushState);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%% Value string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajePopState (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajePopState %d\n", PAJE_PopState);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeResetState (int basic)
+{
+ if (basic) return;
+
+ fprintf(tracing_file, "%%EventDef PajeResetState %d\n", PAJE_ResetState);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeStartLink (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeStartLink %d\n", PAJE_StartLink);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%% Value string\n");
+ if (basic){
+ fprintf(tracing_file, "%% SourceContainer string\n");
+ }else{
+ fprintf(tracing_file, "%% StartContainer string\n");
+ }
+ fprintf(tracing_file, "%% Key string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeEndLink (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeEndLink %d\n", PAJE_EndLink);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%% Value string\n");
+ if (basic){
+ fprintf(tracing_file, "%% DestContainer string\n");
+ }else{
+ fprintf(tracing_file, "%% EndContainer string\n");
+ }
+ fprintf(tracing_file, "%% Key string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+static void TRACE_header_PajeNewEvent (int basic)
+{
+ fprintf(tracing_file, "%%EventDef PajeNewEvent %d\n", PAJE_NewEvent);
+ fprintf(tracing_file, "%% Time date\n");
+ fprintf(tracing_file, "%% Type string\n");
+ fprintf(tracing_file, "%% Container string\n");
+ fprintf(tracing_file, "%% Value string\n");
+ fprintf(tracing_file, "%%EndEventDef\n");
+}
+
+void TRACE_header(int basic)
+{
+ XBT_DEBUG ("Define paje header");
+ TRACE_header_PajeDefineContainerType (basic);
+ TRACE_header_PajeDefineVariableType (basic);
+ TRACE_header_PajeDefineStateType (basic);
+ TRACE_header_PajeDefineEventType (basic);
+ TRACE_header_PajeDefineLinkType (basic);
+ TRACE_header_PajeDefineEntityValue (basic);
+ TRACE_header_PajeCreateContainer (basic);
+ TRACE_header_PajeDestroyContainer (basic);
+ TRACE_header_PajeSetVariable (basic);
+ TRACE_header_PajeAddVariable (basic);
+ TRACE_header_PajeSubVariable (basic);
+ TRACE_header_PajeSetState (basic);
+ TRACE_header_PajePushState (basic);
+ TRACE_header_PajePopState (basic);
+ TRACE_header_PajeResetState (basic);
+ TRACE_header_PajeStartLink (basic);
+ TRACE_header_PajeEndLink (basic);
+ TRACE_header_PajeNewEvent (basic);
+}
+
+#endif
+
+
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(instr_paje_trace, instr, "Paje tracing event system");
-typedef enum {
- PAJE_DefineContainerType,
- PAJE_DefineVariableType,
- PAJE_DefineStateType,
- PAJE_DefineEventType,
- PAJE_DefineLinkType,
- PAJE_DefineEntityValue,
- PAJE_CreateContainer,
- PAJE_DestroyContainer,
- PAJE_SetVariable,
- PAJE_AddVariable,
- PAJE_SubVariable,
- PAJE_SetState,
- PAJE_PushState,
- PAJE_PopState,
- PAJE_ResetState,
- PAJE_StartLink,
- PAJE_EndLink,
- PAJE_NewEvent
-} e_event_type;
-
typedef struct paje_event *paje_event_t;
typedef struct paje_event {
double timestamp;
val_t value;
}s_newEvent_t;
-static FILE *tracing_file = NULL;
+FILE *tracing_file = NULL;
static xbt_dynar_t buffer = NULL;
XBT_DEBUG("Filename %s is open for writing", filename);
/* output header */
- TRACE_paje_create_header();
+ TRACE_header(TRACE_basic());
buffer = xbt_dynar_new (sizeof(paje_event_t), NULL);
}
XBT_DEBUG("%s: ends", __FUNCTION__);
}
-void TRACE_paje_create_header(void)
-{
- XBT_DEBUG ("Define paje header");
- fprintf(tracing_file, "\
-%%EventDef PajeDefineContainerType %d \n\
-%% Alias string \n\
-%% Type string \n\
-%% Name string \n\
-%%EndEventDef \n\
-%%EventDef PajeDefineVariableType %d \n\
-%% Alias string \n\
-%% Type string \n\
-%% Name string \n\
-%% Color color \n\
-%%EndEventDef \n\
-%%EventDef PajeDefineStateType %d \n\
-%% Alias string \n\
-%% Type string \n\
-%% Name string \n\
-%%EndEventDef \n\
-%%EventDef PajeDefineEventType %d \n\
-%% Alias string \n\
-%% Type string \n\
-%% Name string \n\
-%%EndEventDef \n\
-%%EventDef PajeDefineLinkType %d \n\
-%% Alias string \n\
-%% Type string \n\
-%% StartContainerType string \n\
-%% EndContainerType string \n\
-%% Name string \n\
-%%EndEventDef \n\
-%%EventDef PajeDefineEntityValue %d \n\
-%% Alias string \n\
-%% Type string \n\
-%% Name string \n\
-%% Color color \n\
-%%EndEventDef \n\
-%%EventDef PajeCreateContainer %d \n\
-%% Time date \n\
-%% Alias string \n\
-%% Type string \n\
-%% Container string \n\
-%% Name string \n\
-%%EndEventDef \n\
-%%EventDef PajeDestroyContainer %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Name string \n\
-%%EndEventDef \n\
-%%EventDef PajeSetVariable %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Container string \n\
-%% Value double \n\
-%%EndEventDef\n\
-%%EventDef PajeAddVariable %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Container string \n\
-%% Value double \n\
-%%EndEventDef\n\
-%%EventDef PajeSubVariable %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Container string \n\
-%% Value double \n\
-%%EndEventDef\n\
-%%EventDef PajeSetState %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Container string \n\
-%% Value string \n\
-%%EndEventDef\n\
-%%EventDef PajePushState %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Container string \n\
-%% Value string \n\
-%%EndEventDef\n\
-%%EventDef PajePopState %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Container string \n\
-%%EndEventDef\n\
-%%EventDef PajeResetState %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Container string \n\
-%%EndEventDef\n\
-%%EventDef PajeStartLink %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Container string \n\
-%% Value string \n\
-%% StartContainer string \n\
-%% Key string \n\
-%%EndEventDef\n\
-%%EventDef PajeEndLink %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Container string \n\
-%% Value string \n\
-%% EndContainer string \n\
-%% Key string \n\
-%%EndEventDef\n\
-%%EventDef PajeNewEvent %d \n\
-%% Time date \n\
-%% Type string \n\
-%% Container string \n\
-%% Value string \n\
-%%EndEventDef\n",
- PAJE_DefineContainerType,
- PAJE_DefineVariableType,
- PAJE_DefineStateType,
- PAJE_DefineEventType,
- PAJE_DefineLinkType,
- PAJE_DefineEntityValue,
- PAJE_CreateContainer,
- PAJE_DestroyContainer,
- PAJE_SetVariable,
- PAJE_AddVariable,
- PAJE_SubVariable,
- PAJE_SetState,
- PAJE_PushState,
- PAJE_PopState,
- PAJE_ResetState,
- PAJE_StartLink,
- PAJE_EndLink,
- PAJE_NewEvent);
-}
-
/* internal do the instrumentation module */
static void insert_into_buffer (paje_event_t tbi)
{
#include "simix/smx_private.h"
#include "xbt/graph_private.h"
+typedef enum {
+ PAJE_DefineContainerType,
+ PAJE_DefineVariableType,
+ PAJE_DefineStateType,
+ PAJE_DefineEventType,
+ PAJE_DefineLinkType,
+ PAJE_DefineEntityValue,
+ PAJE_CreateContainer,
+ PAJE_DestroyContainer,
+ PAJE_SetVariable,
+ PAJE_AddVariable,
+ PAJE_SubVariable,
+ PAJE_SetState,
+ PAJE_PushState,
+ PAJE_PopState,
+ PAJE_ResetState,
+ PAJE_StartLink,
+ PAJE_EndLink,
+ PAJE_NewEvent
+} e_event_type;
+
typedef enum {
TYPE_VARIABLE,
TYPE_LINK,
extern xbt_dict_t user_link_variables;
extern double TRACE_last_timestamp_to_dump;
+/* instr_paje_header.c */
+void TRACE_header(int basic);
+
/* from paje.c */
-void TRACE_paje_create_header(void);
void TRACE_paje_start(void);
void TRACE_paje_end(void);
void TRACE_paje_dump_buffer (int force);
int TRACE_buffer (void);
int TRACE_onelink_only (void);
int TRACE_disable_destroy (void);
+int TRACE_basic (void);
char *TRACE_get_filename(void);
char *TRACE_get_triva_uncat_conf (void);
char *TRACE_get_triva_cat_conf (void);
static xbt_dict_t keys;
static const char *smpi_colors[] ={
- "recv", "255 000 000",
- "irecv", "255 135 135",
- "send", "000 000 255",
- "isend", "135 135 255",
- "sendrecv", "000 255 255",
- "wait", "255 255 000",
- "waitall", "200 200 000",
- "waitany", "200 200 150",
-
- "allgather", "255 000 000",
- "allgatherv", "255 135 135",
- "allreduce", "255 000 255",
- "alltoall", "135 000 255",
- "alltoallv", "200 135 255",
- "barrier", "000 200 200",
- "bcast", "000 200 100",
- "gather", "255 255 000",
- "gatherv", "255 255 135",
- "reduce", "000 255 000",
- "reducescatter", "135 255 135",
- "scan", "255 150 060",
- "scatterv", "135 000 135",
- "scatter", "255 190 140",
+ "recv", "1 0 0",
+ "irecv", "1 0.52 0.52",
+ "send", "0 0 1",
+ "isend", "0.52 0.52 1",
+ "sendrecv", "0 1 1",
+ "wait", "1 1 0",
+ "waitall", "0.78 0.78 0",
+ "waitany", "0.78 0.78 0.58",
+
+ "allgather", "1 0 0",
+ "allgatherv", "1 0.52 0.52",
+ "allreduce", "1 0 1",
+ "alltoall", "0.52 0 1",
+ "alltoallv", "0.78 0.52 1",
+ "barrier", "0 0.78 0.78",
+ "bcast", "0 0.78 0.39",
+ "gather", "1 1 0",
+ "gatherv", "1 1 0.52",
+ "reduce", "0 1 0",
+ "reducescatter", "0.52 1 0.52",
+ "scan", "1 0.58 0.23",
+ "scatterv", "0.52 0 0.52",
+ "scatter", "1 0.74 0.54",
NULL, NULL,
};
simcall->call = SIMCALL_HOST_GET_BY_NAME;
simcall->host_get_by_name.name = name;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->host_get_by_name.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_get_by_name.result;
}
simcall->call = SIMCALL_HOST_GET_NAME;
simcall->host_get_name.host = host;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->host_get_name.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_get_name.result;
}
simcall->call = SIMCALL_HOST_GET_PROPERTIES;
simcall->host_get_properties.host = host;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->host_get_properties.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_get_properties.result;
}
simcall->call = SIMCALL_HOST_GET_SPEED;
simcall->host_get_speed.host = host;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->host_get_speed.result = 0.0;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_get_speed.result;
}
simcall->call = SIMCALL_HOST_GET_AVAILABLE_SPEED;
simcall->host_get_available_speed.host = host;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->host_get_available_speed.result = 0.0;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_get_available_speed.result;
}
simcall->call = SIMCALL_HOST_GET_STATE;
simcall->host_get_state.host = host;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->host_get_state.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_get_state.result;
}
simcall->call = SIMCALL_HOST_GET_DATA;
simcall->host_get_data.host = host;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->host_get_data.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_get_data.result;
}
simcall->host_execute.host = host;
simcall->host_execute.computation_amount = computation_amount;
simcall->host_execute.priority = priority;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->host_execute.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_execute.result;
}
simcall->host_parallel_execute.communication_amount = communication_amount;
simcall->host_parallel_execute.amount = amount;
simcall->host_parallel_execute.rate = rate;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->host_parallel_execute.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_parallel_execute.result;
}
simcall->call = SIMCALL_HOST_EXECUTION_GET_REMAINS;
simcall->host_execution_get_remains.execution = execution;
+ if(MC_IS_ENABLED) /* Initializeialize result to a default value for snapshot comparison done during simcall */
+ simcall->host_execution_get_remains.result = 0.0;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_execution_get_remains.result;
}
simcall->call = SIMCALL_HOST_EXECUTION_GET_STATE;
simcall->host_execution_get_state.execution = execution;
+ simcall->host_execution_get_state.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_execution_get_state.result;
}
simcall->call = SIMCALL_HOST_EXECUTION_WAIT;
simcall->host_execution_wait.execution = execution;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->host_execution_wait.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->host_execution_wait.result;
}
smx_simcall_t simcall = SIMIX_simcall_mine();
simcall->call = SIMCALL_PROCESS_COUNT;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->process_count.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->process_count.result;
}
simcall->call = SIMCALL_PROCESS_GET_DATA;
simcall->process_get_data.process = process;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->process_get_data.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->process_get_data.result;
}
simcall->call = SIMCALL_PROCESS_GET_HOST;
simcall->process_get_host.process = process;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->process_get_host.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->process_get_host.result;
}
simcall->call = SIMCALL_PROCESS_GET_NAME;
simcall->process_get_name.process = process;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->process_get_name.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->process_get_name.result;
}
simcall->call = SIMCALL_PROCESS_IS_SUSPENDED;
simcall->process_is_suspended.process = process;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->process_is_suspended.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->process_is_suspended.result;
}
simcall->call = SIMCALL_PROCESS_GET_PROPERTIES;
simcall->process_get_properties.process = process;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->process_get_properties.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->process_get_properties.result;
}
simcall->call = SIMCALL_PROCESS_RESTART;
simcall->process_restart.process = process;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->process_restart.result = NULL;
SIMIX_simcall_push(simcall->issuer);
simcall->call = SIMCALL_PROCESS_SLEEP;
simcall->process_sleep.duration = duration;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->process_sleep.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->process_sleep.result;
}
simcall->call = SIMCALL_RDV_CREATE;
simcall->rdv_create.name = name;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->rdv_create.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->rdv_create.result;
simcall->call = SIMCALL_RDV_COMM_COUNT_BY_HOST;
simcall->rdv_comm_count_by_host.rdv = rdv;
simcall->rdv_comm_count_by_host.host = host;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->rdv_comm_count_by_host.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->rdv_comm_count_by_host.result;
simcall->call = SIMCALL_RDV_GET_HEAD;
simcall->rdv_get_head.rdv = rdv;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->rdv_get_head.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->rdv_get_head.result;
simcall->call = SIMCALL_RDV_GET_RECV;
simcall->rdv_get_rcv_proc.rdv = rdv;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->rdv_get_rcv_proc.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->rdv_get_rcv_proc.result;
simcall->comm_isend.clean_fun = clean_fun;
simcall->comm_isend.data = data;
simcall->comm_isend.detached = detached;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->comm_isend.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_isend.result;
simcall->comm_irecv.dst_buff_size = dst_buff_size;
simcall->comm_irecv.match_fun = match_fun;
simcall->comm_irecv.data = data;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->comm_irecv.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_irecv.result;
simcall->call = SIMCALL_COMM_WAITANY;
simcall->comm_waitany.comms = comms;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->comm_waitany.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_waitany.result;
simcall->call = SIMCALL_COMM_TESTANY;
simcall->comm_testany.comms = comms;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->comm_testany.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_testany.result;
simcall->call = SIMCALL_COMM_TEST;
simcall->comm_test.comm = comm;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->comm_test.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_test.result;
simcall->call = SIMCALL_COMM_GET_REMAINS;
simcall->comm_get_remains.comm = comm;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->comm_get_remains.result = 0.0;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_get_remains.result;
simcall->call = SIMCALL_COMM_GET_STATE;
simcall->comm_get_state.comm = comm;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->comm_get_state.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_get_state.result;
simcall->call = SIMCALL_COMM_GET_SRC_DATA;
simcall->comm_get_src_data.comm = comm;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->comm_get_src_data.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_get_src_data.result;
simcall->call = SIMCALL_COMM_GET_DST_DATA;
simcall->comm_get_dst_data.comm = comm;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->comm_get_dst_data.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_get_dst_data.result;
simcall->call = SIMCALL_COMM_GET_SRC_PROC;
simcall->comm_get_src_proc.comm = comm;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->comm_get_src_proc.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_get_src_proc.result;
simcall->call = SIMCALL_COMM_GET_DST_PROC;
simcall->comm_get_dst_proc.comm = comm;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->comm_get_dst_proc.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_get_dst_proc.result;
simcall->call = SIMCALL_COMM_IS_LATENCY_BOUNDED;
simcall->comm_is_latency_bounded.comm = comm;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->comm_is_latency_bounded.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->comm_is_latency_bounded.result;
smx_simcall_t simcall = SIMIX_simcall_mine();
simcall->call = SIMCALL_MUTEX_INIT;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->mutex_init.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->mutex_init.result;
simcall->call = SIMCALL_MUTEX_TRYLOCK;
simcall->mutex_trylock.mutex = mutex;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->mutex_trylock.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->mutex_trylock.result;
smx_simcall_t simcall = SIMIX_simcall_mine();
simcall->call = SIMCALL_COND_INIT;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->cond_init.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->cond_init.result;
simcall->call = SIMCALL_SEM_INIT;
simcall->sem_init.capacity = capacity;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->sem_init.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->sem_init.result;
simcall->call = SIMCALL_SEM_WOULD_BLOCK;
simcall->sem_would_block.sem = sem;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->sem_would_block.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->sem_would_block.result;
simcall->call = SIMCALL_SEM_GET_CAPACITY;
simcall->sem_get_capacity.sem = sem;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->sem_get_capacity.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->sem_get_capacity.result;
simcall->file_read.size = size;
simcall->file_read.nmemb = nmemb;
simcall->file_read.stream = stream;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->file_read.result = 0.0;
SIMIX_simcall_push(simcall->issuer);
return simcall->file_read.result;
simcall->file_write.size = size;
simcall->file_write.nmemb = nmemb;
simcall->file_write.stream = stream;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->file_write.result = 0;
SIMIX_simcall_push(simcall->issuer);
return simcall->file_write.result;
simcall->file_open.mount = mount;
simcall->file_open.path = path;
simcall->file_open.mode = mode;
+ if(MC_IS_ENABLED) /* Initialize result to NULL for snapshot comparison done during simcall */
+ simcall->file_open.result = NULL;
SIMIX_simcall_push(simcall->issuer);
return simcall->file_open.result;
simcall->call = SIMCALL_FILE_CLOSE;
simcall->file_close.fp = fp;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->file_close.result = -1;
SIMIX_simcall_push(simcall->issuer);
return simcall->file_close.result;
smx_simcall_t simcall = SIMIX_simcall_mine();
simcall->call = SIMCALL_FILE_STAT;
simcall->file_stat.fd = fd;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->file_stat.result = -1;
SIMIX_simcall_push(simcall->issuer);
smx_simcall_t simcall = SIMIX_simcall_mine();
simcall->call = SIMCALL_FILE_UNLINK;
simcall->file_unlink.fd = fd;
+ if(MC_IS_ENABLED) /* Initialize result to a default value for snapshot comparison done during simcall */
+ simcall->file_unlink.result = -1;
SIMIX_simcall_push(simcall->issuer);
make_elem_inactive(elem);
elem_list = &(cnst->element_set);
xbt_swag_foreach(elem, elem_list) {
-// make_elem_active(elem);
if (elem->variable->weight <= 0 || elem->variable->value > 0)
break;
if (elem->value > 0)
void platf_graph_clear_links(void) {
xbt_dynar_t dynar_nodes = NULL;
xbt_dynar_t dynar_edges = NULL;
+ xbt_dynar_t dynar_edges_cpy = NULL;
xbt_node_t graph_node = NULL;
xbt_edge_t graph_edge = NULL;
context_node_t node_data = NULL;
unsigned int i;
- //Delete edges from the graph
+ //The graph edge dynar will be modified directly, so we work on a copy of it
dynar_edges = xbt_graph_get_edges(platform_graph);
+ dynar_edges_cpy = xbt_dynar_new(sizeof(xbt_edge_t), NULL);
xbt_dynar_foreach(dynar_edges, i, graph_edge) {
+ xbt_dynar_push_as(dynar_edges_cpy, xbt_edge_t, graph_edge);
+ }
+ //Delete edges from the graph
+ xbt_dynar_foreach(dynar_edges_cpy, i, graph_edge) {
xbt_graph_free_edge(platform_graph, graph_edge, xbt_free);
}
+ //remove the dynar copy
+ xbt_dynar_free(&dynar_edges_cpy);
//All the nodes will be of degree 0, unchecked from connectedness
dynar_nodes = xbt_graph_get_nodes(platform_graph);
sg_platf_new_cluster(cluster_parameters);
break;
case ROUTER:
- router_parameters.id = bprintf("router-%d", ++last_router);
+ node_data->router_id = bprintf("router-%d", ++last_router);
+ router_parameters.id = node_data->router_id;
sg_platf_new_router(&router_parameters);
}
}
src_ctn = xbt_lib_get_or_null(as_router_lib, tmp_src_name, COORD_ASR_LEVEL);
}
else{
- xbt_die(" ");
+ THROW_IMPOSSIBLE;
}
if(dst_p->rc_type == SURF_NETWORK_ELEMENT_HOST){
dst_ctn = xbt_lib_get_or_null(as_router_lib, tmp_dst_name, COORD_ASR_LEVEL);
}
else{
- xbt_die(" ");
+ THROW_IMPOSSIBLE;
}
xbt_assert(src_ctn,"No coordinate found for element '%s'",tmp_src_name);
* \brief Create a #tmgr_trace_t from probabilist generators
*
* This trace will generate an infinite set of events.
- * It needs two #probabilist_event_generator_t. For regular events, the first one is
- * used as a date generator, the second as a value generator. For a state trace, the
- * event values are 0 or 1. The first generator rules the time between state changes.
- * If the second generator is set, it is used to set the duration of unavailability,
- * while the first one set the duration of availability.
+ * It needs two #probabilist_event_generator_t. The date when the event are
+ * triggered is directed by date_generator, and will be interpreted as seconds.
+ * The value of the event is set by value_generator. The value should be between
+ * 0 and 1.
*
* \param id The name of the trace
- * \param generator1 The #probabilist_event_generator_t which generates the time
- * between two events, or which rules the duration of availability for state trace
+ * \param date_generator The #probabilist_event_generator_t which generates the time
+ * between two events
* \param generator2 The #probabilist_event_generator_t which generates the value
- * of each events, or the duration of unavailability for state trace.
- * \param is_state_trace Is the trace will be used as a state trace
+ * of each events.
* \return The new #tmgr_trace_t
*/
-tmgr_trace_t tmgr_trace_new_from_generator(const char *id,
- probabilist_event_generator_t generator1,
- probabilist_event_generator_t generator2,
- int is_state_trace)
+tmgr_trace_t tmgr_trace_generator_value(const char *id,
+ probabilist_event_generator_t date_generator,
+ probabilist_event_generator_t value_generator)
{
tmgr_trace_t trace = NULL;
trace = xbt_new0(s_tmgr_trace_t, 1);
trace->type = e_trace_probabilist;
- trace->s_probabilist.event_generator[0] = generator1;
+ trace->s_probabilist.event_generator[0] = date_generator;
+ trace->s_probabilist.event_generator[1] = value_generator;
+ trace->s_probabilist.is_state_trace = 0;
- //FIXME : may also be a parameter
- trace->s_probabilist.next_event = 0;
- trace->s_probabilist.is_state_trace = is_state_trace;
+ return trace;
+}
- if(generator2 != NULL) {
- trace->s_probabilist.event_generator[1] = generator2;
- } else if(is_state_trace) {
- trace->s_probabilist.event_generator[1] = generator1;
- } else {
- THROW_IMPOSSIBLE; //That case should have been checked before, anyway...
- }
+/**
+ * \brief Create a #tmgr_trace_t from probabilist generators
+ *
+ * This trace will generate an infinite set of events. Value of the events
+ * will be alternatively 0 and 1, so this should be used as a state trace.
+ *
+ * \param id The name of the trace
+ * \param date_generator The #probabilist_event_generator_t which generates the time
+ * between two events
+ * \param first_event_value Set the first event value
+ * \return The new #tmgr_trace_t
+ */
+tmgr_trace_t tmgr_trace_generator_state(const char *id,
+ probabilist_event_generator_t date_generator,
+ e_surf_resource_state_t first_event_value)
+{
+ tmgr_trace_t trace = NULL;
+
+ trace = xbt_new0(s_tmgr_trace_t, 1);
+ trace->type = e_trace_probabilist;
+
+ trace->s_probabilist.event_generator[0] = date_generator;
+ trace->s_probabilist.event_generator[1] = date_generator;
+ trace->s_probabilist.is_state_trace = 1;
+ trace->s_probabilist.next_event = (first_event_value==SURF_RESOURCE_ON ? 1 : 0);
return trace;
}
+/**
+ * \brief Create a #tmgr_trace_t from probabilist generators
+ *
+ * This trace will generate an infinite set of events. Value of the events
+ * will be alternatively 0 and 1, so this should be used as a state trace.
+ *
+ * \param id The name of the trace
+ * \param avail_duration_generator The #probabilist_event_generator_t which
+ * set the duration of the available state, (ie 1 value)
+ * \param unavail_duration_generator The #probabilist_event_generator_t which
+ * set the duration of the unavailable state, (ie 0 value)
+ * \param first_event_value Set the first event value
+ * \return The new #tmgr_trace_t
+ */
+tmgr_trace_t tmgr_trace_generator_avail_unavail(const char *id,
+ probabilist_event_generator_t avail_duration_generator,
+ probabilist_event_generator_t unavail_duration_generator,
+ e_surf_resource_state_t first_event_value)
+{
+ tmgr_trace_t trace = NULL;
+
+ trace = xbt_new0(s_tmgr_trace_t, 1);
+ trace->type = e_trace_probabilist;
+
+ trace->s_probabilist.event_generator[0] = unavail_duration_generator;
+ trace->s_probabilist.event_generator[1] = avail_duration_generator;
+ trace->s_probabilist.is_state_trace = 1;
+ trace->s_probabilist.next_event = (first_event_value==SURF_RESOURCE_ON ? 1 : 0);
+
+ return trace;
+}
/**
* \brief Create a new #probabilist_event_generator_t following the uniform distribution
void mfree(struct mdesc *mdp, void *ptr)
{
int type;
- size_t block;
+ size_t block, frag_nb;
register size_t i;
struct list *prev, *next;
int it;
((char *) ADDRESS(block) +
(mdp->heapinfo[block].busy_frag.first << type));
+ /* Set size used in the fragment to 0 */
+ frag_nb = RESIDUAL(ptr, BLOCKSIZE) >> type;
+ mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = 0;
+
if (mdp->heapinfo[block].busy_frag.nfree ==
(BLOCKSIZE >> type) - 1) {
/* If all fragments of this block are free, remove them
it is the first free fragment of this block. */
prev = (struct list *) ptr;
mdp->heapinfo[block].busy_frag.nfree = 1;
- mdp->heapinfo[block].busy_frag.first =
- RESIDUAL(ptr, BLOCKSIZE) >> type;
+ mdp->heapinfo[block].busy_frag.first = frag_nb;
prev->next = mdp->fraghead[type].next;
prev->prev = &mdp->fraghead[type];
prev->prev->next = prev;
heapsize2 = heap2->heapsize;
/* Start comparison */
- size_t i1, i2, j1, j2, k;
+ size_t i1, i2, j1, j2, k, current_block, current_fragment;
void *addr_block1, *addr_block2, *addr_frag1, *addr_frag2;
- size_t frag_size1, frag_size2;
xbt_dynar_t previous = xbt_dynar_new(sizeof(heap_area_pair_t), heap_area_pair_free_voidp);
ignore_done = 0;
+ /* Init equal information */
+ i1 = 1;
+
+ while(i1<=heaplimit){
+ if(heapinfo1[i1].type == 0){
+ heapinfo1[i1].busy_block.equal_to = -1;
+ }
+ if(heapinfo1[i1].type > 0){
+ for(j1=0; j1 < MAX_FRAGMENT_PER_BLOCK; j1++){
+ heapinfo1[i1].busy_frag.equal_to[j1] = -1;
+ }
+ }
+ i1++;
+ }
+
+ i2 = 1;
+
+ while(i2<=heaplimit){
+ if(heapinfo2[i2].type == 0){
+ heapinfo2[i2].busy_block.equal_to = -1;
+ }
+ if(heapinfo2[i2].type > 0){
+ for(j2=0; j2 < MAX_FRAGMENT_PER_BLOCK; j2++){
+ heapinfo2[i2].busy_frag.equal_to[j2] = -1;
+ }
+ }
+ i2++;
+ }
+
/* Check busy blocks*/
i1 = 1;
- while(i1 < heaplimit){
+ while(i1 <= heaplimit){
- i2 = 1;
- equal = 0;
+ current_block = i1;
if(heapinfo1[i1].type == -1){ /* Free block */
i1++;
if(heapinfo1[i1].type == 0){ /* Large block */
+ if(heapinfo1[i1].busy_block.busy_size == 0){
+ i1++;
+ continue;
+ }
+
+ i2 = 1;
+ equal = 0;
+
+ /* Try first to associate to same block in the other heap */
+ if(heapinfo2[current_block].type == heapinfo1[current_block].type){
+
+ if(heapinfo1[current_block].busy_block.busy_size == heapinfo2[current_block].busy_block.busy_size){
+
+ addr_block2 = ((void*) (((ADDR2UINT(current_block)) - 1) * BLOCKSIZE + (char*)heapbase2));
+
+ add_heap_area_pair(previous, current_block, -1, current_block, -1);
+
+ if(ignore_done < xbt_dynar_length(mmalloc_ignore)){
+ if(in_mmalloc_ignore((int)current_block, -1))
+ res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 1);
+ else
+ res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 0);
+ }else{
+ res_compare = compare_area(addr_block1, addr_block2, heapinfo1[current_block].busy_block.busy_size, previous, 0);
+ }
+
+ if(res_compare == 0){
+ for(k=1; k < heapinfo2[current_block].busy_block.size; k++)
+ heapinfo2[current_block+k].busy_block.equal_to = 1 ;
+ for(k=1; k < heapinfo1[current_block].busy_block.size; k++)
+ heapinfo1[current_block+k].busy_block.equal_to = 1 ;
+ equal = 1;
+ match_equals(previous);
+ i1 = i1 + heapinfo1[i1].busy_block.size;
+ }
+
+ xbt_dynar_reset(previous);
+
+ }
+
+ }
+
while(i2 <= heaplimit && !equal){
+ if(i2 == current_block){
+ i2++;
+ continue;
+ }
+
if(heapinfo2[i2].type != 0){
i2++;
continue;
}
if(!res_compare){
- for(k=0; k < heapinfo2[i2].busy_block.size; k++)
+ for(k=1; k < heapinfo2[i2].busy_block.size; k++)
heapinfo2[i2+k].busy_block.equal_to = 1;
- for(k=0; k < heapinfo1[i1].busy_block.size; k++)
+ for(k=1; k < heapinfo1[i1].busy_block.size; k++)
heapinfo1[i1+k].busy_block.equal_to = 1;
equal = 1;
match_equals(previous);
}
+
xbt_dynar_reset(previous);
i2++;
}
+ if(!equal)
+ i1++;
+
}else{ /* Fragmented block */
- frag_size1 = 1 << heapinfo1[i1].type;
-
for(j1=0; j1 < (size_t) (BLOCKSIZE >> heapinfo1[i1].type); j1++){
+ current_fragment = j1;
+
if(heapinfo1[i1].busy_frag.frag_size[j1] == 0) /* Free fragment */
continue;
- addr_frag1 = (void*) ((char *)addr_block1 + (j1 * frag_size1));
-
+ addr_frag1 = (void*) ((char *)addr_block1 + (j1 << heapinfo1[i1].type));
+
i2 = 1;
equal = 0;
+ /* Try first to associate to same fragment in the other heap */
+ if(heapinfo2[current_block].type == heapinfo1[current_block].type){
+
+ if(heapinfo1[current_block].busy_frag.frag_size[current_fragment] == heapinfo2[current_block].busy_frag.frag_size[current_fragment]){
+
+ addr_block2 = ((void*) (((ADDR2UINT(current_block)) - 1) * BLOCKSIZE + (char*)heapbase2));
+ addr_frag2 = (void*) ((char *)addr_block2 + (current_fragment << heapinfo2[current_block].type));
+
+ add_heap_area_pair(previous, current_block, current_fragment, current_block, current_fragment);
+
+ if(ignore_done < xbt_dynar_length(mmalloc_ignore)){
+ if(in_mmalloc_ignore((int)current_block, (int)current_fragment))
+ res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 1);
+ else
+ res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 0);
+ }else{
+ res_compare = compare_area(addr_frag1, addr_frag2, heapinfo1[current_block].busy_frag.frag_size[current_fragment], previous, 0);
+ }
+
+ if(res_compare == 0){
+ equal = 1;
+ match_equals(previous);
+ }
+
+ xbt_dynar_reset(previous);
+
+ }
+
+ }
+
+
while(i2 <= heaplimit && !equal){
if(heapinfo2[i2].type <= 0){
i2++;
continue;
}
-
- frag_size2 = 1 << heapinfo2[i2].type;
for(j2=0; j2 < (size_t) (BLOCKSIZE >> heapinfo2[i2].type); j2++){
- if(heapinfo2[i2].busy_frag.equal_to[j2] == 1){
+ if(heapinfo2[i2].type == heapinfo1[i1].type && i2 == current_block && j2 == current_fragment)
+ continue;
+
+ if(heapinfo2[i2].busy_frag.equal_to[j2] == 1)
continue;
- }
- if(heapinfo1[i1].busy_frag.frag_size[j1] != heapinfo2[i2].busy_frag.frag_size[j2]){ /* Different size_used */
+ if(heapinfo1[i1].busy_frag.frag_size[j1] != heapinfo2[i2].busy_frag.frag_size[j2]) /* Different size_used */
continue;
- }
addr_block2 = ((void*) (((ADDR2UINT(i2)) - 1) * BLOCKSIZE + (char*)heapbase2));
- addr_frag2 = (void*) ((char *)addr_block2 + (j2 * frag_size2));
+ addr_frag2 = (void*) ((char *)addr_block2 + (j2 << heapinfo2[i2].type));
/* Comparison */
add_heap_area_pair(previous, i1, j1, i2, j2);
}
if(!res_compare){
- heapinfo2[i2].busy_frag.equal_to[j2] = 1;
- heapinfo1[i1].busy_frag.equal_to[j1] = 1;
equal = 1;
match_equals(previous);
+ xbt_dynar_reset(previous);
break;
}
+
xbt_dynar_reset(previous);
}
}
+ i1++;
+
}
- i1++;
-
}
/* All blocks/fragments are equal to another block/fragment ? */
size_t i = 1, j = 0;
int nb_diff1 = 0, nb_diff2 = 0;
- size_t frag_size = 0;
while(i<heaplimit){
if(heapinfo1[i].type == 0){
}
}
if(heapinfo1[i].type > 0){
- frag_size = 1 << heapinfo1[i].type;
for(j=0; j < (size_t) (BLOCKSIZE >> heapinfo1[i].type); j++){
if(heapinfo1[i].busy_frag.frag_size[j] > 0){
if(heapinfo1[i].busy_frag.equal_to[j] == -1){
if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
addr_block1 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase1));
- addr_frag1 = (void*) ((char *)addr_block1 + (j * frag_size));
+ addr_frag1 = (void*) ((char *)addr_block1 + (j << heapinfo1[i].type));
XBT_DEBUG("Block %zu, Fragment %zu (%p) not found (size used = %d)", i, j, addr_frag1, heapinfo1[i].busy_frag.frag_size[j]);
mmalloc_backtrace_fragment_display((void*)heapinfo1, i, j);
}
}
}
if(heapinfo2[i].type > 0){
- frag_size = 1 << heapinfo2[i].type;
for(j=0; j < (size_t) (BLOCKSIZE >> heapinfo2[i].type); j++){
if(heapinfo2[i].busy_frag.frag_size[j] > 0){
if(heapinfo2[i].busy_frag.equal_to[j] == -1){
if(XBT_LOG_ISENABLED(mm_diff, xbt_log_priority_debug)){
addr_block2 = ((void*) (((ADDR2UINT(i)) - 1) * BLOCKSIZE + (char*)heapbase2));
- addr_frag2 = (void*) ((char *)addr_block2 + (j * frag_size));
+ addr_frag2 = (void*) ((char *)addr_block2 + (j << heapinfo2[i].type));
XBT_DEBUG( "Block %zu, Fragment %zu (%p) not found (size used = %d)", i, j, addr_frag2, heapinfo2[i].busy_frag.frag_size[j]);
mmalloc_backtrace_fragment_display((void*)heapinfo2, i, j);
}
}
XBT_DEBUG("Different blocks or fragments in heap2 : %d\n", nb_diff2);
-
-
- /* Reset equal information */
- i = 1;
-
- while(i<heaplimit){
- if(heapinfo1[i].type == 0){
- heapinfo1[i].busy_block.equal_to = -1;
- }
- if(heapinfo1[i].type > 0){
- for(j=0; j < MAX_FRAGMENT_PER_BLOCK; j++){
- heapinfo1[i].busy_frag.equal_to[j] = -1;
- }
- }
- i++;
- }
-
- i = 1;
-
- while(i<heaplimit){
- if(heapinfo2[i].type == 0){
- heapinfo2[i].busy_block.equal_to = -1;
- }
- if(heapinfo2[i].type > 0){
- for(j=0; j < MAX_FRAGMENT_PER_BLOCK; j++){
- heapinfo2[i].busy_frag.equal_to[j] = -1;
- }
- }
- i++;
- }
xbt_dynar_free(&previous);
size_t i = 0, pointer_align = 0, ignore1 = 0, ignore2 = 0;
void *address_pointed1, *address_pointed2, *addr_block_pointed1, *addr_block_pointed2, *addr_frag_pointed1, *addr_frag_pointed2;
size_t block_pointed1, block_pointed2, frag_pointed1, frag_pointed2;
- size_t frag_size, frag_size1, frag_size2;
int res_compare;
void *current_area1, *current_area2;
}else{ /* Fragmented block */
- /* Get pointed fragments number */
+ /* Get pointed fragments number */
frag_pointed1 = ((uintptr_t) (ADDR2UINT (address_pointed1) % (BLOCKSIZE))) >> heapinfo1[block_pointed1].type;
frag_pointed2 = ((uintptr_t) (ADDR2UINT (address_pointed2) % (BLOCKSIZE))) >> heapinfo2[block_pointed2].type;
if(heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1] != heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]) /* Different size_used */
return 1;
-
- frag_size = 1 << heapinfo1[block_pointed1].type;
- addr_frag_pointed1 = (void*) ((char *)addr_block_pointed1 + (frag_pointed1 * frag_size));
- addr_frag_pointed2 = (void*) ((char *)addr_block_pointed2 + (frag_pointed2 * frag_size));
+ addr_frag_pointed1 = (void*) ((char *)addr_block_pointed1 + (frag_pointed1 << heapinfo1[block_pointed1].type));
+ addr_frag_pointed2 = (void*) ((char *)addr_block_pointed2 + (frag_pointed2 << heapinfo2[block_pointed2].type));
if(add_heap_area_pair(previous, block_pointed1, frag_pointed1, block_pointed2, frag_pointed2)){
if(heapinfo1[block_pointed1].busy_frag.frag_size[frag_pointed1] != heapinfo2[block_pointed2].busy_frag.frag_size[frag_pointed2]) /* Different size_used */
return 1;
-
- frag_size1 = 1 << heapinfo1[block_pointed1].type;
- frag_size2 = 1 << heapinfo1[block_pointed2].type;
- addr_frag_pointed1 = (void*) ((char *)addr_block_pointed1 + (frag_pointed1 * frag_size1));
- addr_frag_pointed2 = (void*) ((char *)addr_block_pointed2 + (frag_pointed2 * frag_size2));
+ addr_frag_pointed1 = (void*) ((char *)addr_block_pointed1 + (frag_pointed1 << heapinfo1[block_pointed1].type));
+ addr_frag_pointed2 = (void*) ((char *)addr_block_pointed2 + (frag_pointed2 << heapinfo2[block_pointed2].type));
if(add_heap_area_pair(previous, block_pointed1, frag_pointed1, block_pointed2, frag_pointed2)){
frag_nb = RESIDUAL(result, BLOCKSIZE) >> log;
mdp->heapinfo[block].busy_frag.frag_size[frag_nb] = requested_size;
- mdp->heapinfo[block].busy_frag.equal_to[frag_nb] = -1;
xbt_backtrace_no_malloc(mdp->heapinfo[block].busy_frag.bt[frag_nb],XBT_BACKTRACE_SIZE);
next->prev->next = next->next;
}
}
mdp->heapinfo[block].busy_frag.frag_size[0] = requested_size;
- mdp->heapinfo[block].busy_frag.equal_to[0] = -1;
xbt_backtrace_no_malloc(mdp->heapinfo[block].busy_frag.bt[0],XBT_BACKTRACE_SIZE);
/* Initialize the nfree and first counters for this block. */
block = BLOCK(result);
for (it=0;it<blocks;it++){
mdp->heapinfo[block+it].type = 0;
- mdp->heapinfo[block+it].busy_block.equal_to = -1;
}
mdp->heapinfo[block].busy_block.size = blocks;
mdp->heapinfo[block].busy_block.busy_size = requested_size;
for (it=0;it<blocks;it++){
mdp->heapinfo[block+it].type = 0;
- mdp->heapinfo[block+it].busy_block.equal_to = -1;
}
mdp->heapinfo[block].busy_block.size = blocks;
mdp->heapinfo[block].busy_block.busy_size = requested_size;