[sdpb] 131/233: Commented Timers.h
Tobias Hansen
thansen at moszumanska.debian.org
Thu Mar 9 04:06:29 UTC 2017
This is an automated email from the git hooks/post-receive script.
thansen pushed a commit to branch master
in repository sdpb.
commit d9de8d1115e8db3ec8d1ec079ce85bd3862da7a8
Author: David Simmons-Duffin <dsd at minerva.sns.ias.edu>
Date: Sat Jan 10 04:02:45 2015 -0500
Commented Timers.h
---
src/Timers.h | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/src/Timers.h b/src/Timers.h
index d8d517d..feb5d68 100644
--- a/src/Timers.h
+++ b/src/Timers.h
@@ -20,8 +20,10 @@ using std::string;
using std::ostream;
using boost::timer::cpu_timer;
+// A map between strings and cpu timers
class Timers : public map<string, cpu_timer> {
public:
+ // For printing out timing information
friend ostream& operator<<(ostream& os, const Timers& t) {
for (map<string, cpu_timer>::const_iterator it = t.begin();
it != t.end();
@@ -32,6 +34,18 @@ class Timers : public map<string, cpu_timer> {
}
};
+// A global Timers map for the whole program (defined in main.cpp). A
+// new timer is created by default whenver `timers' is accessed. To
+// time something, simply replace
+//
+// myComputation();
+//
+// with
+//
+// timers["my computation"].start();
+// myComputation();
+// timers["my computation"].stop();
+//
extern Timers timers;
#endif // SDPB_TIMERS_H_
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sdpb.git
More information about the debian-science-commits
mailing list