MCPcopy Create free account
hub / github.com/apache/brpc / TEST_F

Function TEST_F

test/bvar_lock_timer_unittest.cpp:62–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60
61#if __cplusplus >= 201103L
62TEST_F(LockTimerTest, MutexWithRecorder) {
63 IntRecorder recorder;
64 MutexWithRecorder<std::mutex> mutex(recorder);
65 {
66 BAIDU_SCOPED_LOCK(mutex);
67 }
68 ASSERT_EQ(1u, recorder.get_value().num);
69 LOG(INFO) << recorder;
70 {
71 std::unique_lock<decltype(mutex) > lck(mutex);
72 lck.unlock();
73 lck.lock();
74 ASSERT_EQ(2u, recorder.get_value().num);
75 LOG(INFO) << recorder;
76 std::condition_variable cond;
77 cond.wait_for(lck, std::chrono::milliseconds(10));
78 }
79 ASSERT_EQ(3u, recorder.get_value().num);
80}
81
82TEST_F(LockTimerTest, MutexWithLatencyRecorder) {
83 LatencyRecorder recorder(10);

Callers

nothing calls this directly

Calls 14

milliseconds_from_nowFunction · 0.85
ProfilerStartFunction · 0.85
ProfilerStopFunction · 0.85
wait_forMethod · 0.80
set_recorderMethod · 0.80
n_elapsedMethod · 0.80
get_valueMethod · 0.45
unlockMethod · 0.45
lockMethod · 0.45
countMethod · 0.45
mutexMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected