From: thiery Date: Mon, 17 Jan 2011 10:44:24 +0000 (+0000) Subject: Chord: add a large deployment file and a script to generate it X-Git-Tag: v3.6_beta2~512 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/c2f8851217b62c872f98ef5233d6c53318844e31 Chord: add a large deployment file and a script to generate it git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@9416 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- diff --git a/examples/msg/chord/chord.c b/examples/msg/chord/chord.c index 306ac6bf99..88987d7aa7 100644 --- a/examples/msg/chord/chord.c +++ b/examples/msg/chord/chord.c @@ -16,7 +16,7 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_chord, #define NB_KEYS 65536 #define COMM_SIZE 10 #define COMP_SIZE 0 -#define TIMEOUT 100 +#define TIMEOUT 50 /** * Finger element. @@ -187,15 +187,17 @@ static void task_data_destroy(task_data_t task_data) */ static void print_finger_table(node_t node) { - int i; - int pow = 1; - INFO0("My finger table:"); - INFO0("Start | Succ "); - for (i = 0; i < NB_BITS; i++) { - INFO2(" %3d | %3d ", (node->id + pow) % NB_KEYS, node->fingers[i].id); - pow = pow << 1; + if (XBT_LOG_ISENABLED(msg_chord, xbt_log_priority_verbose)) { + int i; + int pow = 1; + VERB0("My finger table:"); + VERB0("Start | Succ "); + for (i = 0; i < NB_BITS; i++) { + VERB2(" %3d | %3d ", (node->id + pow) % NB_KEYS, node->fingers[i].id); + pow = pow << 1; + } + VERB1("Predecessor: %d", node->pred_id); } - INFO1("Predecessor: %d", node->pred_id); } /** @@ -480,7 +482,7 @@ static int join(node_t node, int known_id) int successor_id = remote_find_successor(node, known_id, node->id); if (successor_id == -1) { - DEBUG0("Cannot join the ring."); + INFO0("Cannot join the ring."); } else { set_finger(node, 0, successor_id); @@ -583,7 +585,7 @@ static int remote_find_successor(node_t node, int ask_to, int id) // send a "Find Successor" request to ask_to_id m_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data); DEBUG3("Sending a 'Find Successor' request (task %p) to %d for id %d", task_sent, ask_to, id); - MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, 50); + MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, TIMEOUT); if (res != MSG_OK) { DEBUG3("Failed to send the 'Find Successor' request (task %p) to %d for id %d", @@ -603,7 +605,7 @@ static int remote_find_successor(node_t node, int ask_to, int id) node->comm_receive = MSG_task_irecv(&task_received, node->mailbox); } - res = MSG_comm_wait(node->comm_receive, 50); + res = MSG_comm_wait(node->comm_receive, TIMEOUT); if (res != MSG_OK) { DEBUG2("Failed to receive the answer to my 'Find Successor' request (task %p): %d", @@ -658,7 +660,7 @@ static int remote_get_predecessor(node_t node, int ask_to) // send a "Get Predecessor" request to ask_to_id DEBUG1("Sending a 'Get Predecessor' request to %d", ask_to); m_task_t task_sent = MSG_task_create(NULL, COMP_SIZE, COMM_SIZE, req_data); - MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, 50); + MSG_error_t res = MSG_task_send_with_timeout(task_sent, mailbox, TIMEOUT); if (res != MSG_OK) { DEBUG2("Failed to send the 'Get Predecessor' request (task %p) to %d", @@ -678,7 +680,7 @@ static int remote_get_predecessor(node_t node, int ask_to) node->comm_receive = MSG_task_irecv(&task_received, node->mailbox); } - res = MSG_comm_wait(node->comm_receive, 50); + res = MSG_comm_wait(node->comm_receive, TIMEOUT); if (res != MSG_OK) { DEBUG2("Failed to receive the answer to my 'Get Predecessor' request (task %p): %d", diff --git a/examples/msg/chord/chord1000.xml b/examples/msg/chord/chord1000.xml new file mode 100644 index 0000000000..9cfd3153a4 --- /dev/null +++ b/examples/msg/chord/chord1000.xml @@ -0,0 +1,1007 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/examples/msg/chord/chord90.xml b/examples/msg/chord/chord90.xml index 981c5d4c1b..8b6c13f91f 100644 --- a/examples/msg/chord/chord90.xml +++ b/examples/msg/chord/chord90.xml @@ -4,7 +4,7 @@ - + diff --git a/examples/msg/chord/generate.py b/examples/msg/chord/generate.py new file mode 100755 index 0000000000..79ca3d82d1 --- /dev/null +++ b/examples/msg/chord/generate.py @@ -0,0 +1,38 @@ +#!/usr/bin/python + +import sys, random + +if len(sys.argv) != 4: + print("Usage: python generate.py nb_nodes nb_bits end_date > deployment_file.xml") + sys.exit(1) + +nb_nodes = int(sys.argv[1]) +nb_bits = int(sys.argv[2]) +end_date = int(sys.argv[3]) + +max_id = 2 ** nb_bits - 1 +all_ids = [42] + +sys.stdout.write("\n" +"\n" +"\n" +" \n" +" \n" +" \n" +" \n") + +for i in range(1, nb_nodes): + + ok = False + while not ok: + my_id = random.randint(0, max_id) + ok = not my_id in all_ids + + known_id = all_ids[random.randint(0, len(all_ids) - 1)] + start_date = i * 10 + line = " \n" % (i, my_id, known_id, start_date, end_date) + sys.stdout.write(line) + all_ids.append(my_id) + +sys.stdout.write("") +