// File: /workspace/github_cpp_makefile_star2_O2/cybozu[P]yrmcds/src/memcache/gc.cpp
// Function: yrmcds::memcache::gc_thread::run()
void gc_thread::run() {
    if( ! cybozu::has_ip_address(g_config.vip()) ) {
        cybozu::logger::error() << "VIP has been lost.  Exiting quickly...";
        std::quick_exit(2);
    }

    using namespace std::chrono;
    auto t1 = steady_clock::now();
    gc();
    if( ! m_new_slaves.empty() )
        cybozu::logger::info() << "Initial replication completed for "
                               << m_new_slaves.size() << " new slave(s).";
    g_stats.objects.store(m_objects, std::memory_order_relaxed);
    g_stats.objects_under_1k.store(m_objects_under_1k, std::memory_order_relaxed);
    g_stats.objects_under_4k.store(m_objects_under_4k, std::memory_order_relaxed);
    g_stats.objects_under_16k.store(m_objects_under_16k, std::memory_order_relaxed);
    g_stats.objects_under_64k.store(m_objects_under_64k, std::memory_order_relaxed);
    g_stats.objects_under_256k.store(m_objects_under_256k, std::memory_order_relaxed);
    g_stats.objects_under_1m.store(m_objects_under_1m, std::memory_order_relaxed);
    g_stats.objects_under_4m.store(m_objects_under_4m, std::memory_order_relaxed);
    g_stats.objects_huge.store(m_objects_huge, std::memory_order_relaxed);
    g_stats.used_memory.store(m_used_memory, std::memory_order_relaxed);
    g_stats.conflicts.store(m_conflicts, std::memory_order_relaxed);
    g_stats.gc_count.fetch_add(1, std::memory_order_relaxed);
    g_stats.oldest_age.store(m_oldest_age, std::memory_order_relaxed);
    g_stats.largest_object_size.store(m_largest_object_size, std::memory_order_relaxed);
    g_stats.last_expirations.store(m_last_expirations, std::memory_order_relaxed);
    g_stats.last_evictions.store(m_last_evictions, std::memory_order_relaxed);
    g_stats.total_evictions.fetch_add(m_last_evictions, std::memory_order_relaxed);

    auto t2 = steady_clock::now();
    std::uint64_t us = static_cast<std::uint64_t>(
        duration_cast<microseconds>(t2-t1).count() );
    g_stats.last_gc_elapsed.store(us, std::memory_order_relaxed);
    g_stats.total_gc_elapsed.fetch_add(us, std::memory_order_relaxed);
    cybozu::logger::debug() << "GC end: elapsed=" << us
                            << "us, expired=" << m_last_expirations
                            << ", evicted=" << m_last_evictions
                            << ", survived=" << m_objects;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x1d351(%rip), %rdi     # 0x3bbc0
callq 0x10b85
testb %al, %al
je 0x1ea22
callq 0x76e0
movq %rax, %r14
movq %rbx, %rdi
callq 0x1ea6c
movq 0x30(%rbx), %rax
cmpq 0x38(%rbx), %rax
je 0x1e8e7
leaq 0x8(%rsp), %r15
movq %r15, %rdi
callq 0xec96
leaq 0xa295(%rip), %rsi      # 0x28b3f
movq %r15, %rdi
callq 0x1ee4e
movq 0x38(%rbx), %rcx
subq 0x30(%rbx), %rcx
sarq $0x3, %rcx
leaq 0x18(%rsp), %rsi
movq %rcx, (%rsi)
movq %rax, %rdi
callq 0xf538
leaq 0xa28d(%rip), %rsi      # 0x28b62
movq %rax, %rdi
callq 0x1ee66
leaq 0x8(%rsp), %rdi
callq 0x86e4
movl 0x48(%rbx), %eax
leaq 0x1d5cf(%rip), %r15     # 0x3bec0
movl %eax, (%r15)
movl 0x4c(%rbx), %eax
movl %eax, 0x4(%r15)
movl 0x50(%rbx), %eax
movl %eax, 0x8(%r15)
movl 0x54(%rbx), %eax
movl %eax, 0xc(%r15)
movl 0x58(%rbx), %eax
movl %eax, 0x10(%r15)
movl 0x5c(%rbx), %eax
movl %eax, 0x14(%r15)
movl 0x60(%rbx), %eax
movl %eax, 0x18(%r15)
movl 0x64(%rbx), %eax
movl %eax, 0x1c(%r15)
movl 0x68(%rbx), %eax
movl %eax, 0x20(%r15)
movq 0x70(%rbx), %rax
movq %rax, 0x28(%r15)
movl 0x78(%rbx), %eax
movl %eax, 0x30(%r15)
lock
incl 0x34(%r15)
movl 0x7c(%rbx), %eax
movl %eax, 0x38(%r15)
movq 0x80(%rbx), %rax
movq %rax, 0x40(%r15)
movl 0x88(%rbx), %eax
movl %eax, 0x48(%r15)
movl 0x8c(%rbx), %eax
movl %eax, 0x4c(%r15)
lock
addq %rax, 0x50(%r15)
callq 0x76e0
subq %r14, %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
movq %rax, 0x18(%rsp)
movq %rax, 0x58(%r15)
lock
addq %rax, 0x60(%r15)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x9360
leaq 0xa134(%rip), %rsi      # 0x28ad3
movq %r14, %rdi
callq 0x1ee7e
leaq 0x18(%rsp), %rsi
movq %rax, %rdi
callq 0xf538
leaq 0xa1b6(%rip), %rsi      # 0x28b71
movq %rax, %rdi
callq 0x1d036
leaq 0x88(%rbx), %rsi
movq %rax, %rdi
callq 0xf382
leaq 0xa1a5(%rip), %rsi      # 0x28b7e
movq %rax, %rdi
callq 0x11924
leaq 0x8c(%rbx), %rsi
movq %rax, %rdi
callq 0xf382
leaq 0xa0ef(%rip), %rsi      # 0x28ae6
movq %rax, %rdi
callq 0xed42
addq $0x48, %rbx
movq %rax, %rdi
movq %rbx, %rsi
callq 0xf382
leaq 0x8(%rsp), %rdi
callq 0x86e4
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
leaq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x865e
leaq 0xa0e2(%rip), %rsi      # 0x28b18
movq %rbx, %rdi
callq 0x1ee36
leaq 0x8(%rsp), %rdi
callq 0x86e4
pushq $0x2
popq %rdi
callq 0x72e0
jmp 0x1ea56
jmp 0x1ea56
jmp 0x1ea56
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x86e4
movq %rbx, %rdi
callq 0x7990
nop