티스토리 뷰

카테고리 없음

ee

newpolaris 2020. 1. 28. 02:28
static void BM_spinlock(benchmark::State& state) {  
    static LockingPolicy::SpinLock l;  
    for (auto _ : state) {  
        l.lock();  
        l.unlock();  
    }  
}  

BENCHMARK(BM\_std\_mutex)  
    ->Threads(1)  
    ->Threads(2)  
    ->Threads(8)  
    ->ThreadPerCpu();  

BENCHMARK(BM_utils_mutex)  
    ->Threads(1)  
    ->Threads(2)  
    ->Threads(8)  
    ->ThreadPerCpu();  

BENCHMARK(BM_utils2_mutex)  
    ->Threads(1)  
    ->Threads(2)  
    ->Threads(8)  
    ->ThreadPerCpu();
-----------------------------------------------------------------------
Benchmark                             Time             CPU   Iterations
-----------------------------------------------------------------------
BM_std_mutex/threads:1             18.1 ns         18.4 ns     40727273
BM_std_mutex/threads:2             16.6 ns         33.6 ns     20000000
BM_std_mutex/threads:8             15.9 ns          143 ns      5120000
BM_std_mutex/threads:12            14.9 ns          167 ns      3360000
BM_spinlock/threads:1              6.52 ns         6.45 ns     89600000
BM_spinlock/threads:2              19.6 ns         37.7 ns     14933334
BM_spinlock/threads:8              29.4 ns          209 ns      2389336
BM_spinlock/threads:12             31.4 ns          413 ns      1853796
BM_basic_spinlock/threads:1        6.31 ns         5.93 ns     89600000
BM_basic_spinlock/threads:2        31.0 ns         62.8 ns     14933334
BM_basic_spinlock/threads:8        94.3 ns          785 ns      1792000
BM_basic_spinlock/threads:12       59.0 ns          759 ns       926328
BM_util_spinlock/threads:1         6.29 ns         6.28 ns     89600000
BM_util_spinlock/threads:2         31.8 ns         61.4 ns     11200000
BM_util_spinlock/threads:8          104 ns          815 ns      1092264
BM_util_spinlock/threads:12        83.5 ns         1055 ns      1200000
BM_util2_spinlock/threads:1        6.22 ns         6.28 ns     89600000
BM_util2_spinlock/threads:2        27.3 ns         53.7 ns     12800000
BM_util2_spinlock/threads:8        66.5 ns          530 ns      1327408
BM_util2_spinlock/threads:12       58.8 ns          610 ns       896004
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크