26 #ifndef SHORE_MISC_UTIL_HPP__
27 #define SHORE_MISC_UTIL_HPP__
37 #include <boost/progress.hpp>
55 inline void print_backtrace()
61 std::cerr<<
"\nBacktrace:\n----------\n";
62 ::backtrace_symbols_fd(buf,bs,STDERR_FILENO);
64 #endif // WITH_BACKTRACE
69 void throw_exception(
const T & ex)
72 std::cerr<<
"\nException generated: "<<ex.what()<<std::endl;
75 #endif // WITH_BACKTRACE
107 std::pair<double,double>
bump();
115 boost::progress_timer m_pt;
116 const std::string m_name;
120 progress_timer():m_pt(std::cerr),m_name(
"#") {}
122 progress_timer(
const std::string& name)
123 :m_pt(std::cerr),m_name(name) {}
125 ~progress_timer() { std::cerr<<m_name<<
" "<<
timestr()<<
" | "; }
130 #endif // SHORE_MISC_UTIL_HPP__