Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
improve the debug logs produced by the route seeking mechanism
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 28 Nov 2016 21:16:55 +0000 (22:16 +0100)
committerMartin Quinson <martin.quinson@loria.fr>
Mon, 28 Nov 2016 21:16:55 +0000 (22:16 +0100)
src/kernel/routing/AsImpl.cpp
src/surf/surf_routing.cpp
src/surf/surf_routing.hpp
src/xbt/log.c

index 7eb664b..f4afb7e 100644 (file)
@@ -8,9 +8,9 @@
 #include "simgrid/s4u/host.hpp"
 #include "src/kernel/routing/AsImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
 #include "simgrid/s4u/host.hpp"
 #include "src/kernel/routing/AsImpl.hpp"
 #include "src/surf/cpu_interface.hpp"
-#include "src/surf/network_interface.hpp" // Link FIXME: move to proper header
+#include "src/surf/network_interface.hpp"
 
 
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(AsImpl,surf, "Implementation of S4U autonomous systems");
+XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(surf_route);
 
 namespace simgrid {
   namespace kernel {
 
 namespace simgrid {
   namespace kernel {
@@ -164,7 +164,6 @@ namespace simgrid {
                               /* OUT */ std::vector<surf::Link*>* links, double* latency)
   {
     // If never set a bypass route return nullptr without any further computations
                               /* OUT */ std::vector<surf::Link*>* links, double* latency)
   {
     // If never set a bypass route return nullptr without any further computations
-    XBT_DEBUG("generic_get_bypassroute from %s to %s", src->name().c_str(), dst->name().c_str());
     if (bypassRoutes_.empty())
       return false;
 
     if (bypassRoutes_.empty())
       return false;
 
@@ -177,7 +176,8 @@ namespace simgrid {
           if (latency)
             *latency += link->latency();
         }
           if (latency)
             *latency += link->latency();
         }
-        XBT_DEBUG("Found a bypass route with %zu links", bypassedRoute->links.size());
+        XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links", src->cname(), dst->cname(),
+                  bypassedRoute->links.size());
         return true;
       }
       return false;
         return true;
       }
       return false;
@@ -248,6 +248,9 @@ namespace simgrid {
 
     /* (4) If we have the bypass, use it. If not, caller will do the Right Thing. */
     if (bypassedRoute) {
 
     /* (4) If we have the bypass, use it. If not, caller will do the Right Thing. */
     if (bypassedRoute) {
+      XBT_DEBUG("Found a bypass route from '%s' to '%s' with %zu links. We may have to complete it with recursive "
+                "calls to getRoute",
+                src->cname(), dst->cname(), bypassedRoute->links.size());
       if (src != key.first)
         getGlobalRoute(src, const_cast<NetCard*>(bypassedRoute->gw_src), links, latency);
       for (surf::Link* link : bypassedRoute->links) {
       if (src != key.first)
         getGlobalRoute(src, const_cast<NetCard*>(bypassedRoute->gw_src), links, latency);
       for (surf::Link* link : bypassedRoute->links) {
@@ -259,6 +262,7 @@ namespace simgrid {
         getGlobalRoute(const_cast<NetCard*>(bypassedRoute->gw_dst), dst, links, latency);
       return true;
     }
         getGlobalRoute(const_cast<NetCard*>(bypassedRoute->gw_dst), dst, links, latency);
       return true;
     }
+    XBT_DEBUG("No bypass route from '%s' to '%s'.", src->cname(), dst->cname());
     return false;
     }
 
     return false;
     }
 
@@ -268,7 +272,7 @@ namespace simgrid {
       s_sg_platf_route_cbarg_t route;
       memset(&route,0,sizeof(route));
 
       s_sg_platf_route_cbarg_t route;
       memset(&route,0,sizeof(route));
 
-      XBT_DEBUG("Solve route/latency \"%s\" to \"%s\"", src->name().c_str(), dst->name().c_str());
+      XBT_DEBUG("Resolve route from '%s' to '%s'", src->cname(), dst->cname());
 
       /* Find how src and dst are interconnected */
       AsImpl *common_ancestor, *src_ancestor, *dst_ancestor;
 
       /* Find how src and dst are interconnected */
       AsImpl *common_ancestor, *src_ancestor, *dst_ancestor;
index 16aa917..39096a0 100644 (file)
 
 #include <simgrid/s4u/host.hpp>
 
 
 #include <simgrid/s4u/host.hpp>
 
-#include "surf_routing.hpp"
+#include "src/surf/surf_routing.hpp"
 
 #include "simgrid/sg_config.h"
 
 #include "simgrid/sg_config.h"
-#include "storage_interface.hpp"
+#include "src/surf/storage_interface.hpp"
 
 #include "src/kernel/routing/AsImpl.hpp"
 
 #include "src/kernel/routing/AsImpl.hpp"
+#include "src/surf/network_interface.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_route, surf, "Routing part of surf");
 
@@ -94,9 +95,13 @@ namespace routing {
  */
 void RoutingPlatf::getRouteAndLatency(NetCard *src, NetCard *dst, std::vector<Link*> * route, double *latency)
 {
  */
 void RoutingPlatf::getRouteAndLatency(NetCard *src, NetCard *dst, std::vector<Link*> * route, double *latency)
 {
-  XBT_DEBUG("getRouteAndLatency from %s to %s", src->name().c_str(), dst->name().c_str());
-
   AsImpl::getGlobalRoute(src, dst, route, latency);
   AsImpl::getGlobalRoute(src, dst, route, latency);
+  if (XBT_LOG_ISENABLED(surf_route, xbt_log_priority_debug)) {
+    XBT_DEBUG("Route from '%s' to '%s' (latency: %f):", src->cname(), dst->cname(),
+              (latency == nullptr ? -1 : *latency));
+    for (auto link : *route)
+      XBT_DEBUG("Link %s", link->getName());
+  }
 }
 
 }}}
 }
 
 }}}
