Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Shut down the gtnets verbose output when advancing simulation clock to a given amount.
authorPedro Velho <velho@mohave.(none)>
Thu, 19 May 2011 11:50:09 +0000 (13:50 +0200)
committerPedro Velho <velho@mohave.(none)>
Thu, 19 May 2011 12:33:38 +0000 (14:33 +0200)
src/surf/gtnets/gtnets_interface.cc

index d0412ea..0d366a4 100644 (file)
@@ -124,7 +124,26 @@ double gtnets_get_flow_rx(void *metadata){
 
 // run for a given time (double)
 int gtnets_run(Time_t deltat){
+  ofstream file;
+  streambuf* sbuf;
+  double value;
+
+  if (!XBT_LOG_ISENABLED(surf_network_gtnets_interface, xbt_log_priority_debug)) {
+          file.open ("/dev/null");
+          sbuf = cout.rdbuf();
+          cout.rdbuf(file.rdbuf());
+          XBT_DEBUG("Enable GTNetS library quite mode");
+  }else {
+          XBT_DEBUG("Disable GTNetS library quite mode");
+  }
+
   gtnets_sim->run(deltat);
+
+
+  if (!XBT_LOG_ISENABLED(surf_network_gtnets_interface, xbt_log_priority_debug)) {
+          cout.rdbuf(sbuf);
+          file.close();
+  }
   return 0;
 }