Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove the 'TUTORIAL: New API' chunks
authorMartin Quinson <martin.quinson@loria.fr>
Sat, 1 Nov 2014 21:25:06 +0000 (22:25 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Sat, 1 Nov 2014 21:25:12 +0000 (22:25 +0100)
This loads the code, and I'm not sure that it is of any help,
actually. Adding a new API is rather uncommon, and the existing ones
are clean enough to serve as an example, nowadays.

17 files changed:
buildtools/Cmake/DefinePackages.cmake
doc/doxygen/inside_extending.doc
include/msg/msg.h
include/simgrid/simix.h
src/msg/msg_new_api.c [deleted file]
src/simix/simcalls.py
src/simix/smx_global.c
src/simix/smx_new_api.c [deleted file]
src/simix/smx_new_api_private.h [deleted file]
src/simix/smx_popping_generated.c
src/simix/smx_popping_generated.h
src/simix/smx_private.h
src/simix/smx_process.c
src/simix/smx_smurf.c
src/simix/smx_smurf_private.h
src/simix/smx_user.c
src/xbt/log.c

index 6c25f40..8da0636 100644 (file)
@@ -402,23 +402,6 @@ set(MSG_SRC
   src/msg/msg_vm.c
   )
 
-#* ****************************************************************************************** *#
-#* TUTORIAL: New API                                                                          *#
-
-set(MSG_SRC
-  ${MSG_SRC}
-  src/msg/msg_new_api.c
-  )
-set(EXTRA_DIST
-  ${EXTRA_DIST}
-  src/simix/smx_new_api_private.h
-  )
-set(SIMIX_SRC
-  ${SIMIX_SRC}
-  src/simix/smx_new_api.c
-)
-#* ****************************************************************************************** *#
-
 set(SIMDAG_SRC
   src/simdag/instr_sd_task.c
   src/simdag/sd_daxloader.c
index ba660ff..0f4e1c6 100644 (file)
@@ -3,25 +3,6 @@
 
 \tableofcontents
 
-\section simgrid_dev_guide_api How to add a new MSG function?
-Search for expression \"TUTORIAL: New API\".
-\verbatim
-user@caraja:~/workspace/simgrid/src$ cg "TUTORIAL: New API"
- 0 msg/msg_new_api.c             15 /* TUTORIAL: New API*/
- 1 simix/smx_smurf.c            582 /* TUTORIAL: New API*/
- 2 simix/smx_smurf.c            616 /* TUTORIAL: New API*/
- 3 simix/smx_smurf_private.h    102 /* TUTORIAL: New API*/
- 4 simix/smx_smurf_private.h    629 /* TUTORIAL: New API*/
- 5 simix/smx_private.h           28 /* TUTORIAL: New API*/
- 6 simix/smx_private.h          101 /* TUTORIAL: New API*/
- 7 simix/smx_private.h          182 /* TUTORIAL: New API*/
- 8 simix/smx_global.c           454 /* TUTORIAL: New API*/
- 9 simix/smx_new_api.c            8 /* TUTORIAL: New API*/
-10 simix/smx_user.c            1684 /* TUTORIAL: New API*/
-11 simix/smx_new_api_private.h    8 /* TUTORIAL: New API*/
-12 simix/smx_process.c          338 /* TUTORIAL: New API*/
-\endverbatim
-
 \section simgrid_dev_guide_model How to add a new model in surf?
 The figure below show the architecture of the SURF layer. This layer is composed
 of different kind of models representing the differents systems we want to
index 5fceca3..55d9b3c 100644 (file)
@@ -509,11 +509,5 @@ xbt_dynar_t<msg_vm_t> MSG_vm_get_list_from_hosts(msg_dynar_t<msg_host_t>)
 /* Used only by the bindings -- unclean pimple, please ignore if you're not writing a binding */
 XBT_PUBLIC(smx_context_t) MSG_process_get_smx_ctx(msg_process_t process);
 
-/* ****************************************************************************************** */
-/* TUTORIAL: New API                                                                        */
-/* Declare all functions for the API                                                          */
-/* ****************************************************************************************** */
-XBT_PUBLIC(int) MSG_new_API_fct(const char* param1, double param2);
-
 SG_END_DECL()
 #endif
index 42b50d4..8b54e37 100644 (file)
@@ -531,10 +531,5 @@ XBT_PUBLIC(void *) simcall_mc_snapshot(void);
 XBT_PUBLIC(int) simcall_mc_compare_snapshots(void *s1, void *s2);
 XBT_PUBLIC(int) simcall_mc_random(int min, int max);
 
-/************************** New API simcalls **********************************/
-/* TUTORIAL: New API                                                          */
-/******************************************************************************/
-XBT_PUBLIC(int) simcall_new_api_fct(const char* param1, double param2);
-
 SG_END_DECL()
 #endif                          /* _SIMIX_SIMIX_H */
diff --git a/src/msg/msg_new_api.c b/src/msg/msg_new_api.c
deleted file mode 100644 (file)
index 0bc6ba8..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright (c) 2004-2014. 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 "msg_private.h"
-#include "xbt/log.h"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(msg_new_API, msg,
-                                "Logging specific to MSG (new_API)");
-
-
-/* ****************************************************************************************** */
-/* TUTORIAL: New API                                                                        */
-/* All functions for the API                                                                  */
-/* ****************************************************************************************** */
-int MSG_new_API_fct(const char* param1, double param2)
-{
-  int result = simcall_new_api_fct(param1, param2);
-  return result;
-}
index 825c1c3..7781eb3 100755 (executable)
@@ -265,7 +265,6 @@ SIMCALL_NONE,
   handle(fd, Simcall.enum, simcalls, simcalls_dict)
   
   fd.write("""
-SIMCALL_NEW_API_INIT,
 NUM_SIMCALLS
 } e_smx_simcall_t;
   """)
@@ -322,12 +321,6 @@ NUM_SIMCALLS
   fd.write('          );\n');
   fd.write('      break;\n');
   fd.write('\n');
-  fd.write('    /* ****************************************************************************************** */\n');
-  fd.write('    /* TUTORIAL: New API                                                                        */\n');
-  fd.write('    /* ****************************************************************************************** */\n');
-  fd.write('    case SIMCALL_NEW_API_INIT:\n');
-  fd.write('      SIMIX_pre_new_api_fct(simcall);\n');
-  fd.write('      break;\n');
   fd.write('  }\n');
   fd.write('}\n');
   
index 2ce8738..b9dedde 100644 (file)
@@ -567,13 +567,6 @@ void SIMIX_display_process_status(void)
 
       case SIMIX_ACTION_IO:
         action_description = "I/O";
-        break;
-      /* **************************************/
-      /* TUTORIAL: New API                    */
-      case SIMIX_ACTION_NEW_API:
-        action_description = "NEW API";
-      /* **************************************/
-
         break;
       }
       XBT_INFO("Process %lu (%s@%s): waiting for %s action %p (%s) in state %d to finish",
diff --git a/src/simix/smx_new_api.c b/src/simix/smx_new_api.c
deleted file mode 100644 (file)
index f419842..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/* Copyright (c) 2007-2010, 2012-2014. 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. */
-
-/* ****************************************************************************************** */
-/* TUTORIAL: New API                                                                        */
-/* ****************************************************************************************** */
-#include "smx_private.h"
-#include "xbt/sysdep.h"
-#include "xbt/log.h"
-#include "xbt/dict.h"
-#include "mc/mc.h"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_new_api, simix,
-                                "Logging specific to SIMIX (new_api)");
-
-
-//SIMIX NEW MODEL INIT
-void SIMIX_pre_new_api_fct(smx_simcall_t simcall)
-{
-  smx_action_t action = SIMIX_new_api_fct(simcall->issuer,
-      simcall->new_api.param1,
-      simcall->new_api.param2);
-  xbt_fifo_push(action->simcalls, simcall);
-  simcall->issuer->waiting_action = action;
-}
-
-void SIMIX_post_new_api(smx_action_t action)
-{
-  xbt_fifo_item_t i;
-  smx_simcall_t simcall;
-
-  xbt_fifo_foreach(action->simcalls,i,simcall,smx_simcall_t) {
-    switch (simcall->call) {
-    case SIMCALL_NEW_API_INIT:
-      simcall->new_api.result = 0;
-      break;
-
-    default:
-      break;
-    }
-  }
-
-  switch (surf_action_get_state(action->new_api.surf_new_api)) {
-
-    case SURF_ACTION_FAILED:
-      action->state = SIMIX_FAILED;
-      break;
-
-    case SURF_ACTION_DONE:
-      action->state = SIMIX_DONE;
-      break;
-
-    default:
-      THROW_IMPOSSIBLE;
-      break;
-  }
-
-  SIMIX_new_api_finish(action);
-}
-
-smx_action_t SIMIX_new_api_fct(smx_process_t process, const char* param1, double param2)
-{
-  smx_action_t action;
-  smx_host_t host = process->smx_host;
-
-  /* check if the host is active */
-  if (surf_resource_get_state(surf_workstation_resource_priv(host)) != SURF_RESOURCE_ON) {
-    THROWF(host_error, 0, "Host %s failed, you cannot call this function",
-           sg_host_name(host));
-  }
-
-  action = xbt_mallocator_get(simix_global->action_mallocator);
-  action->type = SIMIX_ACTION_NEW_API;
-  action->name = NULL;
-#ifdef HAVE_TRACING
-  action->category = NULL;
-#endif
-
-  // Called the function from the new model
-  //FIXME:CHECK WHAT TO DO action->new_api.surf_new_api = surf_workstation_model->extension.new_model.fct();
-
-  surf_action_set_data(action->new_api.surf_new_api, action);
-  XBT_DEBUG("Create NEW MODEL action %p", action);
-
-  return action;
-}
-
-void SIMIX_new_api_destroy(smx_action_t action)
-{
-  XBT_DEBUG("Destroy action %p", action);
-  if (action->new_api.surf_new_api)
-    surf_action_unref(action->new_api.surf_new_api);
-  xbt_mallocator_release(simix_global->action_mallocator, action);
-}
-
-void SIMIX_new_api_finish(smx_action_t action)
-{
-  xbt_fifo_item_t item;
-  smx_simcall_t simcall;
-
-  xbt_fifo_foreach(action->simcalls, item, simcall, smx_simcall_t) {
-
-    switch (action->state) {
-
-      case SIMIX_DONE:
-        /* do nothing, action done */
-        break;
-
-      case SIMIX_FAILED:
-        SMX_EXCEPTION(simcall->issuer, io_error, 0, "IO failed");
-        break;
-
-      case SIMIX_CANCELED:
-        SMX_EXCEPTION(simcall->issuer, cancel_error, 0, "Canceled");
-        break;
-
-      default:
-        xbt_die("Internal error in SIMIX_NEW_MODEL_finish: unexpected action state %d",
-            (int)action->state);
-    }
-
-    if (surf_resource_get_state(surf_workstation_resource_priv(simcall->issuer->smx_host)) != SURF_RESOURCE_ON) {
-      simcall->issuer->context->iwannadie = 1;
-    }
-
-    simcall->issuer->waiting_action = NULL;
-    SIMIX_simcall_answer(simcall);
-  }
-
-  /* We no longer need it */
-  SIMIX_new_api_destroy(action);
-}
diff --git a/src/simix/smx_new_api_private.h b/src/simix/smx_new_api_private.h
deleted file mode 100644 (file)
index 2c1f78f..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/* Copyright (c) 2007-2010, 2012-2014. 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. */
-
-/* ****************************************************************************************** */
-/* TUTORIAL: New API                                                                        */
-/* ****************************************************************************************** */
-#ifndef _SIMIX_NEW_API_PRIVATE_H
-#define _SIMIX_NEW_API_PRIVATE_H
-
-#include "simgrid/simix.h"
-#include "smx_smurf_private.h"
-
-void SIMIX_pre_new_api_fct(smx_simcall_t simcall);
-smx_action_t SIMIX_new_api_fct(smx_process_t process, const char* param1, double param2);
-
-void SIMIX_post_new_api(smx_action_t action);
-void SIMIX_new_api_destroy(smx_action_t action);
-void SIMIX_new_api_finish(smx_action_t action);
-
-#endif
index e33bfdc..03a18ea 100644 (file)
@@ -780,11 +780,5 @@ case SIMCALL_MC_RANDOM:
           );
       break;
 
