Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Set a fixed seed for srand and srand48
authorPaul Bédaride <paul.bedaride@gmail.com>
Wed, 30 Jan 2013 00:05:25 +0000 (01:05 +0100)
committerPaul Bédaride <paul.bedaride@gmail.com>
Wed, 30 Jan 2013 00:05:25 +0000 (01:05 +0100)
examples/simdag/test_simdag_tracing.tesh
src/instr/instr_interface.c
src/xbt/xbt_main.c

index 3fc9699..34b8439 100644 (file)
@@ -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
index 3c06b95..e18be1f 100644 (file)
@@ -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);
index 89a67a6..e09d03d 100644 (file)
@@ -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);
 }