Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
code
PTable
Commits
32df83b9
Commit
32df83b9
authored
Dec 07, 2017
by
Philipp Götze
Browse files
Adapted the way of configuration using a config file and options
parent
541eb94f
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
32df83b9
...
...
@@ -6,42 +6,38 @@ set(CMAKE_MACOSX_RPATH 1)
set
(
PTable_VERSION_MAJOR 0
)
set
(
PTable_VERSION_MINOR 1
)
#############################
# customization section
#############################
#############################
###################################################
# customization section
#
#############################
###################################################
# Installation path
if
(
!PTABLE_DIR
)
set
(
PTABLE_DIR
"/usr/local/ptable"
)
endif
()
# Set t
o 1 if you need log output
add_definitions
(
-DDO_LOG=0
)
# Set t
he mount path of your pmem device where the should be stored
set
(
PMEM_MNT_PATH
"/mnt/pmem/test"
)
# Build test cases for ptable functionality checks
# If switched to off, no test will be build
option
(
BUILD_TEST_CASES
"build tests for PTABLE functionality"
ON
)
option
(
ENABLE_LOG
"enables log output for e.g. debugging"
OFF
)
option
(
BUILD_TEST_CASES
"build tests for PTable functionality"
ON
)
option
(
BUILD_GOOGLE_BENCH
"build google benchmark"
OFF
)
option
(
BUILD_BENCHMARKS
"build benchmarks for Ptable"
OFF
)
#Build google benchmark library
option
(
BUILD_GOOGLE_BENCH
"build google benchmark"
OFF
)
# Build benchmark test
option
(
BUILD_BENCHMARKS
"build benchmarks for PTABLE"
OFF
)
################################################################################
# End of customization section #
################################################################################
# Benchmark test requires benchmark library
if
(
BUILD_BENCHMARKS
)
set
(
BUILD_GOOGLE_BENCH ON
)
endif
()
if
(
ENABLE_LOG
)
set
(
PLOG 1
)
else
()
set
(
PLOG 0
)
endif
()
# C++ compiler flags
set
(
CMAKE_CXX_FLAGS
"
${
CMAKE_CXX_FLAGS
}
-std=c++14 -Wall -Wno-deprecated -g -O2 -Wsign-compare"
)
if
(
"
${
CMAKE_CXX_COMPILER_ID
}
"
MATCHES
"Clang"
)
...
...
@@ -54,9 +50,6 @@ endif()
set
(
CMAKE_C_FLAGS
"
${
CMAKE_C_FLAGS
}
-Wall -Wno-unused -Wno-uninitialized"
)
# End of customization section
#---------------------------------------------------------------------------
# Add our CMake directory to CMake's module path
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/../cmake/"
)
...
...
@@ -102,7 +95,10 @@ include_directories("${THIRD_PARTY_DIR}/variant/include")
# Building PTable library
#
include_directories
(
"
${
PROJECT_SOURCE_DIR
}
"
)
configure_file
(
config.h.in
${
CMAKE_BINARY_DIR
}
/generated/config.h
)
include_directories
(
${
PROJECT_SOURCE_DIR
}
${
CMAKE_BINARY_DIR
}
/generated/
)
# because we have downloaded external projects into build we have to add them here
include_directories
(
"
${
THIRD_PARTY_DIR
}
"
)
...
...
src/bench/common.h
View file @
32df83b9
...
...
@@ -44,7 +44,7 @@ struct root {
persistent_ptr
<
PTableType
>
pTable
;
};
const
std
::
string
path
=
"/mnt/pmem/test/
benchdb.db"
;
const
std
::
string
path
=
ptable
::
gPmemPath
+
"
benchdb.db"
;
const
auto
NUM_TUPLES
=
100
*
1000
;
const
auto
POOL_SIZE
=
1024
*
1024
*
256
;
...
...
src/bench/point.cpp
View file @
32df83b9
...
...
@@ -28,7 +28,7 @@ static void BM_PointQuery(benchmark::State& state) {
pool
<
root
>
pop
;
const
std
::
string
path
=
"/mnt/pmem/test/
benchdb"
+
std
::
to_string
(
state
.
range
(
0
))
+
".db"
;
const
std
::
string
path
=
ptable
::
gPmemPath
+
"
benchdb"
+
std
::
to_string
(
state
.
range
(
0
))
+
".db"
;
std
::
remove
(
path
.
c_str
());
...
...
src/config.h.in
0 → 100644
View file @
32df83b9
#ifndef PTABLE_CONFIG_H
#define PTABLE_CONFIG_H
#define PLOG(msg) if(@PLOG@) std::cout << "[PTable] " << msg << '\n';
namespace ptable {
const std::string gPmemPath("@PMEM_MNT_PATH@/");
}
#endif /* PTABLE_CONFIG_H */
src/core/DataNode.hpp
View file @
32df83b9
...
...
@@ -23,11 +23,10 @@
#include
<array>
#include
<unordered_map>
#include
"config.h"
#include
<libpmemobj++/make_persistent.hpp>
#include
<libpmemobj++/persistent_ptr.hpp>
#define PLOG(msg) if(DO_LOG) std::cout << "[PTable] " << msg << '\n';
namespace
ptable
{
using
nvml
::
obj
::
persistent_ptr
;
...
...
@@ -35,18 +34,18 @@ using nvml::obj::make_persistent;
using
nvml
::
obj
::
delete_persistent
;
/** Positions in NVM_Block */
const
int
gBDCCRangePos1
=
0
;
const
int
gBDCCRangePos2
=
4
;
const
int
gCountPos
=
8
;
const
int
gFreeSpacePos
=
12
;
const
int
gSmaOffsetPos
=
14
;
const
int
gDataOffsetPos
=
16
;
const
expr
int
gBDCCRangePos1
=
0
;
const
expr
int
gBDCCRangePos2
=
4
;
const
expr
int
gCountPos
=
8
;
const
expr
int
gFreeSpacePos
=
12
;
const
expr
int
gSmaOffsetPos
=
14
;
const
expr
int
gDataOffsetPos
=
16
;
/** Sizes/Lengths in NVM_Block */
const
int
gFixedHeaderSize
=
14
;
const
int
gBDCCValueSize
=
4
;
const
int
gAttrOffsetSize
=
4
;
const
int
gOffsetSize
=
2
;
const
expr
int
gFixedHeaderSize
=
14
;
const
expr
int
gBDCCValueSize
=
4
;
const
expr
int
gAttrOffsetSize
=
4
;
const
expr
int
gOffsetSize
=
2
;
/** The size of a single block in persistent memory */
static
constexpr
std
::
size_t
gBlockSize
=
1
<<
12
;
// 12->4KB, 15->32KB, max 16 due to data types
...
...
src/test/PTableTest.cpp
View file @
32df83b9
...
...
@@ -42,7 +42,7 @@ TEST_CASE("Testing storing tuples in PTable", "[PTable]") {
pool
<
root
>
pop
;
const
std
::
string
path
=
"/mnt/pmem/test/
testdb.db"
;
const
std
::
string
path
=
gPmemPath
+
"
testdb.db"
;
if
(
access
(
path
.
c_str
(),
F_OK
)
!=
0
)
{
pop
=
pool
<
root
>::
create
(
path
,
LAYOUT
,
16
*
1024
*
1024
);
...
...
Write
Preview
Supports
Markdown
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