26 #include <aleth/buildinfo.h>
32 char const*
Version = aleth_get_buildinfo()->project_version;
36 void InvariantChecker::checkInvariants(
HasInvariants const* _this,
char const* _fn,
char const* _file,
int _line,
bool _pre)
40 cwarn << (_pre ?
"Pre" :
"Post") <<
"invariant failed in" << _fn <<
"at" << _file <<
":" << _line;
41 ::boost::exception_detail::throw_exception_(FailedInvariant(), _fn, _file, _line);
45 TimerHelper::~TimerHelper()
47 auto e = std::chrono::high_resolution_clock::now() - m_t;
48 if (!m_ms || e > chrono::milliseconds(m_ms))
50 << m_id <<
" " << chrono::duration_cast<chrono::milliseconds>(e).count() <<
" ms";
74 for (
unsigned i = _units.size() - 1; !!i; --i)
77 if (b > biggest * 1000)
79 ret << (b / biggest) <<
" " << _units.back();
82 ret << setprecision(3);
85 for (
auto it = _units.rbegin(); it != _units.rend(); ++it)
88 if (i != _units.front() && b >= unit)
90 ret << (double(b / (unit / 1000)) / 1000.0) <<
" " << i;
96 ret << b <<
" " << _units.front();
116 if (!setlocale(LC_ALL,
""))
117 setenv(
"LC_ALL",
"C", 1);
123 SetConsoleOutputCP(CP_UTF8);
127 bool ExitHandler::s_shouldExit =
false;
131 return _m ==
"on" || _m ==
"yes" || _m ==
"true" || _m ==
"1";
136 return _m ==
"off" || _m ==
"no" || _m ==
"false" || _m ==
"0";