Parcourir la source

Changed TraceType meaning and trace syntax (to confirm)

gbeurier il y a 7 ans
Parent
commit
ccb7039f15

+ 15 - 5
src/artis/kernel/AbstractAtomicModel.hpp

@@ -48,16 +48,25 @@ public:
     {
     {
 #ifdef WITH_TRACE
 #ifdef WITH_TRACE
         utils::Trace < utils::DoubleTime >::trace()
         utils::Trace < utils::DoubleTime >::trace()
-            << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
-                                                         utils::KERNEL)
-            << "NEW ATOMIC MODEL - "
-            << typeid(T).name();
+            << utils::TraceElement < utils::DoubleTime >(
+                   boost::core::demangle(typeid(T).name()).erase(0,6),
+                   utils::DoubleTime::null,
+                   utils::CONSTRUCT);
         utils::Trace < utils::DoubleTime >::trace().flush();
         utils::Trace < utils::DoubleTime >::trace().flush();
 #endif
 #endif
     }
     }
 
 
     virtual ~AbstractAtomicModel()
     virtual ~AbstractAtomicModel()
-    { }
+    {
+#ifdef WITH_TRACE
+        utils::Trace < utils::DoubleTime >::trace()
+            << utils::TraceElement < utils::DoubleTime >(
+                   boost::core::demangle(typeid(T).name()).erase(0,6),
+                   utils::DoubleTime::null,
+                   utils::DESTRUCT);
+        utils::Trace < utils::DoubleTime >::trace().flush();
+#endif
+    }
 
 
     virtual const Node < U >* atomic(unsigned int /* index */) const
     virtual const Node < U >* atomic(unsigned int /* index */) const
     { return this; }
     { return this; }
@@ -88,6 +97,7 @@ public:
                                                          utils::KERNEL)
                                                          utils::KERNEL)
             << "BEFORE - "
             << "BEFORE - "
             << AbstractAtomicModel < T, U, V >::path(this);
             << AbstractAtomicModel < T, U, V >::path(this);
+        utils::Trace < utils::DoubleTime >::trace().flush();
        trace_model(t);
        trace_model(t);
 #else
 #else
         (void) t;
         (void) t;

+ 15 - 15
src/artis/kernel/AbstractCoupledModel.hpp

@@ -69,10 +69,10 @@ public:
     {
     {
 #ifdef WITH_TRACE
 #ifdef WITH_TRACE
         utils::Trace < utils::DoubleTime >::trace()
         utils::Trace < utils::DoubleTime >::trace()
-            << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
-                                                         utils::KERNEL)
-            << "NEW COUPLED MODEL - "
-            << typeid(T).name();
+            << utils::TraceElement < utils::DoubleTime >(
+                   boost::core::demangle(typeid(T).name()).erase(0,6),
+                   utils::DoubleTime::null,
+                   utils::CONSTRUCT);
         utils::Trace < utils::DoubleTime >::trace().flush();
         utils::Trace < utils::DoubleTime >::trace().flush();
 #endif
 #endif
     }
     }
@@ -81,10 +81,10 @@ public:
     {
     {
 #ifdef WITH_TRACE
 #ifdef WITH_TRACE
         utils::Trace < utils::DoubleTime >::trace()
         utils::Trace < utils::DoubleTime >::trace()
-            << utils::TraceElement < utils::DoubleTime >("KERNEL", 0,
-                                                         utils::KERNEL)
-            << "DESTRUCTION - "
-            << AbstractCoupledModel < T, U, V, W >::path(this);
+            << utils::TraceElement < utils::DoubleTime >(
+                   boost::core::demangle(typeid(T).name()).erase(0,6),
+                   utils::DoubleTime::null,
+                   utils::DESTRUCT);
         utils::Trace < utils::DoubleTime >::trace().flush();
         utils::Trace < utils::DoubleTime >::trace().flush();
 #endif
 #endif
     }
     }
@@ -95,7 +95,7 @@ public:
 #ifdef WITH_TRACE
 #ifdef WITH_TRACE
         utils::Trace < utils::DoubleTime >::trace()
         utils::Trace < utils::DoubleTime >::trace()
             << utils::TraceElement < utils::DoubleTime >("KERNEL", t,
             << utils::TraceElement < utils::DoubleTime >("KERNEL", t,
-                                                         utils::KERNEL)
+                                                         utils::AFTER_COMPUTE)
             << "AFTER - "
             << "AFTER - "
             << AbstractCoupledModel < T, U, V, W >::path(this);
             << AbstractCoupledModel < T, U, V, W >::path(this);
         utils::Trace < utils::DoubleTime >::trace().flush();
         utils::Trace < utils::DoubleTime >::trace().flush();
@@ -124,7 +124,7 @@ public:
 #ifdef WITH_TRACE
 #ifdef WITH_TRACE
         utils::Trace < utils::DoubleTime >::trace()
         utils::Trace < utils::DoubleTime >::trace()
             << utils::TraceElement < utils::DoubleTime >("KERNEL", t,
             << utils::TraceElement < utils::DoubleTime >("KERNEL", t,
-                                                         utils::KERNEL)
+                                                         utils::BEFORE_COMPUTE)
             << "BEFORE - "
             << "BEFORE - "
             << AbstractCoupledModel < T, U, V, W >::path(this);
             << AbstractCoupledModel < T, U, V, W >::path(this);
         utils::Trace < utils::DoubleTime >::trace().flush();
         utils::Trace < utils::DoubleTime >::trace().flush();
