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
fef09121
Commit
fef09121
authored
Nov 14, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ndb - wl#1497 add LinearPool
storage/ndb/src/kernel/vm/testSuperPool.cpp: test LinearPool
parent
2e3dfebb
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
558 additions
and
2 deletions
+558
-2
storage/ndb/src/kernel/vm/LinearPool.hpp
storage/ndb/src/kernel/vm/LinearPool.hpp
+480
-0
storage/ndb/src/kernel/vm/testSuperPool.cpp
storage/ndb/src/kernel/vm/testSuperPool.cpp
+78
-2
No files found.
storage/ndb/src/kernel/vm/LinearPool.hpp
0 → 100644
View file @
fef09121
This diff is collapsed.
Click to expand it.
storage/ndb/src/kernel/vm/testSuperPool.cpp
View file @
fef09121
...
...
@@ -23,6 +23,7 @@ exit $?
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
#include "SuperPool.hpp"
#include "LinearPool.hpp"
#include <NdbOut.hpp>
template
<
Uint32
sz
>
...
...
@@ -198,6 +199,74 @@ sp_test(GroupPool& gp)
delete
[]
ptrList
;
}
template
<
class
T
>
static
void
lp_test
(
GroupPool
&
gp
)
{
SuperPool
&
sp
=
gp
.
m_superPool
;
LinearPool
<
T
,
5
>
lp
(
gp
);
ndbout
<<
"linear pool test"
<<
endl
;
Ptr
<
T
>
ptr
;
Uint32
loop
;
for
(
loop
=
0
;
loop
<
3
*
loopcount
;
loop
++
)
{
int
count
=
0
;
while
(
1
)
{
bool
ret
=
lp
.
seize
(
ptr
);
lp
.
verify
();
if
(
!
ret
)
break
;
assert
(
ptr
.
i
==
count
);
Ptr
<
T
>
ptr2
;
ptr2
.
i
=
ptr
.
i
;
ptr2
.
p
=
0
;
lp
.
getPtr
(
ptr2
);
assert
(
ptr
.
p
==
ptr2
.
p
);
count
++
;
}
ndbout
<<
"seized "
<<
count
<<
endl
;
switch
(
loop
%
3
)
{
case
0
:
{
int
n
=
0
;
while
(
n
<
count
)
{
ptr
.
i
=
n
;
lp
.
release
(
ptr
);
lp
.
verify
();
n
++
;
}
ndbout
<<
"released in order"
<<
endl
;
}
break
;
case
1
:
{
int
n
=
count
;
while
(
n
>
0
)
{
n
--
;
ptr
.
i
=
n
;
lp
.
release
(
ptr
);
lp
.
verify
();
}
ndbout
<<
"released in reverse"
<<
endl
;
}
break
;
default:
{
int
coprime
=
random_coprime
(
count
);
int
n
=
0
;
while
(
n
<
count
)
{
int
m
=
(
coprime
*
n
)
%
count
;
ptr
.
i
=
m
;
lp
.
release
(
ptr
);
lp
.
verify
();
n
++
;
}
ndbout
<<
"released at random"
<<
endl
;
}
break
;
}
}
}
static
Uint32
pageSize
=
32768
;
static
Uint32
pageBits
=
17
;
...
...
@@ -218,6 +287,8 @@ template static void sp_test<T2>(GroupPool& sp);
template
static
void
sp_test
<
T3
>(
GroupPool
&
sp
);
template
static
void
sp_test
<
T4
>(
GroupPool
&
sp
);
template
static
void
sp_test
<
T5
>(
GroupPool
&
sp
);
//
template
static
void
lp_test
<
T3
>(
GroupPool
&
sp
);
int
main
()
...
...
@@ -231,13 +302,18 @@ main()
Uint16
s
=
(
Uint16
)
getpid
();
srandom
(
s
);
ndbout
<<
"rand "
<<
s
<<
endl
;
int
count
=
0
;
while
(
++
count
<=
1
)
{
int
count
;
count
=
0
;
while
(
++
count
<=
0
)
{
sp_test
<
T1
>
(
gp
);
sp_test
<
T2
>
(
gp
);
sp_test
<
T3
>
(
gp
);
sp_test
<
T4
>
(
gp
);
sp_test
<
T5
>
(
gp
);
}
count
=
0
;
while
(
++
count
<=
1
)
{
lp_test
<
T3
>
(
gp
);
}
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