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
PMem-based Data Structures
Commits
3ca48bc6
Commit
3ca48bc6
authored
May 08, 2019
by
Philipp Götze
Browse files
🔥
Removed manual profiling
parent
25ad6535
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
src/CMakeLists.txt
View file @
3ca48bc6
...
...
@@ -14,7 +14,6 @@ if(NOT PROJECT_INSTALL_DIR)
endif
()
option
(
ENABLE_LOG
"enables log output for e.g. debugging"
OFF
)
option
(
ENABLE_PROFILING
"enables profiling for some of the structures"
OFF
)
option
(
BUILD_TEST_CASES
"build tests for functionality of structures"
ON
)
option
(
BUILD_GOOGLE_BENCH
"build google benchmark"
OFF
)
option
(
BUILD_BENCHMARKS
"build benchmarks for structures"
ON
)
...
...
@@ -27,10 +26,6 @@ if(ENABLE_LOG)
add_definitions
(
"-DENABLE_LOG"
)
endif
()
if
(
ENABLE_PROFILING
)
add_definitions
(
"-DENABLE_PROFILING"
)
endif
()
# Benchmark test requires benchmark library
if
(
BUILD_BENCHMARKS
)
set
(
BUILD_GOOGLE_BENCH ON
)
...
...
src/bench/performance_test.cpp
View file @
3ca48bc6
...
...
@@ -103,7 +103,6 @@ int main(){
curr_test_size
--
;
keys
[
choosen_key
]
=
keys
[
curr_test_size
];
}
auto
avg
=
std
::
accumulate
(
insert_measures
.
begin
(),
insert_measures
.
end
(),
0
)
/
insert_measures
.
size
();
auto
minmax
=
std
::
minmax_element
(
std
::
begin
(
insert_measures
),
std
::
end
(
insert_measures
));
...
...
@@ -111,9 +110,6 @@ int main(){
<<
"
\n\t
Average:
\t
"
<<
avg
<<
"
\n\t
Min:
\t
"
<<
*
minmax
.
first
<<
"
\n\t
Max:
\t
"
<<
*
minmax
.
second
<<
'\n'
;
#ifdef IDXPROFILE
pTable
->
printIdxProfile
();
#endif
std
::
cout
<<
"
\n
####################################
\n
"
;
//Lookup measures
...
...
@@ -126,21 +122,18 @@ int main(){
std
::
cout
<<
"Didn't find "
<<
key
<<
std
::
endl
;
}
end
=
std
::
chrono
::
high_resolution_clock
::
now
();
auto
diff
=
std
::
chrono
::
duration_cast
<
std
::
chrono
::
microseconds
>
(
end
-
start
).
count
();
lookup_measures
.
push_back
(
diff
);
}
avg
=
std
::
accumulate
(
lookup_measures
.
begin
(),
lookup_measures
.
end
(),
0
)
/
lookup_measures
.
size
();
minmax
=
std
::
minmax_element
(
std
::
begin
(
lookup_measures
),
std
::
end
(
lookup_measures
));
std
::
cout
<<
"
\n
Lookup Statistics in µs: "
<<
"
\n\t
Average:
\t
"
<<
avg
<<
"
\n\t
Min:
\t
"
<<
*
minmax
.
first
<<
"
\n\t
Max:
\t
"
<<
*
minmax
.
second
<<
'\n'
;
#ifdef IDXPROFILE
pTable
->
printIdxProfile
();
#endif
std
::
cout
<<
"
\n
####################################
\n
"
;
//Delete measures
...
...
@@ -161,18 +154,14 @@ int main(){
if
(
i
==
3
*
TEST_SIZE
/
4
){
std
::
cout
<<
"Fortschritt: 75%"
<<
std
::
endl
;}
curr_test_size
--
;
keys
[
choosen_key
]
=
keys
[
curr_test_size
];
}
avg
=
std
::
accumulate
(
delete_measures
.
begin
(),
delete_measures
.
end
(),
0
)
/
delete_measures
.
size
();
minmax
=
std
::
minmax_element
(
std
::
begin
(
delete_measures
),
std
::
end
(
delete_measures
));
std
::
cout
<<
"
\n
Delete Statistics in µs: "
<<
"
\n\t
Average:
\t
"
<<
avg
<<
"
\n\t
Min:
\t
"
<<
*
minmax
.
first
<<
"
\n\t
Max:
\t
"
<<
*
minmax
.
second
<<
'\n'
;
#ifdef IDXPROFILE
pTable
->
printIdxProfile
();
#endif
pop
.
close
();
}
...
...
src/config.h.in
View file @
3ca48bc6
...
...
@@ -8,26 +8,6 @@
#define LOG(msg)
#endif
#ifdef ENABLE_PROFILING
#include <memory>
#include <IdxProfile.hpp>
#define PROFILE_DECL std::unique_ptr<IdxProfile> profile;
#define PROFILE_INIT profile = std::make_unique<IdxProfile>();
#define PROFILE_READ(n) profile->read(n);
#define PROFILE_WRITE(n) profile->write(n);
#define PROFILE_SPLIT profile->split();
#define PROFILE_UNDERFLOW profile->underflow();
#define PROFILE_PRINT void printIdxProfile() { profile->print(); }
#else
#define PROFILE_DECL
#define PROFILE_INIT
#define PROFILE_READ(n)
#define PROFILE_WRITE(n)
#define PROFILE_SPLIT
#define PROFILE_UNDERFLOW
#define PROFILE_PRINT
#endif
namespace dbis {
const std::string gPmemPath("@PMEM_MNT_PATH@/");
}
...
...
src/fptree/FPTree.hpp
View file @
3ca48bc6
...
...
@@ -167,7 +167,6 @@ class FPTree {
return
newNode
;
}
void
deleteLeafNode
(
persistent_ptr
<
LeafNode
>
node
)
{
auto
pop
=
pmem
::
obj
::
pool_by_vptr
(
this
);
transaction
::
run
(
pop
,
[
&
]
{
...
...
@@ -201,8 +200,6 @@ class FPTree {
Node
rootNode
;
//< pointer to the root node
persistent_ptr
<
LeafNode
>
leafList
;
//<Pointer to the leaf at the most left position. Neccessary for recovery
PROFILE_DECL
public:
/**
* Typedef for a function passed to the scan method.
...
...
@@ -266,7 +263,6 @@ class FPTree {
rootNode
=
newLeafNode
();
leafList
=
rootNode
.
leaf
;
depth
=
0
;
PROFILE_INIT
LOG
(
"created new FPTree with sizeof(BranchNode) = "
<<
sizeof
(
BranchNode
)
<<
", sizeof(LeafNode) = "
<<
sizeof
(
LeafNode
));
}
...
...
@@ -357,7 +353,6 @@ class FPTree {
auto
node
=
rootNode
.
branch
;
assert
(
node
!=
nullptr
);
result
=
eraseFromBranchNode
(
node
,
depth
,
key
);
}
});
return
result
;
...
...
@@ -412,8 +407,6 @@ class FPTree {
}
}
PROFILE_PRINT
/**
* Perform a scan over all key-value pairs stored in the tree.
* For each entry the given function @func is called.
...
...
@@ -509,7 +502,6 @@ class FPTree {
else
insertInLeafNodeAtPosition
(
sibling
,
sibRef
.
search
.
get_ro
().
getFreeZero
(),
key
,
val
);
/* inform the caller about the split */
splitRef
.
key
=
sibRef
.
keys
.
get_ro
()[
findMinKeyAtLeafNode
(
sibling
)];
split
=
true
;
...
...
@@ -569,7 +561,6 @@ class FPTree {
splitRef
.
key
=
splitKey
;
}
/**
* Insert a (key, value) pair at the given position @c pos into the leaf node
* @c node. The caller has to ensure that
...
...
@@ -766,7 +757,6 @@ class FPTree {
return
pos
;
}
/**
* Delete the element with the given key from the given leaf node.
*
...
...
@@ -945,14 +935,12 @@ class FPTree {
BranchNode
*
witnessNode
=
nullptr
;
auto
ppos
=
pos
;
if
(
prevKeys
>
0
)
{
mergeBranchNodes
(
lSibling
,
node
->
keys
[
pos
-
1
],
child
);
ppos
=
pos
-
1
;
witnessNode
=
child
;
newChild
=
lSibling
;
// pos -= 1;
}
else
if
(
nextKeys
>
0
)
{
mergeBranchNodes
(
child
,
node
->
keys
[
pos
],
rSibling
);
witnessNode
=
rSibling
;
}
else
...
...
@@ -961,19 +949,15 @@ class FPTree {
// remove node->keys.get_ro()[pos] from node
for
(
auto
i
=
ppos
;
i
<
node
->
numKeys
-
1
;
i
++
)
{
node
->
keys
[
i
]
=
node
->
keys
[
i
+
1
];
}
if
(
pos
==
0
)
pos
++
;
for
(
auto
i
=
pos
;
i
<
node
->
numKeys
;
i
++
)
{
if
(
i
+
1
<=
node
->
numKeys
)
{
node
->
children
[
i
]
=
node
->
children
[
i
+
1
];
}
}
node
->
numKeys
--
;
deleteBranchNode
(
witnessNode
);
return
newChild
;
}
...
...
@@ -1314,7 +1298,6 @@ class FPTree {
auto
child
=
node
->
children
[
k
].
leaf
;
if
(
child
!=
nullptr
)
printLeafNode
(
d
+
1
,
child
);
}
}
}
...
...
src/fptree/PTree.hpp
View file @
3ca48bc6
...
...
@@ -217,8 +217,6 @@ class PTree {
LeafOrBranchNode
rootNode
;
//< pointer to the root node
persistent_ptr
<
LeafNode
>
leafList
;
//<Pointer to the leaf at the most left position. Neccessary for recovery
PROFILE_DECL
public:
/**
* Typedef for a function passed to the scan method.
...
...
@@ -284,7 +282,6 @@ class PTree {
rootNode
=
newLeafNode
();
leafList
=
rootNode
.
leaf
;
depth
=
0
;
PROFILE_INIT
}
/**
...
...
@@ -340,7 +337,6 @@ class PTree {
root
->
numKeys
=
root
->
numKeys
+
1
;
rootNode
.
branch
=
root
;
depth
=
depth
+
1
;
}
}
});
...
...
@@ -397,7 +393,6 @@ class PTree {
auto
node
=
rootNode
.
branch
;
assert
(
node
!=
nullptr
);
result
=
eraseFromBranchNode
(
node
,
depth
,
key
);
}
});
return
result
;
...
...
@@ -441,7 +436,6 @@ class PTree {
}
}
PROFILE_PRINT
/**
* Perform a scan over all key-value pairs stored in the tree.
...
...
@@ -788,7 +782,6 @@ class PTree {
const
unsigned
int
num
=
node
->
numKeys
.
get_ro
();
for
(;
pos
<
num
&&
node
->
keys
.
get_ro
()[
pos
]
<
key
;
pos
++
)
{
};
return
pos
;
}
...
...
@@ -812,7 +805,6 @@ class PTree {
unsigned
int
pos
=
0
;
const
unsigned
int
num
=
node
->
numKeys
;
for
(;
pos
<
num
&&
node
->
keys
[
pos
]
<=
key
;
pos
++
)
{
};
return
pos
;
}
...
...
@@ -836,7 +828,6 @@ class PTree {
unsigned
int
pos
=
0
;
const
unsigned
int
num
=
node
->
numKeys
;
for
(;
pos
<
num
&&
node
->
keys
[
pos
]
<=
key
;
pos
++
)
{
};
return
pos
;
}
...
...
@@ -1612,7 +1603,6 @@ class PTree {
auto
child
=
node
->
children
[
k
].
lowestbranch
;
if
(
child
!=
nullptr
)
printLowestBranchNode
(
d
+
1
,
child
);
}
}
}
...
...
src/pbptree/BitPBPTree.hpp
View file @
3ca48bc6
This diff is collapsed.
Click to expand it.
src/pbptree/UnsortedPBPTree.hpp
View file @
3ca48bc6
This diff is collapsed.
Click to expand it.
src/utils/IdxProfile.hpp
deleted
100644 → 0
View file @
25ad6535
/*
* Copyright (C) 2017-2019 DBIS Group - TU Ilmenau, All Rights Reserved.
*
* This file is part of our NVM-based Data Structures repository.
*
* This program is free software: you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program.
* If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef DBIS_IDXPROFILE_HPP
#define DBIS_IDXPROFILE_HPP
#include
<iostream>
namespace
dbis
{
class
IdxProfile
{
int
read_count
;
int
write_count
;
int
split_count
;
int
underflow_count
;
public:
IdxProfile
()
{
read_count
=
0
;
write_count
=
0
;
split_count
=
0
;
underflow_count
=
0
;
}
void
read
()
{
read_count
++
;
}
void
read
(
int
x
)
{
read_count
+=
x
;
}
void
write
()
{
write_count
++
;
}
void
write
(
int
x
)
{
write_count
+=
x
;
}
void
split
()
{
split_count
++
;
}
void
underflow
()
{
underflow_count
++
;
}
void
diff
(
IdxProfile
prof
)
{
this
->
read_count
-=
prof
.
read_count
;
this
->
write_count
-=
prof
.
write_count
;
this
->
split_count
-=
prof
.
split_count
;
this
->
underflow_count
-=
prof
.
underflow_count
;
}
void
print
()
{
std
::
cout
<<
"
\n
Index Profile"
<<
std
::
endl
;
std
::
cout
<<
"
\t
Reads:
\t
"
<<
read_count
<<
std
::
endl
;
std
::
cout
<<
"
\t
Writes:
\t
"
<<
write_count
<<
std
::
endl
;
std
::
cout
<<
"
\t
Splits:
\t
"
<<
split_count
<<
std
::
endl
;
std
::
cout
<<
"
\t
Underflows:
\t
"
<<
underflow_count
<<
std
::
endl
;
}
};
//end class
}
/* end namespace dbis */
#endif
/* DBIS_IDXPROFILE_HPP */
src/wbtree/wBPTree.hpp
View file @
3ca48bc6
...
...
@@ -208,8 +208,6 @@ class wBPTree {
p
<
unsigned
int
>
depth
;
//< the depth of the tree, i.e. the number of levels (0 => rootNode is LeafNode)
LeafOrBranchNode
rootNode
;
//< pointer to the root node
PROFILE_DECL
public:
/**
* Typedef for a function passed to the scan method.
...
...
@@ -271,7 +269,6 @@ class wBPTree {
*/
wBPTree
()
:
depth
(
0
)
{
rootNode
=
newLeafNode
();
PROFILE_INIT
LOG
(
"created new wBPTree with sizeof(BranchNode) = "
<<
sizeof
(
BranchNode
)
<<
", sizeof(LeafNode) = "
<<
sizeof
(
LeafNode
));
}
...
...
@@ -379,8 +376,6 @@ class wBPTree {
}
}
PROFILE_PRINT
/**
* Perform a scan over all key-value pairs stored in the tree.
* For each entry the given function @func is called.
...
...
@@ -480,7 +475,6 @@ class wBPTree {
return
split
;
}
void
splitLeafNode
(
persistent_ptr
<
LeafNode
>
node
,
SplitInfo
*
splitInfo
)
{
auto
&
nodeRef
=
*
node
;
const
auto
&
slotArray
=
nodeRef
.
search
.
get_ro
().
slot
;
...
...
src/wbtree/wHBPTree.hpp
View file @
3ca48bc6
...
...
@@ -219,8 +219,6 @@ class wHBPTree {
Node
rootNode
;
//< pointer to the root node
persistent_ptr
<
LeafNode
>
leafList
;
//< pointer to the most left leaf node. Necessary for recovery
PROFILE_DECL
public:
/**
* Typedef for a function passed to the scan method.
...
...
@@ -283,7 +281,6 @@ class wHBPTree {
wHBPTree
()
:
depth
(
0
)
{
rootNode
=
newLeafNode
();
leafList
=
rootNode
.
leaf
;
PROFILE_INIT
LOG
(
"created new wHBPTree with sizeof(BranchNode) = "
<<
sizeof
(
BranchNode
)
<<
", sizeof(LeafNode) = "
<<
sizeof
(
LeafNode
));
}
...
...
@@ -428,8 +425,6 @@ class wHBPTree {
}
}
PROFILE_PRINT
/**
* Perform a scan over all key-value pairs stored in the tree.
* For each entry the given function @func is called.
...
...
@@ -1283,7 +1278,6 @@ class wHBPTree {
}
/**
* Print the given leaf node @c node to standard output.
*
...
...
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