@@ -299,10 +299,10 @@ public:
                     "/[" + std::to_string(i) + "]" +
                     "/[" + std::to_string(i) + "]" +
                     boost::core::demangle(typeid(*this).name());
                     boost::core::demangle(typeid(*this).name());
             } else {
             } else {
-                return p + "/" + boost::core::demangle(typeid(*this).name());
+                return p + "/" + boost::core::demangle(typeid(*this).name()).erase(0,6);
             }
             }
         } else {
         } else {
-            return boost::core::demangle(typeid(*this).name());
+            return boost::core::demangle(typeid(*this).name()).erase(0,6);
         }
         }
     }
     }
 
 
@@ -423,7 +423,7 @@ protected:
 #ifdef WITH_TRACE
 #ifdef WITH_TRACE
                 utils::Trace < utils::DoubleTime >::trace()
                 utils::Trace < utils::DoubleTime >::trace()
                         << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
                         << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
-                                                                     utils::KERNEL)
+                                                                     utils::INTERNAL_LINK)
                         << "LINK INTERNAL "
                         << "LINK INTERNAL "
                         << AbstractCoupledModel < T, U, V, W >::path(this)
                         << AbstractCoupledModel < T, U, V, W >::path(this)
                         << ":"
                         << ":"
@@ -447,7 +447,7 @@ protected:
 #ifdef WITH_TRACE
 #ifdef WITH_TRACE
                 utils::Trace < utils::DoubleTime >::trace()
                 utils::Trace < utils::DoubleTime >::trace()
                         << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
                         << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
-                                                                     utils::KERNEL)
+                                                                     utils::INTERNAL_DECL)
                         << "LINK INTERNAL "
                         << "LINK INTERNAL "
                         << AbstractCoupledModel < T, U, V, W >::path(this)
                         << AbstractCoupledModel < T, U, V, W >::path(this)
                         << ":"
                         << ":"
@@ -473,7 +473,7 @@ protected:
 #ifdef WITH_TRACE
 #ifdef WITH_TRACE
         utils::Trace < utils::DoubleTime >::trace()
         utils::Trace < utils::DoubleTime >::trace()
             << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
             << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
-                                                         utils::KERNEL)
+                                                         utils::SUBMODEL_ADD)
             << "SUBMODEL - "
             << "SUBMODEL - "
             << AbstractCoupledModel < T, U, V, W >::path(it->second)
             << AbstractCoupledModel < T, U, V, W >::path(it->second)
             << " to "
             << " to "

+ 2 - 2
src/artis/kernel/AbstractModel.hpp

@@ -96,10 +96,10 @@ public:
         if (index >= 0) {
         if (index >= 0) {
             return p +
             return p +
                 "/[" + std::to_string(index) + "]" +
                 "/[" + std::to_string(index) + "]" +
-                boost::core::demangle(typeid(*child).name());
+                boost::core::demangle(typeid(*child).name()).erase(0,6);
         } else {
         } else {
             return (p.empty() ? "" : p + "/") +
             return (p.empty() ? "" : p + "/") +
-                boost::core::demangle(typeid(*child).name());
+                boost::core::demangle(typeid(*child).name()).erase(0,6);
         }
         }
     }
     }
 
 

+ 1 - 2
src/artis/kernel/Simulator.hpp

@@ -53,14 +53,13 @@ public:
 
 
     void init(double time, const V& parameters)
     void init(double time, const V& parameters)
     {
     {
-        std::cout << "LAUNCH INIT" << std::endl;
         _model->init(time, parameters);
         _model->init(time, parameters);
         _observer.init();
         _observer.init();
 
 
 #ifdef WITH_TRACE
 #ifdef WITH_TRACE
         utils::Trace < utils::DoubleTime >::trace()
         utils::Trace < utils::DoubleTime >::trace()
             << utils::TraceElement < utils::DoubleTime >("KERNEL", 0,
             << utils::TraceElement < utils::DoubleTime >("KERNEL", 0,
-                                                         utils::KERNEL)
+                                                         utils::INIT)
             << "GLOBAL VALUES - "
             << "GLOBAL VALUES - "
             << _model->path(_model);
             << _model->path(_model);
         utils::Trace < utils::DoubleTime >::trace().flush();
         utils::Trace < utils::DoubleTime >::trace().flush();

+ 2 - 2
src/test/test-context.cpp

@@ -58,7 +58,7 @@ int main()
                        modelParameters);
                        modelParameters);
         simulator.run(context);
         simulator.run(context);
 
 
-        std::cout << ::Trace::trace().elements().to_string() << std::endl;
+        std::cout << ::Trace::trace().elements().to_string(artis::utils::DATE_FORMAT_YMD) << std::endl;
 
 
         simulator.save(context);
         simulator.save(context);
 
 
@@ -83,7 +83,7 @@ int main()
             artis::utils::DateTime::toJulianDayNumber("2016-1-10"));
             artis::utils::DateTime::toJulianDayNumber("2016-1-10"));
         simulator.run(new_context);
         simulator.run(new_context);
 
 
-        std::cout << ::Trace::trace().elements().to_string() << std::endl;
+        std::cout << ::Trace::trace().elements().filter_type(artis::utils::COMPUTE).to_string() << std::endl;
     }
     }
 
 
     std::cout << "==== PAUSE ====" << std::endl;
     std::cout << "==== PAUSE ====" << std::endl;