force profiler_unittest to do 'real' work

'XOR loop' in profiler unittest wasn't 100% effective because it allowed
compiler to avoid loading and storing to memory.

After marking result variable as volatile, we're now forcing compiler to
read and write memory, slowing this loops down sufficiently. And
profiler_unittest is now passing more consistently.

Closes #628
This commit is contained in:
Aliaksey Kandratsenka 2016-02-20 13:06:08 -08:00
parent fff6b4fb88
commit 728cbe1021

View File

@ -46,7 +46,7 @@
#include "base/simple_mutex.h"
#include "tests/testutil.h"
static int result = 0;
static volatile int result = 0;
static int g_iters = 0; // argv[1]
Mutex mutex(Mutex::LINKER_INITIALIZED);