• Pádraig Brady's avatar
    rate limit calls to posix_fadvise() · dacd2967
    Pádraig Brady authored
    There can be a large kernel overhead involved in POSIX_FADV_DONTNEED.
    There is no point in calling this per item logged, so rate limit
    to at most once per 2MiB written.
    
    With a simple test program that logs 100K items at WARNING level:
    
    Before:
    
      $ time strace -c -e fadvise64 log.test \
        -log_dir=/dev/shm -logtofiles=true -logtostderr=false
      % time     seconds  usecs/call     calls    errors syscall
      ------ ----------- ----------- --------- --------- ----------------
      100.00   12.522509         125     99957           fadvise64
      ------ ----------- ----------- --------- --------- ----------------
      real    0m52.671s
      user    0m2.194s
      sys     0m44.022s
    
    After:
    
      $ time strace -c -e fadvise64 log.test \
        -log_dir=/dev/shm -logtofiles=true -logtostderr=false
    
      % time     seconds  usecs/call     calls    errors syscall
      ------ ----------- ----------- --------- --------- ----------------
      100.00    0.000759         152         5           fadvise64
      ------ ----------- ----------- --------- --------- ----------------
      real    0m4.206s
      user    0m1.436s
      sys     0m3.153s
    
    Fixes issue #84
    dacd2967
Name
Last commit
Last update
..
base Loading commit data...
glog Loading commit data...
windows Loading commit data...
config.h.cmake.in Loading commit data...
config.h.in Loading commit data...
config_for_unittests.h Loading commit data...
demangle.cc Loading commit data...
demangle.h Loading commit data...
demangle_unittest.cc Loading commit data...
demangle_unittest.sh Loading commit data...
demangle_unittest.txt Loading commit data...
googletest.h Loading commit data...
logging.cc Loading commit data...
logging_striplog_test.sh Loading commit data...
logging_striptest10.cc Loading commit data...
logging_striptest2.cc Loading commit data...
logging_striptest_main.cc Loading commit data...
logging_unittest.cc Loading commit data...
logging_unittest.err Loading commit data...
mock-log.h Loading commit data...
mock-log_test.cc Loading commit data...
raw_logging.cc Loading commit data...
signalhandler.cc Loading commit data...
signalhandler_unittest.cc Loading commit data...
signalhandler_unittest.sh Loading commit data...
stacktrace.h Loading commit data...
stacktrace_generic-inl.h Loading commit data...
stacktrace_libunwind-inl.h Loading commit data...
stacktrace_powerpc-inl.h Loading commit data...
stacktrace_unittest.cc Loading commit data...
stacktrace_x86-inl.h Loading commit data...
stacktrace_x86_64-inl.h Loading commit data...
stl_logging_unittest.cc Loading commit data...
symbolize.cc Loading commit data...
symbolize.h Loading commit data...
symbolize_unittest.cc Loading commit data...
utilities.cc Loading commit data...
utilities.h Loading commit data...
utilities_unittest.cc Loading commit data...
vlog_is_on.cc Loading commit data...