Commit 334832ca by Tobias Schuele

Merge branch 'development' of https://github.com/siemens/embb into development

parents 4e6473e9 cd283998
......@@ -39,7 +39,12 @@ function (CreateDoxygenDocumentationTarget)
#-- Add a custom target to run Doxygen when ever the project is built
if (TARGET doxygen)
# Do nothing, since the repeated adding causes an error
else()
else()
set(DOXYGEN_TEMPLATE_FILES
"doc/reference/header.html")
file(COPY ${DOXYGEN_TEMPLATE_FILES} DESTINATION ${PROJECT_BINARY_DIR})
add_custom_target (
doxygen
#ALL
......
......@@ -33,7 +33,7 @@ function(SetInstallPaths)
# Default install path is in build directory.
if (DEFINED UNIX)
set(CMAKE_INSTALL_PREFIX "/usr/local")
set(INSTALL_PREFIX_DOCS "/usr/local/share/doc/${CMAKE_PROJECT_NAME}-${EMBB_BASE_VERSION_MAJOR}.${EMBB_BASE_VERSION_MINOR}")
set(INSTALL_PREFIX_DOCS "/usr/local/share/doc/${CMAKE_PROJECT_NAME}-${EMBB_BASE_VERSION_MAJOR}.${EMBB_BASE_VERSION_MINOR}.${EMBB_BASE_VERSION_PATCH}")
else()
file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _PROG_FILES) # 32-bit dir on win32, useless to us on win64
file(TO_CMAKE_PATH "$ENV{ProgramFiles(x86)}" _PROG_FILES_X86) # 32-bit dir: only set on win64
......
......@@ -135,8 +135,11 @@ SetInstallPaths()
## DOXYGEN
#
include(CMakeCommon/CreateDoxygenDocumentationTarget.cmake)
CreateDoxygenDocumentationTarget()
if(EXISTS "${EMBB_SOURCE_DIR}/doc/reference/Doxyfile.in")
include(CMakeCommon/CreateDoxygenDocumentationTarget.cmake)
CreateDoxygenDocumentationTarget()
endif()
if (INSTALL_DOCS STREQUAL ON)
install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/doc/
......
......@@ -134,7 +134,7 @@ Choose an appropriate build file generator for your system.
A list of all available generators can be displayed by typing "cmake" without
any options. The build files can be generated using the following command:
cmake -G <generator> .. [OPTIONS]
cmake -G <generator> .. [OPTIONS]
Note that on Linux, the architecture (32/64 bit) cannot be selected by the
generator. However, the build mode (Release/Debug) can be specified using the
......@@ -156,11 +156,11 @@ Now you can generate the build files as shown by the following examples.
For a Linux Debug build with exception handling, type
cmake -G "Unix Makefiles" .. -DCMAKE_BUILD_TYPE=Debug
cmake -G "Unix Makefiles" .. -DCMAKE_BUILD_TYPE=Debug
For a Windows build (VS 2013, x86) without exception handling, type
cmake -G "Visual Studio 12" .. -DUSE_EXCEPTIONS=OFF
cmake -G "Visual Studio 12" .. -DUSE_EXCEPTIONS=OFF
Note that "Visual Studio 12" refers to the version number of Visual Studio and
not to the year in which it was released (2013).
......@@ -174,11 +174,11 @@ whereas on Windows, it has to be specified now.
For a Linux build, type
cmake --build .
cmake --build .
For a Windows Release build, type
cmake --build . --config Release
cmake --build . --config Release
3. Running the tests
--------------------
......@@ -188,11 +188,11 @@ executables are contained in the subfolder "binaries".
On Linux, type
binaries/run_tests.sh
binaries/run_tests.sh
On Windows, type
binaries\run_tests.bat
binaries\run_tests.bat
If no error message occurs, EMBB is working fine.
......@@ -201,23 +201,23 @@ If no error message occurs, EMBB is working fine.
The default installation path on Linux is
/usr/local/
/usr/local/
and on Windows
C:\Program Files\embb-X.Y.Z\ or C:\Program Files (x86)\embb-X.Y.Z
C:\Program Files\embb-X.Y.Z\ or C:\Program Files (x86)\embb-X.Y.Z
depending on the target architecture.
If you want a different installation path, you can change it now by typing
cmake -DINSTALL_PREFIX=YourCustomPath ..
cmake -DINSTALL_PREFIX=YourCustomPath ..
The option "-DINSTALL_PREFIX=YourCustomPath" can also be given in Step 1.
To install the files, use the command
cmake --build . --target install
cmake --build . --target install
which copies the contents of the "install" folder to the "bin", "lib", and
"include" folders in the installation path. For the default paths, the
......@@ -237,27 +237,27 @@ If you want to use the C++ functionalities of EMBB, you have to link the
following libraries (names will be different on Windows and on Linux) in the
given order:
embb_base, embb_base_cpp, embb_mtapi_c, embb_mtapi_cpp, embb_containers_cpp,
embb_algorithms_cpp, embb_dataflow_cpp
embb_base, embb_base_cpp, embb_mtapi_c, embb_mtapi_cpp, embb_containers_cpp,
embb_algorithms_cpp, embb_dataflow_cpp
The C++ header files can be included as follows:
#include<embb/mtapi/mtapi.h>
#include<embb/base/base.h>
#include<embb/containers/containers.h>
#include<embb/dataflow/dataflow.h>
#include<embb/mtapi/mtapi.h>
#include<embb/base/base.h>
#include<embb/containers/containers.h>
#include<embb/dataflow/dataflow.h>
2. Using C
----------
The following libraries have to be linked in the given order:
embb_base_c, mtapi_c
embb_base_c, mtapi_c
The C header files can be included as follows:
#include<embb/mtapi/c/mtapi.h> or #include<mtapi.h>
#include<embb/base/c/base.h>
#include<embb/mtapi/c/mtapi.h> or #include<mtapi.h>
#include<embb/base/c/base.h>
Documentation
......
......@@ -94,12 +94,22 @@ void embb_core_set_init(embb_core_set_t* core_set, int initializer) {
#ifdef EMBB_HAS_HEADER_SYSINFO
#include <sys/sysinfo.h>
#endif
#ifdef __FreeBSD__
#include <sys/types.h>
#include <sys/sysctl.h>
#endif
unsigned int embb_core_count_available() {
#ifdef EMBB_HAS_HEADER_SYSINFO
return get_nprocs();
#elif defined __FreeBSD__
const size_t bs = sizeof(unsigned int);
char buf[bs];
size_t len = bs;
sysctlbyname("hw.ncpu", buf, &len, NULL, 0);
return *(unsigned int*)&buf;
#else
#error "No header sysinfo available!"
#error "No implementation for embb_core_count_available()!"
#endif
}
......
......@@ -28,7 +28,7 @@
#include <embb/base/c/internal/config.h>
#include <embb/base/c/atomic.h>
#include <embb/base/c/internal/unused.h>
#include <malloc.h>
#include <stdlib.h>
#include <assert.h>
#ifdef EMBB_DEBUG
......
......@@ -144,9 +144,18 @@ template< typename GuardType >
HazardPointerThreadEntry<GuardType>::
HazardPointerThreadEntry(GuardType undefined_guard, int guards_per_thread,
size_t max_size_retired_list) :
#ifdef EMBB_DEBUG
who_is_scanning(-1),
#endif
undefined_guard(undefined_guard),
guards_per_thread(guards_per_thread),
max_size_retired_list(max_size_retired_list),
// initially, each potential thread is active... if that is not the case
// another thread could call "HelpScan", and block this thread in making
// progress.
// Still, threads can be leave the hazard pointer processing (deactivation),
// but this can only be done once, i.e., this is not revertable...
is_active(1),
retired_list(max_size_retired_list),
retired_list_temp(max_size_retired_list),
hazard_pointer_list_temp(embb::base::Thread::GetThreadsMaxCount() *
......@@ -190,7 +199,7 @@ GuardPointer(int guardNumber, GuardType pointerToGuard) {
template< typename GuardType >
void HazardPointerThreadEntry<GuardType>::SetActive(bool active) {
if (active == true)
is_active = 1;
is_active = 1;
else
is_active = 0;
}
......@@ -231,16 +240,6 @@ HazardPointer< GuardType >::GetHazardPointerElementForCurrentThread() {
// stop operating, and the others are responsible for his retired
// list.
// int expected = false;
HazardPointerThreadEntry_t* current_thread_entry =
&hazard_pointer_thread_entry_array[GetCurrentThreadIndex()];
// If not active, activate it
if (!current_thread_entry->IsActive()) {
current_thread_entry->SetActive(true);
active_hazard_pointer++;
}
return hazard_pointer_thread_entry_array[GetCurrentThreadIndex()];
}
......@@ -270,6 +269,16 @@ void HazardPointer< GuardType >::HelpScan() {
template< typename GuardType >
void HazardPointer< GuardType >::
Scan(HazardPointerThreadEntry_t* currentHazardPointerEntry) {
#ifdef EMBB_DEBUG
// scan should only be executed by one thread at a time, otherwise we have
// a bug... this assertions checks that
int expected = -1;
if (!currentHazardPointerEntry->GetScanningThread().CompareAndSwap(
expected, GetCurrentThreadIndex()))
{
assert(false);
}
#endif
// In this function, we compute the intersection between local retired
// pointers and all hazard pointers. This intersection cannot be deleted and
// forms the new local retired pointers list.
......@@ -320,6 +329,10 @@ Scan(HazardPointerThreadEntry_t* currentHazardPointerEntry) {
}
currentHazardPointerEntry->SetRetired(
currentHazardPointerEntry->GetRetiredTemp());
#ifdef EMBB_DEBUG
currentHazardPointerEntry->GetScanningThread().Store(-1);
#endif
}
template< typename GuardType >
......@@ -335,7 +348,8 @@ HazardPointer< GuardType >::HazardPointer(
GuardType undefined_guard, int guards_per_thread) :
undefined_guard(undefined_guard),
guards_per_thread(guards_per_thread),
active_hazard_pointer(0),
//initially, all potential hazard pointers are active...
active_hazard_pointer(embb::base::Thread::GetThreadsMaxCount()),
free_guard_callback(free_guard_callback) {
hazard_pointers = embb::base::Thread::GetThreadsMaxCount();
......@@ -388,6 +402,7 @@ void HazardPointer< GuardType >::EnqueuePointerForDeletion(
if (IsThresholdExceeded()) {
HazardPointerThreadEntry_t* currentHazardPointerEntry =
&GetHazardPointerElementForCurrentThread();
Scan(currentHazardPointerEntry);
// Help deactivated threads to clean their retired nodes.
......
......@@ -169,7 +169,17 @@ class FixedSizeList {
*/
template< typename GuardType >
class HazardPointerThreadEntry {
private:
#ifdef EMBB_DEBUG
public:
embb::base::Atomic<int>& GetScanningThread()
{
return who_is_scanning;
}
private:
embb::base::Atomic<int> who_is_scanning;
#endif
private:
/**
* Value of the undefined guard (means that no guard is set).
*/
......
......@@ -27,6 +27,7 @@
#ifndef EMBB_DATAFLOW_INTERNAL_SELECT_H_
#define EMBB_DATAFLOW_INTERNAL_SELECT_H_
#include <embb/dataflow/internal/action.h>
#include <embb/dataflow/internal/signal.h>
#include <embb/dataflow/internal/node.h>
#include <embb/dataflow/internal/inputs.h>
......
......@@ -27,6 +27,7 @@
#ifndef EMBB_DATAFLOW_INTERNAL_SWITCH_H_
#define EMBB_DATAFLOW_INTERNAL_SWITCH_H_
#include <embb/dataflow/internal/action.h>
#include <embb/dataflow/internal/signal.h>
#include <embb/dataflow/internal/node.h>
#include <embb/dataflow/internal/inputs.h>
......
......@@ -205,7 +205,7 @@ IGNORE_PREFIX = cm
GENERATE_HTML = YES
HTML_OUTPUT = html
HTML_FILE_EXTENSION = .html
HTML_HEADER =
HTML_HEADER = header.html
HTML_FOOTER =
HTML_STYLESHEET =
HTML_EXTRA_STYLESHEET = @CMAKE_SOURCE_DIR@/doc/reference/DoxygenHTMLStyle.css
......
<!-- HTML header for doxygen 1.8.6-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen $doxygenversion"/>
<!--BEGIN PROJECT_NAME--><title>$projectname: $title</title><!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME--><title>$title</title><!--END !PROJECT_NAME-->
<link href="$relpath^tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="$relpath^jquery.js"></script>
<script type="text/javascript" src="$relpath^dynsections.js"></script>
<script type="text/javascript">
var is_modules_page = location.pathname.match(".*modules.html");
$(document).ready(function() { if (toggleLevel && is_modules_page) toggleLevel(2); });
</script>
$treeview
$search
$mathjax
<link href="$relpath^$stylesheet" rel="stylesheet" type="text/css" />
$extrastylesheet
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<!--BEGIN TITLEAREA-->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<!--BEGIN PROJECT_LOGO-->
<td id="projectlogo"><img alt="Logo" src="$relpath^$projectlogo"/></td>
<!--END PROJECT_LOGO-->
<!--BEGIN PROJECT_NAME-->
<td style="padding-left: 0.5em;">
<div id="projectname">$projectname
<!--BEGIN PROJECT_NUMBER-->&#160;<span id="projectnumber">$projectnumber</span><!--END PROJECT_NUMBER-->
</div>
<!--BEGIN PROJECT_BRIEF--><div id="projectbrief">$projectbrief</div><!--END PROJECT_BRIEF-->
</td>
<!--END PROJECT_NAME-->
<!--BEGIN !PROJECT_NAME-->
<!--BEGIN PROJECT_BRIEF-->
<td style="padding-left: 0.5em;">
<div id="projectbrief">$projectbrief</div>
</td>
<!--END PROJECT_BRIEF-->
<!--END !PROJECT_NAME-->
<!--BEGIN DISABLE_INDEX-->
<!--BEGIN SEARCHENGINE-->
<td>$searchbox</td>
<!--END SEARCHENGINE-->
<!--END DISABLE_INDEX-->
</tr>
</tbody>
</table>
</div>
<!--END TITLEAREA-->
<!-- end header part -->
......@@ -42,7 +42,7 @@ void embb_mtapi_id_pool_initialize(
for (ii = 1; ii < capacity; ii++) {
that->id_buffer[ii] = ii;
}
that->ids_availabe = capacity - 1;
that->ids_available = capacity - 1;
that->put_id_position = 0;
that->get_id_position = 1;
embb_mtapi_spinlock_initialize(&that->lock);
......@@ -50,7 +50,7 @@ void embb_mtapi_id_pool_initialize(
void embb_mtapi_id_pool_finalize(embb_mtapi_id_pool_t * that) {
that->capacity = 0;
that->ids_availabe = 0;
that->ids_available = 0;
that->get_id_position = 0;
that->put_id_position = 0;
embb_mtapi_alloc_deallocate(that->id_buffer);
......@@ -64,9 +64,9 @@ mtapi_uint_t embb_mtapi_id_pool_allocate(embb_mtapi_id_pool_t * that) {
assert(MTAPI_NULL != that);
if (embb_mtapi_spinlock_acquire(&that->lock)) {
if (0 < that->ids_availabe) {
if (0 < that->ids_available) {
/* take away one id */
that->ids_availabe--;
that->ids_available--;
/* acquire position to fetch id from */
mtapi_uint_t id_position = that->get_id_position;
......@@ -93,7 +93,7 @@ void embb_mtapi_id_pool_deallocate(
assert(MTAPI_NULL != that);
if (embb_mtapi_spinlock_acquire(&that->lock)) {
if (that->capacity > that->ids_availabe) {
if (that->capacity > that->ids_available) {
/* acquire position to put id to */
mtapi_uint_t id_position = that->put_id_position;
that->put_id_position++;
......@@ -105,7 +105,7 @@ void embb_mtapi_id_pool_deallocate(
that->id_buffer[id_position] = id;
/* make it available */
that->ids_availabe++;
that->ids_available++;
}
embb_mtapi_spinlock_release(&that->lock);
} else {
......
......@@ -48,7 +48,7 @@ extern "C" {
struct embb_mtapi_id_pool_struct {
mtapi_uint_t capacity;
mtapi_uint_t *id_buffer;
mtapi_uint_t ids_availabe;
mtapi_uint_t ids_available;
mtapi_uint_t get_id_position;
mtapi_uint_t put_id_position;
embb_mtapi_spinlock_t lock;
......
......@@ -140,6 +140,11 @@ rsync \
--exclude "doc/tutorial/content" \
--exclude "doc/tutorial/*.tex" \
--exclude "doc/tutorial/*.bib" \
--exclude "doc/reference/*.xml" \
--exclude "doc/reference/*.dox" \
--exclude "doc/reference/*.in" \
--exclude "doc/reference/header.html" \
--exclude "doc/reference/*.css" \
--exclude "doc/examples/insert_snippets.py" \
--archive --recursive ${d} $MYTMPDIR/${n}
......
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
File mode changed from 100644 to 100755
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment