static inline std::chrono::steady_clock::duration CurrentUptime() {return MonoClock.now() - GlobalStart;}
auto_timer(const std::string& prefix, uint64_t delivery) : prefix(prefix), delivery(delivery) { start_time = clock.now(); }
{ case SIGSEGV: Log.report(logvisor::Fatal, "Segmentation Fault"); case SIGILL: Log.report(logvisor::Fatal, "Bad Execution"); case SIGFPE: Log.report(logvisor::Fatal, "Floating Point Exception"); default: Log.report(logvisor::Fatal, "unknown signal %d", signum); } } std::vector<std::unique_ptr<ILogger>> MainLoggers; std::atomic_size_t ErrorCount(0); static std::chrono::steady_clock MonoClock; static std::chrono::steady_clock::time_point GlobalStart = MonoClock.now(); static inline std::chrono::steady_clock::duration CurrentUptime() {return MonoClock.now() - GlobalStart;} std::atomic_uint_fast64_t FrameIndex(0); std::recursive_mutex LogMutex; static inline int ConsoleWidth() { int retval = 80; #if _WIN32 CONSOLE_SCREEN_BUFFER_INFO info; GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE), &info); retval = info.dwSize.X - 1; #else struct winsize w; if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &w) != -1)
BENCHMARK_RELATIVE(steady_clock, n) { while (n--) { auto t = steadyClock.now(); folly::doNotOptimizeAway(t); } }
~auto_timer() { for (auto task : waited_task) { task->wait(); } auto end_time = clock.now(); std::cout << prefix << "throughput = " << delivery * 1000 * 1000 / std::chrono::duration_cast<std::chrono::microseconds>(end_time - start_time).count() << std::endl; }