Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
3ed767b6
Commit
3ed767b6
authored
Jun 03, 2013
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added configure option to disable mem. mgmt.
parent
c71a2281
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
64 additions
and
26 deletions
+64
-26
CMakeLists.txt
CMakeLists.txt
+11
-4
configure
configure
+4
-0
cppa/detail/memory.hpp
cppa/detail/memory.hpp
+41
-9
src/memory.cpp
src/memory.cpp
+8
-13
No files found.
CMakeLists.txt
View file @
3ed767b6
...
...
@@ -26,7 +26,7 @@ else (CMAKE_CXX_FLAGS)
set
(
CMAKE_CXX_FLAGS
"-std=c++11 -Wextra -Wall -pedantic"
)
set
(
CMAKE_CXX_FLAGS_DEBUG
"-O0 -g"
)
set
(
CMAKE_CXX_FLAGS_MINSIZEREL
"-Os"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"-O3"
)
set
(
CMAKE_CXX_FLAGS_RELEASE
"-O3
-DNDEBUG
"
)
set
(
CMAKE_CXX_FLAGS_RELWITHDEBINFO
"-O2 -g"
)
endif
(
CMAKE_CXX_FLAGS
)
...
...
@@ -72,11 +72,11 @@ endif ()
# set build type (evaluate ENABLE_DEBUG flag)
if
(
ENABLE_DEBUG
)
set
(
CMAKE_BUILD_TYPE Debug
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DCPPA_DEBUG_MODE"
)
add_definitions
(
-DCPPA_DEBUG_MODE
)
endif
(
ENABLE_DEBUG
)
if
(
CPPA_LOG_LEVEL
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DCPPA_LOG_LEVEL=
${
CPPA_LOG_LEVEL
}
"
)
add_definitions
(
-DCPPA_LOG_LEVEL=
${
CPPA_LOG_LEVEL
}
)
endif
(
CPPA_LOG_LEVEL
)
# set build default build type if not set
...
...
@@ -185,9 +185,13 @@ if (ENABLE_OPENCL)
src/opencl/program.cpp
src/opencl/actor_facade.cpp
src/opencl/command_dispatcher.cpp
)
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-DCPPA_OPENCL"
)
add_definitions
(
-DCPPA_OPENCL
)
endif
(
ENABLE_OPENCL
)
if
(
DISABLE_MEM_MANAGEMENT
)
add_definitions
(
-DCPPA_DISABLE_MEM_MANAGEMENT
)
endif
(
DISABLE_MEM_MANAGEMENT
)
if
(
DISABLE_CONTEXT_SWITCHING
)
# explicitly disabled
else
(
DISABLE_CONTEXT_SWITCHING
)
...
...
@@ -355,8 +359,10 @@ endmacro ()
toYesNo
(
ENABLE_DEBUG DEBUG_MODE_STR
)
toYesNo
(
ENABLE_OPENCL BUILD_OPENCL_STR
)
toYesNo
(
DISABLE_MEM_MANAGEMENT DISABLE_MEM_MANAGEMENT_STR
)
invertYesNo
(
CPPA_NO_EXAMPLES BUILD_EXAMPLES
)
invertYesNo
(
CPPA_NO_UNIT_TESTS BUILD_UNIT_TESTS
)
invertYesNo
(
DISABLE_MEM_MANAGEMENT_STR WITH_MEM_MANAGEMENT
)
if
(
NOT
"
${
CPPA_BUILD_STATIC
}
"
STREQUAL
"yes"
)
set
(
CPPA_BUILD_STATIC
"no"
)
...
...
@@ -383,6 +389,7 @@ message("\n====================| Build Summary |===================="
"
\n
Build static:
${
CPPA_BUILD_STATIC
}
"
"
\n
Bulid static only:
${
CPPA_BUILD_STATIC_ONLY
}
"
"
\n
Build OpenCL:
${
BUILD_OPENCL_STR
}
"
"
\n
With mem. mgmt.:
${
WITH_MEM_MANAGEMENT
}
"
"
\n
"
"
\n
CXX:
${
CMAKE_CXX_COMPILER
}
"
"
\n
CXXFLAGS:
${
CMAKE_CXX_FLAGS
}
${
CMAKE_CXX_FLAGS_
${
build_type
}}
"
...
...
configure
View file @
3ed767b6
...
...
@@ -35,6 +35,7 @@ Usage: $0 [OPTION]... [VAR=VALUE]...
--build-static build libcppa as static and shared library
--build-static-only build libcppa as static library only
--with-opencl build libcppa with OpenCL support
--without-memory-management build libcppa without memory management
Installation Directories:
--prefix=PREFIX installation directory [/usr/local]
...
...
@@ -163,6 +164,9 @@ while [ $# -ne 0 ]; do
--with-opencl
)
append_cache_entry ENABLE_OPENCL BOOL
true
;;
--without-memory-management
)
append_cache_entry DISABLE_MEM_MANAGEMENT BOOL
true
;;
--with-cppa-log-level
=
*
)
level
=
$(
echo
"
$optarg
"
|
tr
'[:lower:]'
'[:upper:]'
)
case
$level
in
...
...
cppa/detail/memory.hpp
View file @
3ed767b6
...
...
@@ -47,12 +47,18 @@ namespace cppa { namespace detail {
namespace
{
constexpr
size_t
s_alloc_size
=
1024
*
1024
;
// allocate ~1mb chunks
constexpr
size_t
s_
min_elements
=
5
;
// don't create less than 5 elements
constexpr
size_t
s_
cache_size
=
10
*
1024
*
1024
;
// cache about 10mb per thread
constexpr
size_t
s_alloc_size
=
1024
*
1024
;
// allocate ~1mb chunks
constexpr
size_t
s_
cache_size
=
10
*
1024
*
1024
;
// cache about 10mb per thread
constexpr
size_t
s_
min_elements
=
5
;
// don't create < 5 elements
}
// namespace <anonymous>
struct
disposer
{
inline
void
operator
()(
memory_managed
*
ptr
)
const
{
ptr
->
request_deletion
();
}
};
class
instance_wrapper
{
public:
...
...
@@ -83,6 +89,36 @@ class memory_cache {
};
class
instance_wrapper
;
template
<
typename
T
>
class
basic_memory_cache
;
#ifdef CPPA_DISABLE_MEM_MANAGEMENT
class
memory
{
memory
()
=
delete
;
public:
/*
* @brief Allocates storage, initializes a new object, and returns
* the new instance.
*/
template
<
typename
T
,
typename
...
Ts
>
static
T
*
create
(
Ts
&&
...
args
)
{
return
new
T
(
std
::
forward
<
Ts
>
(
args
)...);
}
static
inline
memory_cache
*
get_cache_map_entry
(
const
std
::
type_info
*
)
{
return
nullptr
;
}
};
#else // CPPA_DISABLE_MEM_MANAGEMENT
template
<
typename
T
>
class
basic_memory_cache
:
public
memory_cache
{
...
...
@@ -163,12 +199,6 @@ class basic_memory_cache : public memory_cache {
};
struct
disposer
{
inline
void
operator
()(
memory_managed
*
ptr
)
const
{
ptr
->
request_deletion
();
}
};
class
memory
{
memory
()
=
delete
;
...
...
@@ -209,6 +239,8 @@ class memory {
};
#endif // CPPA_DISABLE_MEM_MANAGEMENT
}
}
// namespace cppa::detail
#endif // CPPA_MEMORY_HPP
src/memory.cpp
View file @
3ed767b6
...
...
@@ -36,6 +36,12 @@
using
namespace
std
;
#ifdef CPPA_DISABLE_MEM_MANAGEMENT
int
cppa_memory_keep_compiler_happy
()
{
return
0
;
}
#else // CPPA_DISABLE_MEM_MANAGEMENT
namespace
cppa
{
namespace
detail
{
namespace
{
...
...
@@ -84,17 +90,6 @@ void memory::add_cache_map_entry(const type_info* tinf, memory_cache* instance)
instance_wrapper
::~
instance_wrapper
()
{
}
//pair<instance_wrapper*, void*> memory::allocate(const type_info* type) {
// return get_cache_map_entry(type)->allocate();
//}
//recursive_queue_node* memory::new_queue_node() {
// typedef recursive_queue_node type;
// return get_cache_map_entry(&typeid(type))->typed_new<type>();
//}
//void memory::deallocate(const type_info* type, void* ptr) {
// return get_cache_map_entry(type)->deallocate(ptr);
//}
}
}
// namespace cppa::detail
#endif // CPPA_DISABLE_MEM_MANAGEMENT
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment