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
3e5ca03f
Commit
3e5ca03f
authored
Feb 22, 2006
by
jonas@eel.(none)
Browse files
Options
Browse Files
Download
Plain Diff
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.1-ndb-new
into eel.(none):/home/jonas/src/mysql-5.1-new
parents
4c485eb1
ae07b0a4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp
storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp
+14
-7
storage/ndb/src/kernel/vm/ndbd_malloc_impl.hpp
storage/ndb/src/kernel/vm/ndbd_malloc_impl.hpp
+5
-1
No files found.
storage/ndb/src/kernel/vm/ndbd_malloc_impl.cpp
View file @
3e5ca03f
...
@@ -619,13 +619,18 @@ struct Timer
...
@@ -619,13 +619,18 @@ struct Timer
int
int
main
(
int
argc
,
char
**
argv
)
main
(
int
argc
,
char
**
argv
)
{
{
int
sz
=
3
*
32768
;
int
sz
=
1
*
32768
;
int
run_time
=
30
;
if
(
argc
>
1
)
if
(
argc
>
1
)
sz
=
32
*
atoi
(
argv
[
1
]);
sz
=
32
*
atoi
(
argv
[
1
]);
if
(
argc
>
2
)
run_time
=
atoi
(
argv
[
2
]);
char
buf
[
255
];
char
buf
[
255
];
Timer
timer
[
4
];
Timer
timer
[
4
];
printf
(
"Startar modul test av Page Manager %dMb
\n
"
,
(
sz
>>
5
));
printf
(
"Startar modul test av Page Manager %dMb %ds
\n
"
,
(
sz
>>
5
),
run_time
);
g_eventLogger
.
createConsoleHandler
();
g_eventLogger
.
createConsoleHandler
();
g_eventLogger
.
setCategory
(
"keso"
);
g_eventLogger
.
setCategory
(
"keso"
);
g_eventLogger
.
enable
(
Logger
::
LL_ON
,
Logger
::
LL_INFO
);
g_eventLogger
.
enable
(
Logger
::
LL_ON
,
Logger
::
LL_INFO
);
...
@@ -642,7 +647,7 @@ main(int argc, char** argv)
...
@@ -642,7 +647,7 @@ main(int argc, char** argv)
rl
.
m_curr
=
0
;
rl
.
m_curr
=
0
;
rl
.
m_resource_id
=
0
;
rl
.
m_resource_id
=
0
;
mem
.
set_resource_limit
(
rl
);
mem
.
set_resource_limit
(
rl
);
rl
.
m_min
=
32768
;
rl
.
m_min
=
sz
<
16384
?
sz
:
16384
;
rl
.
m_max
=
0
;
rl
.
m_max
=
0
;
rl
.
m_resource_id
=
1
;
rl
.
m_resource_id
=
1
;
mem
.
set_resource_limit
(
rl
);
mem
.
set_resource_limit
(
rl
);
...
@@ -652,13 +657,13 @@ main(int argc, char** argv)
...
@@ -652,13 +657,13 @@ main(int argc, char** argv)
printf
(
"pid: %d press enter to continue
\n
"
,
getpid
());
printf
(
"pid: %d press enter to continue
\n
"
,
getpid
());
fgets
(
buf
,
sizeof
(
buf
),
stdin
);
fgets
(
buf
,
sizeof
(
buf
),
stdin
);
Vector
<
Chunk
>
chunks
;
Vector
<
Chunk
>
chunks
;
const
Uint32
LOOPS
=
100000000
;
time_t
stop
=
time
(
0
)
+
run_time
;
for
(
Uint32
i
=
0
;
i
<
LOOPS
;
i
++
){
for
(
Uint32
i
=
0
;
time
(
0
)
<
stop
;
i
++
){
//mem.dump();
//mem.dump();
// Case
// Case
Uint32
c
=
(
rand
()
%
100
);
Uint32
c
=
(
rand
()
%
100
);
if
(
c
<
6
0
)
if
(
c
<
5
0
)
{
{
c
=
0
;
c
=
0
;
}
}
...
@@ -694,7 +699,7 @@ main(int argc, char** argv)
...
@@ -694,7 +699,7 @@ main(int argc, char** argv)
}
}
break
;
break
;
case
2
:
{
// Seize(n) - fail
case
2
:
{
// Seize(n) - fail
alloc
+=
32000
;
alloc
+=
sz
;
// Fall through
// Fall through
}
}
case
1
:
{
// Seize(n) (success)
case
1
:
{
// Seize(n) (success)
...
@@ -750,6 +755,8 @@ main(int argc, char** argv)
...
@@ -750,6 +755,8 @@ main(int argc, char** argv)
};
};
for
(
Uint32
i
=
0
;
i
<
4
;
i
++
)
for
(
Uint32
i
=
0
;
i
<
4
;
i
++
)
timer
[
i
].
print
(
title
[
i
]);
timer
[
i
].
print
(
title
[
i
]);
mem
.
dump
();
}
}
template
class
Vector
<
Chunk
>;
template
class
Vector
<
Chunk
>;
...
...
storage/ndb/src/kernel/vm/ndbd_malloc_impl.hpp
View file @
3e5ca03f
...
@@ -57,7 +57,6 @@ public:
...
@@ -57,7 +57,6 @@ public:
void
set_resource_limit
(
const
Resource_limit
&
rl
);
void
set_resource_limit
(
const
Resource_limit
&
rl
);
bool
init
(
bool
allow_alloc_less_than_requested
=
true
);
bool
init
(
bool
allow_alloc_less_than_requested
=
true
);
void
grow
(
Uint32
start
,
Uint32
cnt
);
void
*
get_memroot
()
const
{
return
(
void
*
)
m_base_page
;}
void
*
get_memroot
()
const
{
return
(
void
*
)
m_base_page
;}
void
alloc
(
Uint32
*
ret
,
Uint32
*
pages
,
Uint32
min_requested
);
void
alloc
(
Uint32
*
ret
,
Uint32
*
pages
,
Uint32
min_requested
);
...
@@ -68,6 +67,9 @@ public:
...
@@ -68,6 +67,9 @@ public:
void
*
alloc_page
(
Uint32
type
,
Uint32
*
i
);
void
*
alloc_page
(
Uint32
type
,
Uint32
*
i
);
void
release_page
(
Uint32
type
,
Uint32
i
,
void
*
p
);
void
release_page
(
Uint32
type
,
Uint32
i
,
void
*
p
);
void
*
alloc_pages
(
Uint32
type
,
Uint32
*
i
,
Uint32
*
cnt
,
Uint32
min
=
1
);
void
release_pages
(
Uint32
type
,
Uint32
i
,
void
*
p
,
Uint32
cnt
);
/**
/**
* Compute 2log of size
* Compute 2log of size
* @note size = 0 -> 0
* @note size = 0 -> 0
...
@@ -76,6 +78,8 @@ public:
...
@@ -76,6 +78,8 @@ public:
static
Uint32
log2
(
Uint32
size
);
static
Uint32
log2
(
Uint32
size
);
private:
private:
void
grow
(
Uint32
start
,
Uint32
cnt
);
#define XX_RL_COUNT 3
#define XX_RL_COUNT 3
/**
/**
* Return pointer to free page data on page
* Return pointer to free page data on page
...
...
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