Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
SIMIX_comm_get_remains() -> simgrid::simix::Comm::remains()
authorMartin Quinson <martin.quinson@loria.fr>
Sun, 8 May 2016 19:44:43 +0000 (21:44 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Sun, 8 May 2016 19:44:49 +0000 (21:44 +0200)
+ kill that getter simcall, there is no need

12 files changed:
include/simgrid/simix.h
src/msg/msg_task.cpp
src/simix/SynchroComm.cpp
src/simix/SynchroComm.hpp
src/simix/libsmx.cpp
src/simix/popping_accessors.h
src/simix/popping_bodies.cpp
src/simix/popping_enum.h
src/simix/popping_generated.cpp
src/simix/simcalls.in
src/simix/smx_network.cpp
src/simix/smx_network_private.h

index 85503b3..0cfad7f 100644 (file)
@@ -398,7 +398,6 @@ XBT_PUBLIC(int) simcall_comm_test(smx_synchro_t comm);
 XBT_PUBLIC(int) simcall_comm_testany(xbt_dynar_t comms);
 
 /* Getters and setters */
 XBT_PUBLIC(int) simcall_comm_testany(xbt_dynar_t comms);
 
 /* Getters and setters */
-XBT_PUBLIC(double) simcall_comm_get_remains(smx_synchro_t comm);
 XBT_PUBLIC(void *) simcall_comm_get_src_data(smx_synchro_t comm);
 XBT_PUBLIC(void *) simcall_comm_get_dst_data(smx_synchro_t comm);
 XBT_PUBLIC(smx_process_t) simcall_comm_get_src_proc(smx_synchro_t comm);
 XBT_PUBLIC(void *) simcall_comm_get_src_data(smx_synchro_t comm);
 XBT_PUBLIC(void *) simcall_comm_get_dst_data(smx_synchro_t comm);
 XBT_PUBLIC(smx_process_t) simcall_comm_get_src_proc(smx_synchro_t comm);
index 783715c..33a386e 100644 (file)
@@ -287,9 +287,8 @@ void MSG_task_set_bytes_amount(msg_task_t task, double data_size)
  */
 double MSG_task_get_remaining_communication(msg_task_t task)
 {
  */
 double MSG_task_get_remaining_communication(msg_task_t task)
 {
-  xbt_assert((task != NULL) && (task->simdata != NULL), "Invalid parameter");
   XBT_DEBUG("calling simcall_communication_get_remains(%p)", task->simdata->comm);
   XBT_DEBUG("calling simcall_communication_get_remains(%p)", task->simdata->comm);
-  return simcall_comm_get_remains(task->simdata->comm);
+  return task->simdata->comm->remains();
 }
 
 /** \ingroup m_task_management
 }
 
 /** \ingroup m_task_management
index 8d3b6e8..74f8492 100644 (file)
@@ -49,3 +49,22 @@ void simgrid::simix::Comm::cancel() {
     surf_comm->cancel();
   }
 }
     surf_comm->cancel();
   }
 }
+
+/**  @brief get the amount remaining from the communication */
+double simgrid::simix::Comm::remains() {
+  switch (state) {
+
+  case SIMIX_RUNNING:
+    return surf_comm->getRemains();
+    break;
+
+  case SIMIX_WAITING:
+  case SIMIX_READY:
+    return 0; /*FIXME: check what should be returned */
+    break;
+
+  default:
+    return 0; /*FIXME: is this correct? */
+    break;
+  }
+}
index 2a2f661..bdcc41e 100644 (file)
@@ -25,6 +25,7 @@ namespace simix {
     void suspend();
     void resume();
     void cancel();
     void suspend();
     void resume();
     void cancel();
+    double remains();
 
     e_smx_comm_type_t type;         /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */
     smx_mailbox_t mbox = nullptr;   /* Rendez-vous where the comm is queued */
 
     e_smx_comm_type_t type;         /* Type of the communication (SIMIX_COMM_SEND or SIMIX_COMM_RECEIVE) */
     smx_mailbox_t mbox = nullptr;   /* Rendez-vous where the comm is queued */
index 883d2c7..f15f002 100644 (file)
@@ -888,15 +888,6 @@ int simcall_comm_test(smx_synchro_t comm)
   return simcall_BODY_comm_test(comm);
 }
 
   return simcall_BODY_comm_test(comm);
 }
 
-/**
- * \ingroup simix_comm_management
- *
- */
-double simcall_comm_get_remains(smx_synchro_t comm)
-{
-  return simcall_BODY_comm_get_remains(comm);
-}
-
 /**
  * \ingroup simix_comm_management
  *
 /**
  * \ingroup simix_comm_management
  *
index e336da9..c694b14 100644 (file)
@@ -823,19 +823,6 @@ static inline void simcall_comm_testany__set__result(smx_simcall_t simcall, int
     simcall->result.i = result;
 }
 
     simcall->result.i = result;
 }
 
-static inline smx_synchro_t simcall_comm_get_remains__get__comm(smx_simcall_t simcall) {
-  return (smx_synchro_t) simcall->args[0].dp;
-}
-static inline void simcall_comm_get_remains__set__comm(smx_simcall_t simcall, void* arg) {
-    simcall->args[0].dp = arg;
-}
-static inline double simcall_comm_get_remains__get__result(smx_simcall_t simcall){
-    return  simcall->result.d;
-}
-static inline void simcall_comm_get_remains__set__result(smx_simcall_t simcall, double result){
-    simcall->result.d = result;
-}
-
 static inline smx_synchro_t simcall_comm_get_src_data__get__comm(smx_simcall_t simcall) {
   return (smx_synchro_t) simcall->args[0].dp;
 }
 static inline smx_synchro_t simcall_comm_get_src_data__get__comm(smx_simcall_t simcall) {
   return (smx_synchro_t) simcall->args[0].dp;
 }
index b7d5be4..4c1e438 100644 (file)
@@ -947,27 +947,6 @@ inline static int simcall_BODY_comm_testany(xbt_dynar_t comms) {
     return (int) self->simcall.result.i;
   }
   
     return (int) self->simcall.result.i;
   }
   
-inline static double simcall_BODY_comm_get_remains(smx_synchro_t comm) {
-    smx_process_t self = SIMIX_process_self();
-
-    /* Go to that function to follow the code flow through the simcall barrier */
-    if (0) SIMIX_comm_get_remains(comm);
-    /* end of the guide intended to the poor programmer wanting to go from MSG to Surf */
-
-    self->simcall.call = SIMCALL_COMM_GET_REMAINS;
-    memset(&self->simcall.result, 0, sizeof(self->simcall.result));
-    memset(self->simcall.args, 0, sizeof(self->simcall.args));
-    self->simcall.args[0].dp = (void*) comm;
-    if (self != simix_global->maestro_process) {
-      XBT_DEBUG("Yield process '%s' on simcall %s (%d)", self->name,
-                SIMIX_simcall_name(self->simcall.call), (int)self->simcall.call);
-      SIMIX_process_yield(self);
-    } else {
-      SIMIX_simcall_handle(&self->simcall, 0);
-    }    
-    return (double) self->simcall.result.d;
-  }
-  
 inline static void* simcall_BODY_comm_get_src_data(smx_synchro_t comm) {
     smx_process_t self = SIMIX_process_self();
 
 inline static void* simcall_BODY_comm_get_src_data(smx_synchro_t comm) {
     smx_process_t self = SIMIX_process_self();
 
index 3ad74e6..fca277b 100644 (file)
@@ -59,7 +59,6 @@ typedef enum {
   SIMCALL_COMM_WAIT,
   SIMCALL_COMM_TEST,
   SIMCALL_COMM_TESTANY,
   SIMCALL_COMM_WAIT,
   SIMCALL_COMM_TEST,
   SIMCALL_COMM_TESTANY,
-  SIMCALL_COMM_GET_REMAINS,
   SIMCALL_COMM_GET_SRC_DATA,
   SIMCALL_COMM_GET_DST_DATA,
   SIMCALL_COMM_GET_SRC_PROC,
   SIMCALL_COMM_GET_SRC_DATA,
   SIMCALL_COMM_GET_DST_DATA,
   SIMCALL_COMM_GET_SRC_PROC,
index c580366..5e9e1e0 100644 (file)
@@ -64,7 +64,6 @@ const char* simcall_names[] = {
   "SIMCALL_COMM_WAIT",
   "SIMCALL_COMM_TEST",
   "SIMCALL_COMM_TESTANY",
   "SIMCALL_COMM_WAIT",
   "SIMCALL_COMM_TEST",
   "SIMCALL_COMM_TESTANY",
-  "SIMCALL_COMM_GET_REMAINS",
   "SIMCALL_COMM_GET_SRC_DATA",
   "SIMCALL_COMM_GET_DST_DATA",
   "SIMCALL_COMM_GET_SRC_PROC",
   "SIMCALL_COMM_GET_SRC_DATA",
   "SIMCALL_COMM_GET_DST_DATA",
   "SIMCALL_COMM_GET_SRC_PROC",
@@ -309,11 +308,6 @@ case SIMCALL_COMM_TESTANY:
        simcall_HANDLER_comm_testany(simcall , (xbt_dynar_t) simcall->args[0].dp);
        break;  
 
        simcall_HANDLER_comm_testany(simcall , (xbt_dynar_t) simcall->args[0].dp);
        break;  
 
-case SIMCALL_COMM_GET_REMAINS:
-      simcall->result.d = SIMIX_comm_get_remains((smx_synchro_t) simcall->args[0].dp);
-      SIMIX_simcall_answer(simcall);
-      break;  
-
 case SIMCALL_COMM_GET_SRC_DATA:
       simcall->result.dp = SIMIX_comm_get_src_data((smx_synchro_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
 case SIMCALL_COMM_GET_SRC_DATA:
       simcall->result.dp = SIMIX_comm_get_src_data((smx_synchro_t) simcall->args[0].dp);
       SIMIX_simcall_answer(simcall);
index e75dd4e..8e2315c 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2014. The SimGrid Team. All rights reserved.
+# Copyright (c) 2014-2016. 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.
 
 # 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.
@@ -92,7 +92,6 @@ Blck H comm_waitany (int) (comms, void*, xbt_dynar_t)
 Blck H comm_wait (void) (comm, void*, smx_synchro_t) (timeout, double)
 Blck H comm_test (int) (comm, void*, smx_synchro_t)
 Blck H comm_testany (int) (comms, void*, xbt_dynar_t)
 Blck H comm_wait (void) (comm, void*, smx_synchro_t) (timeout, double)
 Blck H comm_test (int) (comm, void*, smx_synchro_t)
 Blck H comm_testany (int) (comms, void*, xbt_dynar_t)
-Func - comm_get_remains (double) (comm, void*, smx_synchro_t)
 Func - comm_get_src_data (void*) (comm, void*, smx_synchro_t)
 Func - comm_get_dst_data (void*) (comm, void*, smx_synchro_t)
 Func - comm_get_src_proc (void*, smx_process_t) (comm, void*, smx_synchro_t)
 Func - comm_get_src_data (void*) (comm, void*, smx_synchro_t)
 Func - comm_get_dst_data (void*) (comm, void*, smx_synchro_t)
 Func - comm_get_src_proc (void*, smx_process_t) (comm, void*, smx_synchro_t)
index ff2dd37..9272704 100644 (file)
@@ -361,7 +361,7 @@ smx_synchro_t SIMIX_comm_irecv(smx_process_t dst_proc, smx_mailbox_t mbox, void
     } else {
       simgrid::simix::Comm *other_comm = static_cast<simgrid::simix::Comm*>(other_synchro);
 
     } else {
       simgrid::simix::Comm *other_comm = static_cast<simgrid::simix::Comm*>(other_synchro);
 
-      if(other_comm->surf_comm && SIMIX_comm_get_remains(other_comm)==0.0) {
+      if(other_comm->surf_comm && other_comm->remains()==0.0) {
         XBT_DEBUG("comm %p has been already sent, and is finished, destroy it",other_comm);
         other_comm->state = SIMIX_DONE;
         other_comm->type = SIMIX_COMM_DONE;
         XBT_DEBUG("comm %p has been already sent, and is finished, destroy it",other_comm);
         other_comm->state = SIMIX_DONE;
         other_comm->type = SIMIX_COMM_DONE;
@@ -814,35 +814,6 @@ void SIMIX_post_comm(smx_synchro_t synchro)
 
 /************* synchro Getters **************/
 
 
 /************* synchro Getters **************/
 
-/**
- *  \brief get the amount remaining from the communication
- *  \param synchro The communication
- */
-double SIMIX_comm_get_remains(smx_synchro_t synchro)
-{
-  if(!synchro)
-    return 0;
-  simgrid::simix::Comm *comm = static_cast<simgrid::simix::Comm*>(synchro);
-
-  double remains;
-  switch (synchro->state) {
-
-  case SIMIX_RUNNING:
-    remains = comm->surf_comm->getRemains();
-    break;
-
-  case SIMIX_WAITING:
-  case SIMIX_READY:
-    remains = 0; /*FIXME: check what should be returned */
-    break;
-
-  default:
-    remains = 0; /*FIXME: is this correct? */
-    break;
-  }
-  return remains;
-}
-
 /**
  *  \brief Return the user data associated to the sender of the communication
  *  \param synchro The communication
 /**
  *  \brief Return the user data associated to the sender of the communication
  *  \param synchro The communication
index a215ff2..8e54a8a 100644 (file)
@@ -39,7 +39,6 @@ XBT_PRIVATE void SIMIX_comm_destroy_internal_actions(smx_synchro_t synchro);
 XBT_PRIVATE smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_mailbox_t mbox, int type, int src,
                               int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data);
 XBT_PRIVATE void SIMIX_post_comm(smx_synchro_t synchro);
 XBT_PRIVATE smx_synchro_t SIMIX_comm_iprobe(smx_process_t dst_proc, smx_mailbox_t mbox, int type, int src,
                               int tag, int (*match_fun)(void *, void *, smx_synchro_t), void *data);
 XBT_PRIVATE void SIMIX_post_comm(smx_synchro_t synchro);
-XBT_PRIVATE double SIMIX_comm_get_remains(smx_synchro_t synchro);
 XBT_PRIVATE smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro);
 XBT_PRIVATE smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro);
 
 XBT_PRIVATE smx_process_t SIMIX_comm_get_src_proc(smx_synchro_t synchro);
 XBT_PRIVATE smx_process_t SIMIX_comm_get_dst_proc(smx_synchro_t synchro);