Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
when parallel ctests are performed, using the default tracing filename may cause...
[simgrid.git] / src / surf / new_model.c
index 76a6086..b4346d9 100644 (file)
@@ -1,8 +1,8 @@
-/* Copyright (c) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012. The SimGrid Team.
- * All rights reserved.                                                                 */
+/* Copyright (c) 2004-2013. 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.             */
+ * under the terms of the license (GNU LGPL) which comes with this package. */
 
 /* ********************************************************************* */
 /* TUTORIAL: New model                                                   */
@@ -10,7 +10,6 @@
 
 #include "xbt/ex.h"
 #include "xbt/dict.h"
-#include "xbt/file_stat.h"
 #include "portable.h"
 #include "surf_private.h"
 #include "new_model_private.h"
@@ -29,13 +28,6 @@ static xbt_swag_t
 #define GENERIC_ACTION(action) GENERIC_LMM_ACTION(action).generic_action
 
 static void new_model_action_state_set(surf_action_t action, e_surf_action_state_t state);
-static surf_action_t new_model_action_execute ();
-
-static surf_action_t new_model_action_fct()
-{
-  surf_action_t action = new_model_action_execute();
-  return action;
-}
 
 static surf_action_t new_model_action_execute ()
 {
@@ -43,6 +35,12 @@ static surf_action_t new_model_action_execute ()
   return NULL;
 }
 
+static surf_action_t new_model_action_fct()
+{
+  surf_action_t action = new_model_action_execute();
+  return action;
+}
+
 static void* new_model_create_resource(const char* id, const char* model,const char* type_id,const char* content_name)
 {
   THROW_UNIMPLEMENTED;
@@ -51,18 +49,25 @@ static void* new_model_create_resource(const char* id, const char* model,const c
 
 static void new_model_finalize(void)
 {
-  THROW_UNIMPLEMENTED;
+  lmm_system_free(new_model_maxmin_system);
+  new_model_maxmin_system = NULL;
+
+  surf_model_exit(surf_new_model);
+  surf_new_model = NULL;
+
+  xbt_swag_free
+      (new_model_running_action_set_that_does_not_need_being_checked);
+  new_model_running_action_set_that_does_not_need_being_checked = NULL;
 }
 
 static void new_model_update_actions_state(double now, double delta)
 {
-  THROW_UNIMPLEMENTED;
+  return;
 }
 
 static double new_model_share_resources(double NOW)
 {
-  THROW_UNIMPLEMENTED;
-  return 0;
+  return -1;
 }
 
 static int new_model_resource_used(void *resource_id)
@@ -131,7 +136,7 @@ static void new_model_define_callbacks()
 {
 }
 
-static void surf_new_model_model_init_internal(void)
+static void surf_new_model_init_internal(void)
 {
   s_surf_action_t action;
 
@@ -141,7 +146,7 @@ static void surf_new_model_model_init_internal(void)
   new_model_running_action_set_that_does_not_need_being_checked =
       xbt_swag_new(xbt_swag_offset(action, state_hookup));
 
-  surf_new_model->name = "Storage";
+  surf_new_model->name = "New Model";
   surf_new_model->action_unref = new_model_action_unref;
   surf_new_model->action_cancel = new_model_action_cancel;
   surf_new_model->action_state_set = new_model_action_state_set;
@@ -167,9 +172,9 @@ static void surf_new_model_model_init_internal(void)
 
 }
 
-void surf_new_model_model_init_default(void)
+void surf_new_model_init_default(void)
 {
-  surf_new_model_model_init_internal();
+  surf_new_model_init_internal();
   new_model_define_callbacks();
 
   xbt_dynar_push(model_list, &surf_new_model);