summaryrefslogtreecommitdiff
path: root/utils
diff options
context:
space:
mode:
Diffstat (limited to 'utils')
-rw-r--r--utils/Makefile.am1
-rw-r--r--utils/timing_stats.cc9
-rw-r--r--utils/verbose.cc4
-rw-r--r--utils/verbose.h8
4 files changed, 20 insertions, 2 deletions
diff --git a/utils/Makefile.am b/utils/Makefile.am
index 66b86f89..9556f507 100644
--- a/utils/Makefile.am
+++ b/utils/Makefile.am
@@ -22,6 +22,7 @@ libutils_a_SOURCES = \
stringlib.cc \
sparse_vector.cc \
timing_stats.cc \
+ verbose.cc \
weights.cc
dict_test_SOURCES = dict_test.cc
diff --git a/utils/timing_stats.cc b/utils/timing_stats.cc
index fc8e9df1..dc90bf53 100644
--- a/utils/timing_stats.cc
+++ b/utils/timing_stats.cc
@@ -2,6 +2,9 @@
#include <iostream>
#include "time.h" //cygwin needs
+
+#include "verbose.h"
+
using namespace std;
map<string, TimerInfo> Timer::stats;
@@ -16,8 +19,10 @@ Timer::~Timer() {
}
void Timer::Summarize() {
- for (map<string, TimerInfo>::iterator it = stats.begin(); it != stats.end(); ++it) {
- cerr << it->first << ": " << it->second.total_time << " secs (" << it->second.calls << " calls)\n";
+ if (!SILENT) {
+ for (map<string, TimerInfo>::iterator it = stats.begin(); it != stats.end(); ++it) {
+ cerr << it->first << ": " << it->second.total_time << " secs (" << it->second.calls << " calls)\n";
+ }
}
stats.clear();
}
diff --git a/utils/verbose.cc b/utils/verbose.cc
new file mode 100644
index 00000000..615c61f3
--- /dev/null
+++ b/utils/verbose.cc
@@ -0,0 +1,4 @@
+#include "verbose.h"
+
+bool SILENT = false;
+
diff --git a/utils/verbose.h b/utils/verbose.h
new file mode 100644
index 00000000..73476383
--- /dev/null
+++ b/utils/verbose.h
@@ -0,0 +1,8 @@
+#ifndef _VERBOSE_H_
+#define _VERBOSE_H_
+
+extern bool SILENT;
+
+inline void SetSilent(bool s) { SILENT = s; }
+
+#endif