ソースを参照

Refactored kernel traces

gbeurier 7 年 前
コミット
ac5457e2a2
3 ファイル変更35 行追加43 行削除
  1. 19 22
      src/artis/kernel/Externals.hpp
  2. 12 14
      src/artis/kernel/Internals.hpp
  3. 4 7
      src/artis/kernel/Simulator.hpp

+ 19 - 22
src/artis/kernel/Externals.hpp

@@ -88,12 +88,11 @@ public:
 
 #ifdef WITH_TRACE
             utils::Trace < utils::DoubleTime >::trace()
-                    << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
-                                                                 utils::KERNEL)
-                    << "EXTERNAL - "
-                    << dynamic_cast<T*>(this)->path(dynamic_cast<T*>(this))
-                    << " declare "
-                    << it->name;
+                    << utils::TraceElement < utils::DoubleTime >(
+                           dynamic_cast<T*>(this)->path(dynamic_cast<T*>(this)),
+                           utils::DoubleTime::null,
+                           utils::EXTERNAL_DECL)
+                    << utils::KernelInfo(it->name, false);
             utils::Trace < utils::DoubleTime >::trace().flush();
 #endif
         }
@@ -110,14 +109,13 @@ public:
         external_names[index] = name;
 
 #ifdef WITH_TRACE
-            utils::Trace < utils::DoubleTime >::trace()
-                    << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
-                                                                 utils::KERNEL)
-                    << "EXTERNAL - "
-                    << dynamic_cast<T*>(this)->path(dynamic_cast<T*>(this)) //useless submodels not added yet
-                    << " declare "
-                    << name;
-            utils::Trace < utils::DoubleTime >::trace().flush();
+        utils::Trace < utils::DoubleTime >::trace()
+                << utils::TraceElement < utils::DoubleTime >(
+                       dynamic_cast<T*>(this)->path(dynamic_cast<T*>(this)),
+                       utils::DoubleTime::null,
+                       utils::EXTERNAL_DECL)
+                << utils::KernelInfo(name, false);
+        utils::Trace < utils::DoubleTime >::trace().flush();
 #endif
     }
 
@@ -143,14 +141,13 @@ public:
         }
 
 #ifdef WITH_TRACE
-            utils::Trace < utils::DoubleTime >::trace()
-                    << utils::TraceElement < utils::DoubleTime >("KERNEL", t,
-                                                                 utils::KERNEL)
-                    << "PUT - "
-                    << get(index).to_string(dynamic_cast < const T* >(this))
-                    << " in "
-                    << dynamic_cast<T*>(this)->path(dynamic_cast<T*>(this)) << ":" << external_names[index];
-            utils::Trace < utils::DoubleTime >::trace().flush();
+        utils::Trace < utils::DoubleTime >::trace()
+                << utils::TraceElement < utils::DoubleTime >(
+                       dynamic_cast<T*>(this)->path(dynamic_cast<T*>(this)),
+                       t, utils::PUT)
+                << utils::KernelInfo(external_names[index], true,
+                                     get(index).to_string(dynamic_cast < const T* >(this)));
+        utils::Trace < utils::DoubleTime >::trace().flush();
 #endif
     }
 

+ 12 - 14
src/artis/kernel/Internals.hpp

@@ -70,12 +70,11 @@ public:
 
 #ifdef WITH_TRACE
             utils::Trace < utils::DoubleTime >::trace()
-                    << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
-                                                                 utils::KERNEL)
-                    << "INTERNAL - "
-                    << dynamic_cast<T*>(this)->path(dynamic_cast<T*>(this))
-                    << " declare "
-                    << it->name;
+                    << utils::TraceElement < utils::DoubleTime >(
+                           dynamic_cast<T*>(this)->path(dynamic_cast<T*>(this)),
+                           utils::DoubleTime::null,
+                           utils::INTERNAL_DECL)
+                    << utils::KernelInfo(it->name, true);
             utils::Trace < utils::DoubleTime >::trace().flush();
 #endif
         }
@@ -93,14 +92,13 @@ public:
         internal_names[index] = name;
 
 #ifdef WITH_TRACE
-            utils::Trace < utils::DoubleTime >::trace()
-                    << utils::TraceElement < utils::DoubleTime >("KERNEL", -1,
-                                                                 utils::KERNEL)
-                    << "INTERNAL - "
-                    << dynamic_cast<T*>(this)->path(dynamic_cast<T*>(this))
-                    << " declare "
-                    << name;
-            utils::Trace < utils::DoubleTime >::trace().flush();
+        utils::Trace < utils::DoubleTime >::trace()
+                << utils::TraceElement < utils::DoubleTime >(
+                       dynamic_cast<T*>(this)->path(dynamic_cast<T*>(this)),
+                       utils::DoubleTime::null,
+                       utils::INTERNAL_DECL)
+                << utils::KernelInfo(name, true);
+        utils::Trace < utils::DoubleTime >::trace().flush();
 #endif
     }
 

+ 4 - 7
src/artis/kernel/Simulator.hpp

@@ -57,13 +57,10 @@ public:
         _observer.init();
 
 #ifdef WITH_TRACE
-        utils::Trace < utils::DoubleTime >::trace()
-            << utils::TraceElement < utils::DoubleTime >("KERNEL", 0,
-                                                         utils::INIT)
-            << "GLOBAL VALUES - "
-            << _model->path(_model);
-        _model->trace_model(0);
-        utils::Trace < utils::DoubleTime >::trace().flush();
+        _model->trace_element(utils::DoubleTime::null,
+                              utils::INIT);
+        _model->trace_model(utils::DoubleTime::null,
+                            utils::INIT);
 #endif
     }