[Fawkes Git] branch/vmatare/scope-timetracker: add LifetimeTracker that time-tracks a scope

Victor Mataré matare at lih.rwth-aachen.de
Mon Mar 7 12:59:49 CET 2016


Changes have been pushed for the project "Fawkes Robotics Software Framework".

Gitweb: http://git.fawkesrobotics.org/fawkes.git
Trac:   http://trac.fawkesrobotics.org

The branch, vmatare/scope-timetracker has been updated
        to  82bc23be055fb3bd50b7700ae6f9faee70aeaa2d (commit)
      from  a95c0e28a3ee76a4e3b946199fe14b74a1494e5f (commit)

http://git.fawkesrobotics.org/fawkes.git/vmatare/scope-timetracker

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- *Log* ---------------------------------------------------------------
commit 82bc23be055fb3bd50b7700ae6f9faee70aeaa2d
Author:     Victor Mataré <matare at lih.rwth-aachen.de>
AuthorDate: Mon Mar 7 12:58:56 2016 +0100
Commit:     Victor Mataré <matare at lih.rwth-aachen.de>
CommitDate: Mon Mar 7 12:58:56 2016 +0100

    add LifetimeTracker that time-tracks a scope

http://git.fawkesrobotics.org/fawkes.git/commit/82bc23b
http://trac.fawkesrobotics.org/changeset/82bc23b

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 src/libs/utils/time/tracker.cpp      |   10 ++++++++++
 src/libs/utils/time/tracker.h        |   11 +++++++++++
 src/libs/utils/time/tracker_macros.h |    4 ++++
 3 files changed, 25 insertions(+), 0 deletions(-)


- *Diffs* -------------------------------------------------------------

- *commit* 82bc23be055fb3bd50b7700ae6f9faee70aeaa2d - - - - - - - - - -
Author:  Victor Mataré <matare at lih.rwth-aachen.de>
Date:    Mon Mar 7 12:58:56 2016 +0100
Subject: add LifetimeTracker that time-tracks a scope

 src/libs/utils/time/tracker.cpp      |   10 ++++++++++
 src/libs/utils/time/tracker.h        |   11 +++++++++++
 src/libs/utils/time/tracker_macros.h |    4 ++++
 3 files changed, 25 insertions(+), 0 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/utils/time/tracker.cpp b/src/libs/utils/time/tracker.cpp
index a5df85b..0e438dd 100644
--- a/src/libs/utils/time/tracker.cpp
+++ b/src/libs/utils/time/tracker.cpp
@@ -466,5 +466,15 @@ TimeTracker::print_to_file()
   fflush(__timelog);
 }
 
+
+LifetimeTracker::LifetimeTracker(TimeTracker &tt, unsigned int cls)
+: tt_(tt), cls_(cls)
+{ tt_.ping_start(cls_); }
+
+
+LifetimeTracker::~LifetimeTracker()
+{ tt_.ping_end(cls_); }
+
+
 } // end namespace fawkes
 
diff --git a/src/libs/utils/time/tracker.h b/src/libs/utils/time/tracker.h
index c4ac76f..af39c58 100644
--- a/src/libs/utils/time/tracker.h
+++ b/src/libs/utils/time/tracker.h
@@ -77,6 +77,17 @@ class TimeTracker {
   FILE *__timelog;
 };
 
+
+class LifetimeTracker {
+public:
+  LifetimeTracker(TimeTracker &tt, unsigned int cls);
+  ~LifetimeTracker();
+private:
+  TimeTracker &tt_;
+  unsigned int cls_;
+};
+
+
 } // end namespace fawkes
 
 #endif
diff --git a/src/libs/utils/time/tracker_macros.h b/src/libs/utils/time/tracker_macros.h
index 1babd5a..8fc1a07 100644
--- a/src/libs/utils/time/tracker_macros.h
+++ b/src/libs/utils/time/tracker_macros.h
@@ -42,11 +42,15 @@
 #  define TIMETRACK_ABORT(c)			\
   TRACKER_VARIABLE->ping_abort(c);
 
+#  define TIMETRACK_SCOPE(c)                    \
+  fawkes::LifetimeTracker __tt_scope_sentry(TRACKER_VARIABLE, c);
+
 #else
 #  define TIMETRACK_START(c)
 #  define TIMETRACK_INTER(c1, c2)
 #  define TIMETRACK_END(c)
 #  define TIMETRACK_ABORT(c)
+#  define TIMETRACK_SCOPE(c)
 #endif
 
 




-- 
Fawkes Robotics Framework                 http://www.fawkesrobotics.org


More information about the fawkes-commits mailing list