Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
fa92c903
Commit
fa92c903
authored
Nov 12, 2014
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
speed up tokudb handler unit tests
parent
43c176a7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
12 deletions
+33
-12
storage/tokudb/tests/Makefile
storage/tokudb/tests/Makefile
+16
-4
storage/tokudb/tests/vlq_test_uint64.cc
storage/tokudb/tests/vlq_test_uint64.cc
+17
-8
No files found.
storage/tokudb/tests/Makefile
View file @
fa92c903
...
@@ -2,7 +2,11 @@ SRCS = $(wildcard *.cc)
...
@@ -2,7 +2,11 @@ SRCS = $(wildcard *.cc)
TARGETS
=
$(
patsubst
%.cc,%,
$(SRCS)
)
TARGETS
=
$(
patsubst
%.cc,%,
$(SRCS)
)
CHECKS
=
$(
patsubst
%,%.check,
$(TARGETS)
)
CHECKS
=
$(
patsubst
%,%.check,
$(TARGETS)
)
CPPFLAGS
=
-I
..
-D__STDC_FORMAT_MACROS
CPPFLAGS
=
-I
..
-D__STDC_FORMAT_MACROS
CXXFLAGS
=
-g
-Wall
-Wextra
-Wno-missing-field-initializers
-Wshadow
-fopenmp
CXXFLAGS
=
-g
-Wall
-Wextra
-Wno-missing-field-initializers
-Wshadow
ifdef
USE_OPENMP
CPPFLAGS
+=
-DUSE_OPENMP
CXXFLAGS
+=
-fopenmp
endif
FRACTALTREE_BASE_DIR
=
../ft-index
FRACTALTREE_BASE_DIR
=
../ft-index
FRACTALTREE_INSTALL_DIR
=
$(FRACTALTREE_BASE_DIR)
/install.debug
FRACTALTREE_INSTALL_DIR
=
$(FRACTALTREE_BASE_DIR)
/install.debug
...
@@ -17,21 +21,29 @@ all: $(TARGETS)
...
@@ -17,21 +21,29 @@ all: $(TARGETS)
clean
:
clean
:
rm
-rf
$(TARGETS)
*
.gcov
*
.gcno
*
.gcda
*
.testdir
*
.dSYM
rm
-rf
$(TARGETS)
*
.gcov
*
.gcno
*
.gcda
*
.testdir
*
.dSYM
check
:
$(CHECKS)
true
%.check
:
%
%.check
:
%
LD_LIBRARY_PATH
=
$(FRACTALTREE_INSTALL_DIR)
/lib
$(VALGRIND)
./
$<
LD_LIBRARY_PATH
=
$(FRACTALTREE_INSTALL_DIR)
/lib
$(VALGRIND)
./
$<
card.check
:
card_test.check card_1.check card_inf.check card_inf_1.check card_random_1.check card_etime.check
card.check
:
card_test.check card_1.check card_inf.check card_inf_1.check card_random_1.check card_etime.check
true
true
ifndef
USE_OPENMP
# unravel vlq_test_uint64 8 times
vlq_test_uint64_%.check
:
LD_LIBRARY_PATH
=
$(FRACTALTREE_INSTALL_DIR)
/lib
$(VALGRIND)
./vlq_test_uint64
$(
patsubst
vlq_test_uint64_%.check,%,
$@
)
8
vlq_test_uint64.check
:
$(foreach i
,
0 1 2 3 4 5 6 7
,
vlq_test_uint64_$(i).check)
true
endif
vlq.check
:
vlq_test.check vlq_test_uint32.check vlq_test_uint64.check
vlq.check
:
vlq_test.check vlq_test_uint32.check vlq_test_uint64.check
true
true
max_test.check
:
max_test
max_test.check
:
max_test
$(VALGRIND)
./
$<
1 2
$(VALGRIND)
./
$<
1 2
check
:
$(CHECKS)
true
%
:
%.cc
%
:
%.cc
$(CXX)
$(CPPFLAGS)
$(CXXFLAGS)
-g
-o
$@
$<
$(CXX)
$(CPPFLAGS)
$(CXXFLAGS)
-g
-o
$@
$<
...
...
storage/tokudb/tests/vlq_test_uint64.cc
View file @
fa92c903
...
@@ -101,9 +101,11 @@ namespace tokudb {
...
@@ -101,9 +101,11 @@ namespace tokudb {
template
size_t
vlq_decode_ui
(
uint64_t
*
np
,
void
*
p
,
size_t
s
);
template
size_t
vlq_decode_ui
(
uint64_t
*
np
,
void
*
p
,
size_t
s
);
}
;
}
;
static
void
test_vlq_uint64
(
void
)
{
// test a slice of the number space where the slice is described by
// a start number and a stride through the space.
static
void
test_vlq_uint64
(
uint64_t
start
,
uint64_t
stride
)
{
printf
(
"%u
\n
"
,
0
);
printf
(
"%u
\n
"
,
0
);
for
(
uint64_t
v
=
0
;
v
<
(
1
<<
7
);
v
++
)
{
for
(
uint64_t
v
=
0
+
start
;
v
<
(
1
<<
7
);
v
+=
stride
)
{
unsigned
char
b
[
10
];
unsigned
char
b
[
10
];
size_t
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
size_t
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
assert
(
out_s
==
1
);
assert
(
out_s
==
1
);
...
@@ -113,7 +115,7 @@ static void test_vlq_uint64(void) {
...
@@ -113,7 +115,7 @@ static void test_vlq_uint64(void) {
}
}
printf
(
"%u
\n
"
,
1
<<
7
);
printf
(
"%u
\n
"
,
1
<<
7
);
for
(
uint64_t
v
=
(
1
<<
7
)
;
v
<
(
1
<<
14
);
v
++
)
{
for
(
uint64_t
v
=
(
1
<<
7
)
+
start
;
v
<
(
1
<<
14
);
v
+=
stride
)
{
unsigned
char
b
[
10
];
unsigned
char
b
[
10
];
size_t
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
size_t
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
assert
(
out_s
==
2
);
assert
(
out_s
==
2
);
...
@@ -123,7 +125,7 @@ static void test_vlq_uint64(void) {
...
@@ -123,7 +125,7 @@ static void test_vlq_uint64(void) {
}
}
printf
(
"%u
\n
"
,
1
<<
14
);
printf
(
"%u
\n
"
,
1
<<
14
);
for
(
uint64_t
v
=
(
1
<<
14
)
;
v
<
(
1
<<
21
);
v
++
)
{
for
(
uint64_t
v
=
(
1
<<
14
)
+
start
;
v
<
(
1
<<
21
);
v
+=
stride
)
{
unsigned
char
b
[
10
];
unsigned
char
b
[
10
];
size_t
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
size_t
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
assert
(
out_s
==
3
);
assert
(
out_s
==
3
);
...
@@ -133,7 +135,7 @@ static void test_vlq_uint64(void) {
...
@@ -133,7 +135,7 @@ static void test_vlq_uint64(void) {
}
}
printf
(
"%u
\n
"
,
1
<<
21
);
printf
(
"%u
\n
"
,
1
<<
21
);
for
(
uint64_t
v
=
(
1
<<
21
)
;
v
<
(
1
<<
28
);
v
++
)
{
for
(
uint64_t
v
=
(
1
<<
21
)
+
start
;
v
<
(
1
<<
28
);
v
+=
stride
)
{
unsigned
char
b
[
10
];
unsigned
char
b
[
10
];
size_t
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
size_t
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
assert
(
out_s
==
4
);
assert
(
out_s
==
4
);
...
@@ -143,9 +145,11 @@ static void test_vlq_uint64(void) {
...
@@ -143,9 +145,11 @@ static void test_vlq_uint64(void) {
}
}
printf
(
"%u
\n
"
,
1
<<
28
);
printf
(
"%u
\n
"
,
1
<<
28
);
#if USE_OPENMP
#pragma omp parallel num_threads(4)
#pragma omp parallel num_threads(4)
#pragma omp for
#pragma omp for
for
(
uint64_t
v
=
(
1
<<
28
);
v
<
(
1ULL
<<
35
);
v
++
)
{
#endif
for
(
uint64_t
v
=
(
1
<<
28
)
+
start
;
v
<
(
1ULL
<<
35
);
v
+=
stride
)
{
unsigned
char
b
[
10
];
unsigned
char
b
[
10
];
size_t
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
size_t
out_s
=
tokudb
::
vlq_encode_ui
<
uint64_t
>
(
v
,
b
,
sizeof
b
);
assert
(
out_s
==
5
);
assert
(
out_s
==
5
);
...
@@ -155,7 +159,12 @@ static void test_vlq_uint64(void) {
...
@@ -155,7 +159,12 @@ static void test_vlq_uint64(void) {
}
}
}
}
int
main
(
void
)
{
int
main
(
int
argc
,
char
*
argv
[])
{
test_vlq_uint64
();
uint64_t
start
=
0
,
stride
=
1
;
if
(
argc
==
3
)
{
start
=
atoll
(
argv
[
1
]);
stride
=
atoll
(
argv
[
2
]);
}
test_vlq_uint64
(
start
,
stride
);
return
0
;
return
0
;
}
}
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