-    /* ****************************************************************************************** */
-    /* TUTORIAL: New API                                                                        */
-    /* ****************************************************************************************** */
-    case SIMCALL_NEW_API_INIT:
-      SIMIX_pre_new_api_fct(simcall);
-      break;
   }
 }
index 84c5172..6d7a049 100644 (file)
@@ -151,7 +151,6 @@ SIMCALL_MC_COMPARE_SNAPSHOTS,
 SIMCALL_MC_RANDOM,
 #endif
 
-SIMCALL_NEW_API_INIT,
 NUM_SIMCALLS
 } e_smx_simcall_t;
   
\ No newline at end of file
index b061c5d..81c0fd9 100644 (file)
 #include "smx_network_private.h"
 #include "smx_smurf_private.h"
 #include "smx_synchro_private.h"
-/* ****************************************************************************************** */
-/* TUTORIAL: New API                                                                        */
-/* ****************************************************************************************** */
-#include "smx_new_api_private.h"
 
 /* Define only for SimGrid benchmarking purposes */
 //#define TIME_BENCH_PER_SR     /* this aims at measuring the time spent in each scheduling round per each thread. The code is thus run in sequential to bench separately each SSR */
@@ -108,10 +104,6 @@ typedef enum {
   SIMIX_ACTION_SLEEP,
   SIMIX_ACTION_SYNCHRO,
   SIMIX_ACTION_IO,
-  /* ****************************************************************************************** */
-  /* TUTORIAL: New API                                                                        */
-  /* ****************************************************************************************** */
-  SIMIX_ACTION_NEW_API
 } e_smx_action_type_t;
 
 typedef enum {
@@ -195,13 +187,6 @@ typedef struct s_smx_action {
       smx_host_t host;
       surf_action_t surf_io;
     } io;
-
-    /* ****************************************************************************************** */
-    /* TUTORIAL: New API                                                                        */
-    /* ****************************************************************************************** */
-    struct {
-      surf_action_t surf_new_api;
-    } new_api;
   };
 
 #ifdef HAVE_LATENCY_BOUND_TRACKING
