μHAL (v2.6.5)
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_S   50
 

Functions

void uhal::tests::job_multiple (const std::string &connection, const std::string &id)
 
 uhal::tests::UHAL_TESTS_DEFINE_CLIENT_TEST_CASES (MultithreadedTestSuite, multiple_hwinterfaces, DummyHardwareFixture, { if(deviceType !=IPBUS_2_0_PCIE) { 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));} for(size_t i=0;i!=N_THREADS;++i) { log(Warning(), ThisLocation(), ":", Integer(i));jobs[i]->join();delete jobs[i];} log(Warning(), ThisLocation());} else std::cout<< " ** Skipping multiple HwInterface test for PCIe **"<< std::endl;}) 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

◆ N_SIZE

#define N_SIZE   uint32_t(10*1024/4)

◆ N_THREADS

#define N_THREADS   5

◆ TIMEOUT_S

#define TIMEOUT_S   50

Definition at line 58 of file test_multithreaded.cpp.

Referenced by uhal::tests::job_multiple().