26 #ifndef MLN_TRACE_EXITING_HH
27 # define MLN_TRACE_EXITING_HH
37 # include <mln/core/contract.hh>
38 # include <mln/trace/quiet.hh>
46 void exiting(
const std::string& scope);
49 extern std::stack<std::clock_t> start_times;
50 extern std::stack<std::string> scopes;
53 # ifndef MLN_INCLUDE_ONLY
56 void exiting(
const std::string& scope)
63 std::cerr <<
"error: missing 'entering' scope (exiting is '" << scope <<
"')" << std::endl;
68 if (scopes.top() != scope)
70 std::cerr <<
"error: bad matching scope (entering is '" << scopes.top()
71 <<
"' v. exiting is '" << scope <<
"')" << std::endl;
77 bool has_inner_trace = (internal::max_tab == tab);
81 for (
unsigned i = 0; i < tab; ++i)
87 std::cout << scope <<
" ";
89 mln_assertion(! start_times.empty());
90 std::clock_t now = std::clock();
92 if (start_times.top() > now)
94 std::cerr <<
"warning: bad timer in trace handling" << std::endl;
98 if (start_times.top() < now)
101 << ((float(now) - float(start_times.top())) / CLOCKS_PER_SEC)
107 if (has_inner_trace || (internal::max_tab - tab > 1))
108 std::cout << std::endl;
111 # endif // ! MLN_INCLUDE_ONLY
118 #endif // ! MLN_TRACE_EXITING_HH