index adf8d9d..ddc9642 100644 (file)
@@ -367,13 +367,6 @@ void SIMIX_process_kill(smx_process_t process, smx_process_t issuer) {
       SIMIX_io_destroy(process->waiting_action);
       break;
 
-      /* **************************************/
-      /* TUTORIAL: New API                    */
-    case SIMIX_ACTION_NEW_API:
-      SIMIX_new_api_destroy(process->waiting_action);
-      break;
-      /* **************************************/
-
     }
   }
   if(!xbt_dynar_member(simix_global->process_to_run, &(process)) && process != issuer) {
@@ -425,13 +418,6 @@ void SIMIX_process_throw(smx_process_t process, xbt_errcat_t cat, int value, con
       SIMIX_io_destroy(process->waiting_action);
       break;
 
-      /* **************************************/
-      /* TUTORIAL: New API                    */
-    case SIMIX_ACTION_NEW_API:
-      SIMIX_new_api_destroy(process->waiting_action);
-      break;
-      /* **************************************/
-
     }
   }
   process->waiting_action = NULL;
index 49f3745..64b588b 100644 (file)
@@ -81,12 +81,5 @@ void SIMIX_simcall_exit(smx_action_t action)
     case SIMIX_ACTION_IO:
       SIMIX_post_io(action);
       break;
