|
|
|
@ -10,6 +10,8 @@ |
|
|
|
|
// Logger implementation that can be shared by all environments
|
|
|
|
|
// where enough posix functionality is available.
|
|
|
|
|
|
|
|
|
|
#include "port/win/win_logger.h" |
|
|
|
|
|
|
|
|
|
#include <stdint.h> |
|
|
|
|
#include <algorithm> |
|
|
|
|
#include <stdio.h> |
|
|
|
@ -21,7 +23,6 @@ |
|
|
|
|
|
|
|
|
|
#include <Windows.h> |
|
|
|
|
|
|
|
|
|
#include "port/win/win_logger.h" |
|
|
|
|
#include "port/sys_time.h" |
|
|
|
|
#include "util/iostats_context_imp.h" |
|
|
|
|
|
|
|
|
@ -53,8 +54,9 @@ void WinLogger::close() { CloseHandle(file_); } |
|
|
|
|
void WinLogger::Flush() { |
|
|
|
|
if (flush_pending_) { |
|
|
|
|
flush_pending_ = false; |
|
|
|
|
// With Windows API writes go to OS buffers directly so no fflush needed unlike
|
|
|
|
|
// with C runtime API. We don't flush all the way to disk for perf reasons.
|
|
|
|
|
// With Windows API writes go to OS buffers directly so no fflush needed
|
|
|
|
|
// unlike with C runtime API. We don't flush all the way to disk
|
|
|
|
|
// for perf reasons.
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
last_flush_micros_ = env_->NowMicros(); |
|
|
|
@ -141,8 +143,9 @@ void WinLogger::Logv(const char* format, va_list ap) { |
|
|
|
|
static_cast<uint64_t>(now_tv.tv_sec) * 1000000 + now_tv.tv_usec; |
|
|
|
|
if (now_micros - last_flush_micros_ >= flush_every_seconds_ * 1000000) { |
|
|
|
|
flush_pending_ = false; |
|
|
|
|
// With Windows API writes go to OS buffers directly so no fflush needed unlike
|
|
|
|
|
// with C runtime API. We don't flush all the way to disk for perf reasons.
|
|
|
|
|
// With Windows API writes go to OS buffers directly so no fflush needed
|
|
|
|
|
// unlike with C runtime API. We don't flush all the way to disk
|
|
|
|
|
// for perf reasons.
|
|
|
|
|
last_flush_micros_ = now_micros; |
|
|
|
|
} |
|
|
|
|
break; |
|
|
|
|