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
18b79b0f
Commit
18b79b0f
authored
Aug 22, 2008
by
Rich Prohaska
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
print some pthread object sizes
git-svn-id:
file:///svn/tokudb@5800
c7de825b-a66e-492c-adef-691d508d4ae1
parent
d2744a29
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
0 deletions
+13
-0
newbrt/locking-benchmarks/pthread-locks.c
newbrt/locking-benchmarks/pthread-locks.c
+13
-0
No files found.
newbrt/locking-benchmarks/pthread-locks.c
View file @
18b79b0f
...
@@ -68,6 +68,12 @@ gcc_fetch_and_add_i (volatile int *p, int incr)
...
@@ -68,6 +68,12 @@ gcc_fetch_and_add_i (volatile int *p, int incr)
return
__sync_fetch_and_add
(
p
,
incr
);
return
__sync_fetch_and_add
(
p
,
incr
);
}
}
static
inline
long
gcc_fetch_and_add_l
(
volatile
long
*
p
,
long
incr
)
{
return
__sync_fetch_and_add
(
p
,
incr
);
}
// Something wrong with the compiler for longs
// Something wrong with the compiler for longs
/* Returns nonzero if the comparison succeeded. */
/* Returns nonzero if the comparison succeeded. */
static
inline
long
static
inline
long
...
@@ -123,6 +129,8 @@ int ivals[K];
...
@@ -123,6 +129,8 @@ int ivals[K];
})
})
int
main
(
int
argc
__attribute__
((
__unused__
)),
char
*
argv
[]
__attribute__
((
__unused__
)))
{
int
main
(
int
argc
__attribute__
((
__unused__
)),
char
*
argv
[]
__attribute__
((
__unused__
)))
{
printf
(
"sizeof (pthread_mutex_t) %lu
\n
"
,
sizeof
(
pthread_mutex_t
));
printf
(
"sizeof (pthread_cond_t) %lu
\n
"
,
sizeof
(
pthread_cond_t
));
TIME
(
"pthread_mutex_lock"
,
i
,
TIME
(
"pthread_mutex_lock"
,
i
,
({
int
r
=
pthread_mutex_init
(
&
mlocks
[
i
],
NULL
);
assert
(
r
==
0
);
}),
({
int
r
=
pthread_mutex_init
(
&
mlocks
[
i
],
NULL
);
assert
(
r
==
0
);
}),
({
int
r
=
pthread_mutex_lock
(
&
mlocks
[
i
]);
assert
(
r
==
0
);
}));
({
int
r
=
pthread_mutex_lock
(
&
mlocks
[
i
]);
assert
(
r
==
0
);
}));
...
@@ -151,6 +159,11 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un
...
@@ -151,6 +159,11 @@ int main (int argc __attribute__((__unused__)), char *argv[] __attribute__((__un
(
void
)
0
,
(
void
)
0
,
gcc_fetch_and_add_i
(
&
fa
,
i
));
gcc_fetch_and_add_i
(
&
fa
,
i
));
// printf("fa=%d\n", fa);
// printf("fa=%d\n", fa);
long
fal
=
0
;
TIME
(
"gcc_fetchaddlong"
,
i
,
(
void
)
0
,
gcc_fetch_and_add_l
(
&
fal
,
i
));
// printf("fa=%d\n", fa);
TIME
(
"compare_and_swap"
,
i
,
TIME
(
"compare_and_swap"
,
i
,
ivals
[
i
]
=
0
,
ivals
[
i
]
=
0
,
({
int
r
=
compare_and_swap_full_i
(
&
ivals
[
i
],
0
,
1
);
assert
(
r
==
1
);
}));
({
int
r
=
compare_and_swap_full_i
(
&
ivals
[
i
],
0
,
1
);
assert
(
r
==
1
);
}));
...
...
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