-
-    /* ****************************************************************************************** */
-    /* TUTORIAL: New API                                                                        */
-    /* ****************************************************************************************** */
-    case SIMIX_ACTION_NEW_API:
-      SIMIX_post_new_api(action);
-      break;
   }
 }
index 230d0cd..7847b5f 100644 (file)
@@ -51,14 +51,6 @@ typedef struct s_smx_simcall {
 #endif
   union u_smx_scalar args[11];
   union u_smx_scalar result;
-  union {
-    struct {
-      const char* param1;
-      double param2;
-      int result;
-    } new_api;
-
-  };
 } s_smx_simcall_t, *smx_simcall_t;
 
 #if HAVE_MC
index 5717c2a..2473945 100644 (file)
@@ -1470,39 +1470,24 @@ xbt_dict_t simcall_storage_get_content(smx_storage_t storage)
   return simcall_BODY_storage_get_content(storage);
 }
 
+
+
 #ifdef HAVE_MC
 
-void *simcall_mc_snapshot(void)
-{
+void *simcall_mc_snapshot(void) {
   return simcall_BODY_mc_snapshot();
 }
 
-int simcall_mc_compare_snapshots(void *s1, void *s2){
+int simcall_mc_compare_snapshots(void *s1, void *s2) {
   return simcall_BODY_mc_compare_snapshots(s1, s2);
 }
 
-int simcall_mc_random(int min, int max)
-{
+int simcall_mc_random(int min, int max) {
   return simcall_BODY_mc_random(min, max);
 }
 
-
 #endif /* HAVE_MC */
 
-/* ****************************************************************************************** */
-/* TUTORIAL: New API                                                                          */
-/* All functions for simcall                                                                  */
-/* ****************************************************************************************** */
-int simcall_new_api_fct(const char* param1, double param2){
-  smx_simcall_t simcall = SIMIX_simcall_mine();
-  simcall->call = SIMCALL_NEW_API_INIT;
-  simcall->new_api.param1 = param1;
-  simcall->new_api.param2 = param2;
-
-  SIMIX_simcall_push(simcall->issuer);
-  return simcall->new_api.result;
-}
-
 /* ************************************************************************** */
 
 /** @brief returns a printable string representing a simcall */
index ce695aa..3b59e3c 100644 (file)
@@ -651,7 +651,6 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(msg_io);
   XBT_LOG_CONNECT(msg_kernel);
   XBT_LOG_CONNECT(msg_mailbox);
-  XBT_LOG_CONNECT(msg_new_API);
   XBT_LOG_CONNECT(msg_process);
   XBT_LOG_CONNECT(msg_synchro);
   XBT_LOG_CONNECT(msg_task);
@@ -676,7 +675,6 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(simix_io);
   XBT_LOG_CONNECT(simix_kernel);
   XBT_LOG_CONNECT(simix_network);
-  XBT_LOG_CONNECT(simix_new_api);
   XBT_LOG_CONNECT(simix_process);
   XBT_LOG_CONNECT(simix_smurf);
   XBT_LOG_CONNECT(simix_synchro);