summaryrefslogtreecommitdiffstats
path: root/src/util.cpp
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-12 11:29:30 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-09-12 11:29:30 +0200
commit1dddf8c03e8b7781f549636be6d23e6ca245512b (patch)
tree256d99c0390aac33f9c64b3468f9565e30051ba4 /src/util.cpp
parent2f864ac5289e8426f1d0c91c264a6a274047245b (diff)
util/cmake: enable ScopeTracing through cmake variable option
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src/util.cpp')
-rw-r--r--src/util.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp
index db61bc2..44c377c 100644
--- a/src/util.cpp
+++ b/src/util.cpp
@@ -24,7 +24,13 @@
#include <unistd.h>
+#ifdef SCOPE_TRACING
thread_local int ScopeTrace::indent = 0;
+explicit ScopeTrace::ScopeTrace(char const *func) : f(func) {
+ fprintf(stderr, "%lu %*s%s -->\n", pthread_self(), 2 * indent++, "", this->f);
+}
+ScopeTrace::~ScopeTrace() { fprintf(stderr, "%lu %*s%s <--\n", pthread_self(), 2 * --indent, "", this->f); }
+#endif
unique_fd::~unique_fd() {
if (this->fd != -1) {