Skip to content

Commit 93015b9

Browse files
committed
Initial commit
1 parent b446a15 commit 93015b9

File tree

2 files changed

+17
-15
lines changed

2 files changed

+17
-15
lines changed

Src/configs.props

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<ItemDefinitionGroup>
77
<ClCompile>
88
<DisableSpecificWarnings>4068</DisableSpecificWarnings>
9+
<MultiProcessorCompilation>true</MultiProcessorCompilation>
910
</ClCompile>
1011
</ItemDefinitionGroup>
1112
<ItemGroup />

Test/main.cpp

+16-15
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ PLATFORM_NOINLINE static void TestLockPerf()
303303

304304
//////////////////////////////////////////////////////////////////////////
305305
template <class TLock>
306-
static uint64_t TestLockSwitch(uint32_t waitTime = 250)
306+
static uint64_t TestLockWake(uint32_t waitTime = 250)
307307
{
308308
TLock locker;
309309
uint64_t unlockTime = 0;
@@ -324,39 +324,40 @@ static uint64_t TestLockSwitch(uint32_t waitTime = 250)
324324
std::this_thread::sleep_for(std::chrono::milliseconds(waitTime));
325325

326326
locker.lock();
327-
uint64_t switchTime = GetTickMicrosec() - unlockTime;
327+
uint64_t wakeTime = GetTickMicrosec() - unlockTime;
328328
locker.unlock();
329329

330330
thd.join();
331331

332-
return switchTime;
332+
return wakeTime;
333333
}
334334

335335
template <class TLock>
336-
PLATFORM_NOINLINE static void TestLockSwitchSeq(const char *name)
336+
PLATFORM_NOINLINE static void TestLockWakeSeq(const char *name)
337337
{
338-
uint64_t result = TestLockSwitch<TLock>(250);
339-
printf("[Switch] %s 1: %llu microsec\n", name, result);
340-
result = TestLockSwitch<TLock>(480);
341-
printf("[Switch] %s 2: %llu microsec\n", name, result);
342-
result = TestLockSwitch<TLock>(495);
343-
printf("[Switch] %s 3: %llu microsec\n", name, result);
338+
uint64_t result = TestLockWake<TLock>(250);
339+
printf("[Wake] %s 1: %llu microsec\n", name, result);
340+
result = TestLockWake<TLock>(480);
341+
printf("[Wake] %s 2: %llu microsec\n", name, result);
342+
result = TestLockWake<TLock>(495);
343+
printf("[Wake] %s 3: %llu microsec\n", name, result);
344344
}
345345

346-
PLATFORM_NOINLINE static void TestLockSwitchPerf()
346+
PLATFORM_NOINLINE static void TestLockWakePerf()
347347
{
348-
TestLockSwitchSeq<SRWLock>("SRWLock");
349-
TestLockSwitchSeq<std::mutex>("std::mutex");
348+
TestLockWakeSeq<SRWLock>("SRWLock");
349+
TestLockWakeSeq<std::mutex>("std::mutex");
350350

351351
#if !defined(PLATFORM_IS_IPHONE)
352-
TestLockSwitchSeq<std::shared_mutex>("std::shared_mutex");
352+
TestLockWakeSeq<std::shared_mutex>("std::shared_mutex");
353353
#endif
354354
}
355355

356356
//////////////////////////////////////////////////////////////////////////
357357
int main()
358358
{
359-
TestLockSwitchPerf();
360359
TestLockPerf();
360+
TestLockWakePerf();
361+
SimpleTest();
361362
return 0;
362363
}

0 commit comments

Comments
 (0)