[Fawkes Git] branch/vmatare/scope-timetracker: TimeTracker: Add ScopedClassItemTracker

Victor Mataré matare at lih.rwth-aachen.de
Mon May 23 16:29:15 CEST 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
  discards  5820e8cbd07a11a9591928dd96100b8778de1737 (commit)
  discards  419dcdc4a6d081a18fc652b5b2ed497e3284dc06 (commit)
        to  4627edbafd3ae7e31335a90680688d7060aedbae (commit)

This update added new revisions after undoing existing revisions.  That is
to say, the old revision is not a strict subset of the new revision.  This
situation occurs when you --force push a change and generate a repository
containing something like this:

 * -- * -- B -- O -- O -- O (5820e8cbd07a11a9591928dd96100b8778de1737)
            \
             N -- N -- N (4627edbafd3ae7e31335a90680688d7060aedbae)

When this happens we assume that you've already had alert emails for all
of the O revisions, and so we here report only the revisions in the N
branch from the common base, B.

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 4627edbafd3ae7e31335a90680688d7060aedbae
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 May 23 16:28:30 2016 +0200

    TimeTracker: Add ScopedClassItemTracker
    
    Tracks a timetracker class in a scope sentry object, which is useful
    e.g. in exception-prone code.

http://git.fawkesrobotics.org/fawkes.git/commit/4627edb
http://trac.fawkesrobotics.org/changeset/4627edb

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


- *Summary* -----------------------------------------------------------


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

- *commit* 4627edbafd3ae7e31335a90680688d7060aedbae - - - - - - - - - -
Author:  Victor Mataré <matare at lih.rwth-aachen.de>
Date:    Mon Mar 7 12:58:56 2016 +0100
Subject: TimeTracker: Add ScopedClassItemTracker

 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..b4bcf06 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);
 }
 
+
+ScopedClassItemTracker::ScopedClassItemTracker(TimeTracker &tt, unsigned int cls)
+: tt_(tt), cls_(cls)
+{ tt_.ping_start(cls_); }
+
+
+ScopedClassItemTracker::~ScopedClassItemTracker()
+{ 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..74d09c9 100644
--- a/src/libs/utils/time/tracker.h
+++ b/src/libs/utils/time/tracker.h
@@ -77,6 +77,17 @@ class TimeTracker {
   FILE *__timelog;
 };
 
+
+class ScopedClassItemTracker {
+public:
+  explicit ScopedClassItemTracker(TimeTracker &tt, unsigned int cls);
+  ~ScopedClassItemTracker();
+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..bd940ec 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::ScopedClassItemTracker __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