index e18ccc5..dbedf32 100644 (file)
@@ -1,5 +1,4 @@
-/* Copyright (c) 2013-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2013-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. */
@@ -11,7 +10,6 @@
 #include <xbt/signal.hpp>
 
 #include "surf_interface.hpp"
 #include <xbt/signal.hpp>
 
 #include "surf_interface.hpp"
-#include "src/surf/xml/platf_private.hpp" // FIXME: including this here is pure madness. KILKILKIL XML.
 #include "src/kernel/routing/AsImpl.hpp"
 
 #include <float.h>
 #include "src/kernel/routing/AsImpl.hpp"
 
 #include <float.h>
@@ -46,7 +44,8 @@ public:
   virtual ~NetCard()            = default;
   virtual unsigned int id()=0; // Our rank in the vertices_ array of our containing AS.
   virtual std::string name()    = 0;
   virtual ~NetCard()            = default;
   virtual unsigned int id()=0; // Our rank in the vertices_ array of our containing AS.
   virtual std::string name()    = 0;
-  virtual AsImpl *containingAS()=0; // This is the AS in which I am
+  virtual const char* cname()    = 0;
+  virtual AsImpl* containingAS() = 0; // This is the AS in which I am
   virtual bool isAS()=0;
   virtual bool isHost()=0;
   virtual bool isRouter()=0;
   virtual bool isAS()=0;
   virtual bool isHost()=0;
   virtual bool isRouter()=0;
@@ -68,6 +67,7 @@ public:
 
   unsigned int id()  override {return id_;}
   std::string name() override { return name_; }
 
   unsigned int id()  override {return id_;}
   std::string name() override { return name_; }
+  const char* cname() override { return name_.c_str(); }
   AsImpl *containingAS() override {return containingAS_;}
 
   bool isAS()        override {return componentType_ == Type::As;}
   AsImpl *containingAS() override {return containingAS_;}
 
   bool isAS()        override {return componentType_ == Type::As;}
index 0f076b4..7f0775d 100644 (file)
@@ -264,9 +264,6 @@ static void xbt_log_connect_categories(void)
   XBT_LOG_CONNECT(surf_trace);
   XBT_LOG_CONNECT(surf_vm);
   XBT_LOG_CONNECT(surf_host);
   XBT_LOG_CONNECT(surf_trace);
   XBT_LOG_CONNECT(surf_vm);
   XBT_LOG_CONNECT(surf_host);
-
-  /* routing */
-  XBT_LOG_CONNECT(AsImpl);
    
 #endif /* simgrid_EXPORTS */
 }
    
 #endif /* simgrid_EXPORTS */
 }