Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move Virtu functions into the gras_os_ namespace
authormquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 22 Jul 2004 03:12:33 +0000 (03:12 +0000)
committermquinson <mquinson@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 22 Jul 2004 03:12:33 +0000 (03:12 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@304 48e7efb5-ca39-0410-a469-dd3cf9ba447f

TODO
include/virtu.h
src/gras/Msg/msg.c
src/gras/Transport/rl_transport.c
src/gras/Transport/sg_transport.c
src/gras/Virtu/rl_time.c
src/gras/Virtu/sg_time.c

diff --git a/TODO b/TODO
index 10c40b0..4ee5c6f 100644 (file)
--- a/TODO
+++ b/TODO
 ### Avant 1.0
 ###
 
-- renomages     
-  gras_os_time
-  gras_os_sleep
-  gras_os_getload
+- gras_os_getload
 
 - gras_datadesc_import_nws
 
index 2466a33..a57ccdb 100644 (file)
 BEGIN_DECL
 
 /**
- * gras_time:
+ * gras_os_time:
  * 
  * Get the time in number of second since the Epoch.
  * (00:00:00 UTC, January 1, 1970 in Real Life, and begining of simulation in SG)
  */
-double gras_time(void);
+double gras_os_time(void);
 
 /**
- * gras_sleep:
+ * gras_os_sleep:
  * @sec: number of seconds to sleep
  * @usec: number of microseconds to sleep
  * 
  * sleeps for the given amount of seconds plus the given amount of microseconds.
  */
-void gras_sleep(unsigned long sec, unsigned long usec);
+void gras_os_sleep(unsigned long sec, unsigned long usec);
 
 END_DECL
 
index ec5831d..91d5aca 100644 (file)
@@ -91,9 +91,8 @@ static char *make_namev(const char *name, short int ver) {
  */
 gras_error_t
 gras_msgtype_declare(const char            *name,
-                    gras_datadesc_type_t  *payload,
-                    gras_msgtype_t       **dst) {
-  return gras_msgtype_declare_v(name, 0, payload, dst);
+                    gras_datadesc_type_t  *payload) {
+  return gras_msgtype_declare_v(name, 0, payload);
 }
 
 /**
@@ -111,8 +110,7 @@ gras_msgtype_declare(const char            *name,
 gras_error_t
 gras_msgtype_declare_v(const char            *name,
                       short int              version,
-                      gras_datadesc_type_t  *payload,
-                      gras_msgtype_t       **dst) {
+                      gras_datadesc_type_t  *payload) {
  
   gras_error_t    errcode;
   gras_msgtype_t *msgtype;
@@ -151,7 +149,7 @@ gras_msgtype_declare_v(const char            *name,
 
   TRY(gras_set_add(_gras_msgtype_set, (gras_set_elm_t*)msgtype,
                   &gras_msgtype_free));
-
+   
   return no_error;
 }
 
@@ -293,7 +291,7 @@ gras_msg_wait(double                 timeout,
 
   VERB1("Waiting for message %s",msgt_want->name);
 
-  start = now = gras_time();
+  start = now = gras_os_time();
 
   gras_dynar_foreach(pd->msg_queue,cpt,msg){
     if (msg.type->code == msgt_want->code) {
@@ -323,7 +321,7 @@ gras_msg_wait(double                 timeout,
     msg.payload_size = payload_size_got;
     TRY(gras_dynar_push(pd->msg_queue,&msg));
     
-    now=gras_time();
+    now=gras_os_time();
     if (now - start + 0.001 < timeout) {
       RAISE1(timeout_error,"Timeout while waiting for msg %s",msgt_want->name);
     }
index 858ba73..1dfa236 100644 (file)
@@ -36,7 +36,7 @@ gras_trp_select(double timeout,
   gras_error_t errcode;
   gras_dynar_t *sockets= gras_socketset_get();
   int done = -1;
-  double wakeup = gras_time() + 1000000*timeout;
+  double wakeup = gras_os_time() + 1000000*timeout;
   double now = 0;
   /* nextToService used to make sure socket with high number do not starve */
   //  static int nextToService = 0;
@@ -52,7 +52,7 @@ gras_trp_select(double timeout,
   *dst=NULL;
   while (done == -1) {
     if (timeout > 0) { /* did we timeout already? */
-      now = gras_time();
+      now = gras_os_time();
       if (now == -1 || now >= wakeup) {
        done = 0;       /* didn't find anything */
        break;
index b17f5fc..80bf996 100644 (file)
@@ -31,7 +31,7 @@ gras_trp_select(double timeout,
                gras_socket_t **dst) {
 
   gras_error_t errcode;
-  double startTime=gras_time();
+  double startTime=gras_os_time();
   gras_procdata_t *pd=gras_procdata_get();
   gras_trp_sg_sock_data_t *sockdata;
   gras_trp_plugin_t *trp;
@@ -138,7 +138,7 @@ gras_trp_select(double timeout,
       // MSG_process_sleep(1);
       MSG_process_sleep(0.01);
     }
-  } while (gras_time()-startTime < timeout
+  } while (gras_os_time()-startTime < timeout
           || MSG_task_Iprobe((m_channel_t) pd->chan));
 
   return timeout_error;
index c65d261..f9d8074 100644 (file)
@@ -11,7 +11,7 @@
 #include "gras_private.h"
 #include <sys/time.h>   /* gettimeofday() */
 
-double gras_time() {
+double gras_os_time() {
   struct timeval tv;
 
   gettimeofday(&tv, NULL);
@@ -19,7 +19,7 @@ double gras_time() {
   return (double)(tv.tv_sec * 1000000 + tv.tv_usec);
 }
  
-void gras_sleep(unsigned long sec,unsigned long usec) {
+void gras_os_sleep(unsigned long sec,unsigned long usec) {
   sleep(sec);
   if (usec/1000000) sleep(usec/1000000);
 
index 1f50a85..f71c8b3 100644 (file)
 
 #include "Virtu/virtu_sg.h"
 
-double gras_time() {
+/**
+ * gras_time:
+ * @Returns: The current time
+ * 
+ * The epoch since when the time is given is not specified. It is thus only usefull to compute intervals
+ */
+double gras_os_time() {
   return MSG_getClock();
 }
-void gras_sleep(unsigned long sec,unsigned long usec) {
+
+/**
+ * gras_sleep:
+ * @sec: amount of sec to sleep
+ * @usec: amount of micro second to sleep
+ * 
+ * Freeze the process for the specified amount of time
+ */
+void gras_os_sleep(unsigned long sec,unsigned long usec) {
   MSG_process_sleep((double)sec + ((double)usec)/1000000);
 }