Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Adding Derrick's function to check whether a host is up or down.
authoralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 23 Feb 2006 11:46:23 +0000 (11:46 +0000)
committeralegrand <alegrand@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Thu, 23 Feb 2006 11:46:23 +0000 (11:46 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@1933 48e7efb5-ca39-0410-a469-dd3cf9ba447f

include/msg/msg.h
src/msg/host.c

index 1ad3093..4a570b6 100644 (file)
@@ -38,6 +38,7 @@ m_host_t MSG_host_self(void);
 int MSG_get_host_msgload(m_host_t host);
 /* int MSG_get_msgload(void); This function lacks specification; discard it */
 double MSG_get_host_speed(m_host_t h);
 int MSG_get_host_msgload(m_host_t host);
 /* int MSG_get_msgload(void); This function lacks specification; discard it */
 double MSG_get_host_speed(m_host_t h);
+int MSG_host_is_avail (m_host_t h);
 
 void MSG_create_environment(const char *file);
 
 
 void MSG_create_environment(const char *file);
 
index 8e2fd41..b252d89 100644 (file)
@@ -185,3 +185,21 @@ double MSG_get_host_speed(m_host_t h)
   return(surf_workstation_resource->
         extension_public->get_speed(h->simdata->host,1.0));
 }
   return(surf_workstation_resource->
         extension_public->get_speed(h->simdata->host,1.0));
 }
+
+/** \ingroup msg_gos_functions
+ * \brief Determine if a host is available.
+ *
+ * \param host host to test
+ */
+int MSG_host_is_avail (m_host_t h)
+{
+  xbt_assert0((h!= NULL), "Invalid parameters");
+
+  e_surf_cpu_state_t cpustate =
+    surf_workstation_resource->extension_public->get_state(h->simdata->host);
+
+  xbt_assert0((cpustate == SURF_CPU_ON || cpustate == SURF_CPU_OFF),
+             "Invalid cpu state");
+
+  return (cpustate==SURF_CPU_ON);
+}