μHAL (v2.7.9)
Part of the IPbus software repository
Namespaces | Macros | Functions
test_multithreaded.cpp File Reference
#include "uhal/uhal.hpp"
#include "uhal/tests/definitions.hpp"
#include "uhal/tests/fixtures.hpp"
#include "uhal/tests/tools.hpp"
#include "uhal/log/log.hpp"
#include <boost/thread.hpp>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/test/unit_test.hpp>
#include <iostream>
#include <cstdlib>
#include <typeinfo>
#include <sys/time.h>
Include dependency graph for test_multithreaded.cpp:

Go to the source code of this file.

Namespaces

 uhal
 
 uhal::tests
 

Macros

#define N_THREADS   5
 
#define N_ITERATIONS   5
 
#define N_SIZE   uint32_t(10*1024/4)
 
#define TIMEOUT_MULTIPLIER   50
 

Functions

void uhal::tests::job_multiple (const std::string &connection, const std::string &id, const size_t timeout)
 
 uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (MultithreadedTestSuite, multiple_hwinterfaces, DummyHardwareFixture, { std::vector< boost::thread * > jobs;for(size_t i=0;i!=N_THREADS;++i) { log(Warning(), ThisLocation(), ":", Integer(i));jobs.push_back(new boost::thread(job_multiple, connectionFileURI, deviceId, timeout));} for(size_t i=0;i!=N_THREADS;++i) { log(Warning(), ThisLocation(), ":", Integer(i));jobs[i]->join();delete jobs[i];} log(Warning(), ThisLocation());}) void job_single(HwInterface &hw)
 
 uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (MultithreadedTestSuite, single_hwinterface, DummyHardwareFixture, { for(size_t iter=0;iter!=N_ITERATIONS ;++iter) { HwInterface hw=getHwInterface();std::vector< boost::thread * > jobs;for(size_t i=0;i!=N_THREADS;++i) { jobs.push_back(new boost::thread(job_single, hw));} for(size_t i=0;i!=N_THREADS;++i) { jobs[i]->join();delete jobs[i];} } }) void job_single_copied(HwInterface hw)
 

Macro Definition Documentation

◆ N_ITERATIONS

#define N_ITERATIONS   5

Definition at line 57 of file test_multithreaded.cpp.

◆ N_SIZE

#define N_SIZE   uint32_t(10*1024/4)

Definition at line 58 of file test_multithreaded.cpp.

◆ N_THREADS

#define N_THREADS   5

Definition at line 56 of file test_multithreaded.cpp.

◆ TIMEOUT_MULTIPLIER

#define TIMEOUT_MULTIPLIER   50

Definition at line 59 of file test_multithreaded.cpp.