Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
add SIMIX_process_set_function, could be used instead of parsing the deployment file
authorcoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 21 Jul 2010 09:24:08 +0000 (09:24 +0000)
committercoldpeace <coldpeace@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 21 Jul 2010 09:24:08 +0000 (09:24 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@8037 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/include/simix/simix.h
src/simix/smx_deployment.c

index 627101d..7faa5bc 100644 (file)
@@ -27,6 +27,12 @@ XBT_PUBLIC(xbt_main_func_t) SIMIX_get_registered_function(const char *name);
 
 XBT_PUBLIC(void) SIMIX_launch_application(const char *file);
 
+/*
+ *  Deployment (Bypass the parser)
+ */
+XBT_PUBLIC(void) SIMIX_set_process_function(const char* process_host,const char *process_function,xbt_dynar_t arguments,double process_start_time,double process_kill_time);
+
+
 XBT_PUBLIC(double) SIMIX_get_clock(void);
 XBT_PUBLIC(void) SIMIX_init(void);
 XBT_PUBLIC(double) SIMIX_solve(xbt_fifo_t actions_done,
index 31cd8fd..9e02cb2 100644 (file)
@@ -175,10 +175,49 @@ void SIMIX_function_register_default(xbt_main_func_t code)
  */
 xbt_main_func_t SIMIX_get_registered_function(const char *name)
 {
-       xbt_main_func_t res = NULL;
+  xbt_main_func_t res = NULL;
   xbt_assert0(simix_global,
               "SIMIX_global_init has to be called before SIMIX_get_registered_function.");
 
   res = xbt_dict_get_or_null(simix_global->registered_functions, name);
   return res ? res : default_function;
 }
+
+
+/**
+ * \brief Bypass the parser, get arguments, and set function to each process
+ */
+
+void SIMIX_process_set_function(const char* process_host,const char *process_function,xbt_dynar_t arguments,double process_start_time,double process_kill_time)
+{
+  unsigned int i;
+  char *arg;
+
+  /* init process */
+  parse_host = xbt_strdup(process_host);
+  xbt_assert1(SIMIX_host_get_by_name(parse_host),
+              "Host '%s' unknown", parse_host);
+  parse_code = SIMIX_get_registered_function(process_function);
+  xbt_assert1(parse_code, "Function '%s' unknown",
+              process_function);
+  parse_argc = 0;
+  parse_argv = NULL;
+  parse_argc++;
+  parse_argv = xbt_realloc(parse_argv, (parse_argc) * sizeof(char *));
+  parse_argv[(parse_argc) - 1] = xbt_strdup(A_surfxml_process_function);
+  start_time = process_start_time;
+  kill_time = process_kill_time;
+  current_property_set = xbt_dict_new();
+
+  /* add arguments */
+  xbt_dynar_foreach(arguments,i,arg)
+  {
+         parse_argc++;
+         parse_argv = xbt_realloc(parse_argv, (parse_argc) * sizeof(char *));
+         parse_argv[(parse_argc) - 1] = xbt_strdup(arg);
+  }
+
+  /*finalize */
+  parse_process_finalize();
+
+}