From aa192f6d7ece3eefc304338f852824cc15be6909 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20B=C3=A9daride?= Date: Wed, 30 Jan 2013 01:05:25 +0100 Subject: [PATCH] Set a fixed seed for srand and srand48 --- examples/simdag/test_simdag_tracing.tesh | 12 ++++++------ src/instr/instr_interface.c | 2 +- src/xbt/xbt_main.c | 6 ++++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/examples/simdag/test_simdag_tracing.tesh b/examples/simdag/test_simdag_tracing.tesh index 3fc9699ec7..34b8439e71 100644 --- a/examples/simdag/test_simdag_tracing.tesh +++ b/examples/simdag/test_simdag_tracing.tesh @@ -248,12 +248,12 @@ $ tail -n +3 ./simgrid.trace > 16 0 7 0 topology 21 22 > 15 0 8 0 topology 21 23 > 16 0 8 0 topology 8 23 -> 1 9 3 btaskA "0.000000 0.000985 0.041631" -> 1 10 1 ptaskA "0.000000 0.000985 0.041631" -> 1 11 3 btaskB "0.176643 0.364602 0.091331" -> 1 12 1 ptaskB "0.176643 0.364602 0.091331" -> 1 13 3 btaskC "0.092298 0.487217 0.526750" -> 1 14 1 ptaskC "0.092298 0.487217 0.526750" +> 1 9 3 btaskA "0.800026 0.545312 0.857926" +> 1 10 1 ptaskA "0.800026 0.545312 0.857926" +> 1 11 3 btaskB "0.904944 0.089118 0.069832" +> 1 12 1 ptaskB "0.904944 0.089118 0.069832" +> 1 13 3 btaskC "0.696799 0.247098 0.497311" +> 1 14 1 ptaskC "0.696799 0.247098 0.497311" > 7 8.800300 1 10 > 7 8.800300 1 1 > 7 8.800300 1 3 diff --git a/src/instr/instr_interface.c b/src/instr/instr_interface.c index 3c06b95d47..e18be1f617 100644 --- a/src/instr/instr_interface.c +++ b/src/instr/instr_interface.c @@ -111,7 +111,7 @@ void TRACE_category_with_color (const char *category, const char *color) snprintf (final_color, INSTR_DEFAULT_STR_SIZE, "%s", color); } - XBT_DEBUG("CAT,declare %s, %s", category, final_color); + XBT_DEBUG("CAT,declare %s, \"%s\" \"%s\"", category, color, final_color); //define the type of this category on top of hosts and links instr_new_variable_type (category, final_color); diff --git a/src/xbt/xbt_main.c b/src/xbt/xbt_main.c index 89a67a6471..e09d03d4fb 100644 --- a/src/xbt/xbt_main.c +++ b/src/xbt/xbt_main.c @@ -35,6 +35,7 @@ int xbt_initialized = 0; */ static void xbt_preinit(void) _XBT_GNUC_CONSTRUCTOR(200); static void xbt_postexit(void); +static unsigned int seed = 2147483647; #ifdef _XBT_WIN32 # undef _XBT_NEED_INIT_PRAGMA @@ -118,8 +119,9 @@ void xbt_init(int *argc, char **argv) xbt_dynar_push(xbt_cmdline,&(argv[i])); } - srand((unsigned int) time(NULL)); - + srand(seed); + srand48(seed); + xbt_log_init(argc, argv); } -- 2.20.1