[mathicgb] 294/393: Added library interface support for retrieving values from logs.
Doug Torrance
dtorrance-guest at moszumanska.debian.org
Fri Apr 3 15:59:23 UTC 2015
This is an automated email from the git hooks/post-receive script.
dtorrance-guest pushed a commit to branch upstream
in repository mathicgb.
commit aa99ea66ac5b90c4dc7c0f4d25433556cb525892
Author: Bjarke Hammersholt Roune <bjarkehr.code at gmail.com>
Date: Sat Apr 20 18:14:31 2013 -0400
Added library interface support for retrieving values from logs.
---
src/mathicgb.cpp | 18 ++++++++++++++++++
src/mathicgb.h | 15 +++++++++++++++
2 files changed, 33 insertions(+)
diff --git a/src/mathicgb.cpp b/src/mathicgb.cpp
index f96e815..45c6804 100755
--- a/src/mathicgb.cpp
+++ b/src/mathicgb.cpp
@@ -29,6 +29,24 @@ namespace {
#endif
#endif
+namespace mgb {
+ bool logTime(const char* logName, double& time) {
+ auto log = LogDomainSet::singleton().logDomain(logName);
+ if (log == 0 || !log->enabled())
+ return false;
+ time = log->loggedSecondsReal();
+ return true;
+ }
+
+ bool logCharacteristic(const char* logName, double& number) {
+ auto log = LogDomainSet::singleton().logDomain(logName);
+ if (log == 0 || !log->enabled())
+ return false;
+ number = static_cast<double>(log->count());
+ return true;
+ }
+}
+
#define MATHICGB_STREAM_CHECK(X, MSG) \
do { \
const bool value = (X); \
diff --git a/src/mathicgb.h b/src/mathicgb.h
index 432ed9e..6a83c31 100755
--- a/src/mathicgb.h
+++ b/src/mathicgb.h
@@ -21,6 +21,21 @@ namespace mgbi { // Not part of the public interface of MathicGB
/// of MathicGB. You should not have to update your code when upgrading to a
/// newer minor revision of MathicGB if you only use the public interface.
namespace mgb { // Part of the public interface of MathicGB
+ /// Sets time to the number of seconds accumulated on the internal
+ /// MathicGB log named logName. Returns true if the logName log was
+ /// found and false otherwise.
+ ///
+ /// The available logs and what they measure are not part of
+ /// the public interface of MathicGB and indeed the availability of a log
+ /// depends on both compile-time and run-time events. Therefore you must
+ /// ensure that your program works even if this function always returns
+ /// false.
+ bool logTime(const char* logName, double& time);
+
+ /// As logTime, but retrieves a number associated to logName that is
+ /// not necessarily a time.
+ bool logCharacteristic(const char* logName, double& number);
+
/// Use this class to describe a configuration of a Groebner basis algorithm
/// that you want to run.
///
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/mathicgb.git
More information about the debian-science-commits
mailing list