Futex test execution time was too long

Summary: Futex test execution time was too long

Test Plan: manual

Reviewers: dgleich

Reviewed By: dgleich

Subscribers: pullbot, dgleich, buda

Differential Revision: https://phabricator.memgraph.io/D56
This commit is contained in:
Marko Budiselic 2017-02-21 15:44:12 +01:00
parent e0f399ac42
commit 30f4e9d47a
2 changed files with 11 additions and 17 deletions

20
init.sh
View File

@ -1,21 +1,11 @@
#!/bin/bash
if ! type "wget" > /dev/null; then
echo >&2 "Please install wget or set it in your path. Aborting."; exit 1;
fi
if ! type "git" > /dev/null; then
echo >&2 "Please install git or set it in your path. Aborting."; exit 1;
fi
if ! type "cmake" > /dev/null; then
echo >&2 "Please install cmake or set it in your path. Aborting."; exit 1;
fi
cd cmake
./setup.sh
cd ..
# install all dependencies on debian based operating systems
for pkg in wget git cmake uuid-dev clang-3.8; do
dpkg -s $pkg 2>/dev/null >/dev/null || sudo apt-get -y install $pkg
done
# setup libs (download)
cd libs
./setup.sh
cd ..

View File

@ -9,12 +9,16 @@
Futex futex;
int x = 0;
void test_lock(int id) {
/**
* @param thread id
*/
void test_lock(int) {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(0, 1000);
for (int i = 0; i < 5000000; ++i) {
// TODO: create long running test
for (int i = 0; i < 5; ++i) {
{
std::unique_lock<Futex> guard(futex);
x++;