Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
1c1b11a6
Commit
1c1b11a6
authored
Apr 10, 2011
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
benchmarking stuff
parent
ca075dbb
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
128 additions
and
34 deletions
+128
-34
.gitignore
.gitignore
+2
-0
cppa.creator.user
cppa.creator.user
+3
-3
cppa.files
cppa.files
+2
-0
gnuplot_file
gnuplot_file
+34
-11
queue_benchmark.sh
queue_benchmark.sh
+49
-16
queue_performances/main.cpp
queue_performances/main.cpp
+38
-4
No files found.
.gitignore
View file @
1c1b11a6
...
@@ -5,3 +5,5 @@ test
...
@@ -5,3 +5,5 @@ test
*.png
*.png
*.dat
*.dat
queue_test
queue_test
8threads
4threads
cppa.creator.user
View file @
1c1b11a6
...
@@ -60,14 +60,14 @@
...
@@ -60,14 +60,14 @@
<valuemap
type=
"QVariantMap"
>
<valuemap
type=
"QVariantMap"
>
<value
key=
"ProjectExplorer.BuildConfiguration.DisplayName"
type=
"QString"
>
all
</value>
<value
key=
"ProjectExplorer.BuildConfiguration.DisplayName"
type=
"QString"
>
all
</value>
<valuelist
key=
"abstractProcess.Environment"
type=
"QVariantList"
>
<valuelist
key=
"abstractProcess.Environment"
type=
"QVariantList"
>
<value
type=
"QString"
>
Apple_PubSub_Socket_Render=/tmp/launch-
acy9jv
/Render
</value>
<value
type=
"QString"
>
Apple_PubSub_Socket_Render=/tmp/launch-
tO8Wwx
/Render
</value>
<value
type=
"QString"
>
COMMAND_MODE=unix2003
</value>
<value
type=
"QString"
>
COMMAND_MODE=unix2003
</value>
<value
type=
"QString"
>
DISPLAY=/tmp/launch-
Dz1e1O
/org.x:0
</value>
<value
type=
"QString"
>
DISPLAY=/tmp/launch-
w1qNYf
/org.x:0
</value>
<value
type=
"QString"
>
HOME=/Users/neverlord
</value>
<value
type=
"QString"
>
HOME=/Users/neverlord
</value>
<value
type=
"QString"
>
LOGNAME=neverlord
</value>
<value
type=
"QString"
>
LOGNAME=neverlord
</value>
<value
type=
"QString"
>
PATH=/usr/bin:/bin:/usr/sbin:/sbin
</value>
<value
type=
"QString"
>
PATH=/usr/bin:/bin:/usr/sbin:/sbin
</value>
<value
type=
"QString"
>
SHELL=/bin/bash
</value>
<value
type=
"QString"
>
SHELL=/bin/bash
</value>
<value
type=
"QString"
>
SSH_AUTH_SOCK=/tmp/launch-
AouAZz
/Listeners
</value>
<value
type=
"QString"
>
SSH_AUTH_SOCK=/tmp/launch-
dnUZas
/Listeners
</value>
<value
type=
"QString"
>
TMPDIR=/var/folders/SE/SEReyCW0H-yDPCnNCe8mN++++TI/-Tmp-/
</value>
<value
type=
"QString"
>
TMPDIR=/var/folders/SE/SEReyCW0H-yDPCnNCe8mN++++TI/-Tmp-/
</value>
<value
type=
"QString"
>
USER=neverlord
</value>
<value
type=
"QString"
>
USER=neverlord
</value>
<value
type=
"QString"
>
__CF_USER_TEXT_ENCODING=0x1F5:0:3
</value>
<value
type=
"QString"
>
__CF_USER_TEXT_ENCODING=0x1F5:0:3
</value>
...
...
cppa.files
View file @
1c1b11a6
...
@@ -105,3 +105,5 @@ queue_performances/cached_stack.hpp
...
@@ -105,3 +105,5 @@ queue_performances/cached_stack.hpp
queue_performances/blocking_cached_stack.hpp
queue_performances/blocking_cached_stack.hpp
queue_performances/blocking_cached_stack2.hpp
queue_performances/blocking_cached_stack2.hpp
queue_performances/blocking_sutter_list.hpp
queue_performances/blocking_sutter_list.hpp
queue_performances/lockfree_list.hpp
queue_performances/intrusive_sutter_list.hpp
gnuplot_file
View file @
1c1b11a6
set terminal png
# Undefined variables: TITLE, FILE
set output "graph.png"
#
# example:
# gnuplot -e "FILE='graph.png';TITLE='foobaz'" gnuplot_file
#set font "Arial"
#set terminal png
set terminal png font "Andale Mono"
#set output "graph.png"
set output FILE
unset log
unset log
unset label
unset label
set xtic auto
#set xtic auto
set xtic 10
set ytic auto
set ytic auto
set xlabel "# messages (in 1,000,000)"
set xlabel "# messages (in 1,000,000)"
set ylabel "time (s)"
set ylabel "time (
in second
s)"
set format y "%8.2f"
set format y "%8.2f"
set xrange [1:110]
set yrange [0:120]
set grid
#set title "2.66 GHz i7 (dual core) with 8 producer threads"
set title TITLE
# "blocking_sutter_list.dat" using 1:2:3 title 'blocking sutter_list' lt 5 with errorbars, \
# "blocking_sutter_list.dat" notitle lt 5 with lines, \
# "blocking_cached_stack.dat" using 1:2:3 title 'blocking cached_stack' lt 4 with errorbars, \
# "blocking_cached_stack.dat" notitle lt 4 with lines, \
# "sutter_list.dat" using 1:2:3 title 'sutter_list' lt 3 with errorbars, \
# "sutter_list.dat" notitle lt 3 with lines, \
plot \
plot \
"
blocking_sutter_list.dat" using 1:2:3 title 'blocking sutter_list' lt 5
with errorbars, \
"
intrusive_sutter_list.dat" using 1:2:3 title 'spinlock list' lt 4
with errorbars, \
"
blocking_sutter_list.dat" notitle lt 5
with lines, \
"
intrusive_sutter_list.dat" notitle lt 4
with lines, \
"
sutter_list.dat" using 1:2:3 title 'polling sutter_list' lt 3
with errorbars, \
"
lockfree_list.dat" using 1:2:3 title 'lockfree list' lt 1
with errorbars, \
"sutter_list.dat" notitle lt 3
with lines, \
"lockfree_list.dat" notitle lt 1
with lines, \
"blocking_cached_stack.dat" using 1:2:3 title 'blocking cached_stack' lt 4
with errorbars, \
"michael_scott_lockfree.dat" using 1:2:3 title 'michael & scott' lt 3
with errorbars, \
"
blocking_cached_stack.dat" notitle lt 4
with lines, \
"
michael_scott_lockfree.dat" notitle lt 3
with lines, \
"cached_stack.dat" using 1:2:3 title '
polling cached_
stack' lt 2 with errorbars, \
"cached_stack.dat" using 1:2:3 title '
cached
stack' lt 2 with errorbars, \
"cached_stack.dat" notitle lt 2 with lines
"cached_stack.dat" notitle lt 2 with lines
quit
quit
queue_benchmark.sh
View file @
1c1b11a6
#!/bin/bash
#!/bin/bash
for
list
in
cached_stack blocking_cached_stack sutter_list blocking_sutter_list
;
do
NUM_THREADS
=
8
echo
"benchmarking
$list
..."
XUNIT
=
1000000
rm
-f
"
$list
.dat"
for
i
in
1000000 2000000 3000000 4000000 5000000 6000000 7000000 8000000 9000000 10000000
;
do
# $1 = list name
_1
=
$(
./queue_test
$i
4
$list
"
\$
TIME"
)
# $2 = num messages
_2
=
$(
./queue_test
$i
4
$list
"
\$
TIME"
)
function
exec_queue_test
()
_3
=
$(
./queue_test
$i
4
$list
"
\$
TIME"
)
{
_4
=
$(
./queue_test
$i
4
$list
"
\$
TIME"
)
echo
"./queue_test
$2
$NUM_THREADS
$1
"
_5
=
$(
./queue_test
$i
4
$list
"
\$
TIME"
)
# run test five times
MID
=
$(
echo
"scale=50;(
$_1
+
$_2
+
$_3
+
$_4
+
$_5
)/5"
| bc
)
_1
=
$(
./queue_test
$2
$NUM_THREADS
$1
"
\$
TIME"
)
MAX
=
$(
echo
"define max (x, y) { if (x < y) return (y); return (x); }; max(max(max(max(
$_1
,
$_2
),
$_3
),
$_4
),
$_5
)"
| bc
)
_2
=
$(
./queue_test
$2
$NUM_THREADS
$1
"
\$
TIME"
)
MIN
=
$(
echo
"define min (x, y) { if (x < y) return (x); return (y); }; min(min(min(min(
$_1
,
$_2
),
$_3
),
$_4
),
$_5
)"
| bc
)
_3
=
$(
./queue_test
$2
$NUM_THREADS
$1
"
\$
TIME"
)
POS_ERR
=
$(
echo
"
$MAX
-
$MID
"
| bc
)
_4
=
$(
./queue_test
$2
$NUM_THREADS
$1
"
\$
TIME"
)
NEG_ERR
=
$(
echo
"
$MID
-
$MIN
"
| bc
)
_5
=
$(
./queue_test
$2
$NUM_THREADS
$1
"
\$
TIME"
)
echo
$[$i
/1000000]
$MID
$POS_ERR
$NEG_ERR
>>
"
$list
.dat"
# get average runtime
MID
=
$(
echo
"scale=50;(
$_1
+
$_2
+
$_3
+
$_4
+
$_5
)/5"
| bc
)
# get max. runtime
MAX
=
$(
echo
"define max (x, y) { if (x < y) return (y); return (x); }; max(max(max(max(
$_1
,
$_2
),
$_3
),
$_4
),
$_5
)"
| bc
)
# get min. runtime
MIN
=
$(
echo
"define min (x, y) { if (x < y) return (x); return (y); }; min(min(min(min(
$_1
,
$_2
),
$_3
),
$_4
),
$_5
)"
| bc
)
# error
ERR
=
$(
echo
"scale=50;
$MAX
-
$MIN
"
| bc
)
# X value for gnuplot
XVAL
=
$(
echo
"scale=4;
$2
/
$XUNIT
"
| bc
)
# print result to file
echo
"
$XVAL
$MID
$ERR
"
>>
"
$1
.dat"
}
# $1 = list name
# $2 = minimum num messages
# $3 = maximum num messages
# $4 = step
function
test_run
()
{
#rm -f "$list.dat"
i
=
$2
while
test
"
$i
"
-le
"
$3
"
;
do
exec_queue_test
$1
$i
XVAL
=
$(
echo
"scale=4;
$i
/
$XUNIT
"
| bc
)
i
=
$[$i
+
$4
]
done
done
}
#for list in intrusive_sutter_list cached_stack lockfree_list ; do
for
list
in
michael_scott_lockfree
;
do
echo
"benchmarking
$list
..."
rm
-f
"
$list
.dat"
test_run
$list
1000000 10000000 9000000
test_run
$list
20000000 110000000 10000000
done
done
echo
"done"
echo
"done"
gnuplot gnuplot_file
gnuplot
-e
"FILE='i7_
${
NUM_THREADS
}
threads.png';TITLE='2.66 GHz i7 (dual core) with
$NUM_THREADS
producer threads'"
gnuplot_file
queue_performances/main.cpp
View file @
1c1b11a6
...
@@ -10,7 +10,9 @@
...
@@ -10,7 +10,9 @@
#include "sutter_list.hpp"
#include "sutter_list.hpp"
#include "cached_stack.hpp"
#include "cached_stack.hpp"
#include "lockfree_list.hpp"
#include "blocking_sutter_list.hpp"
#include "blocking_sutter_list.hpp"
#include "intrusive_sutter_list.hpp"
#include "blocking_cached_stack.hpp"
#include "blocking_cached_stack.hpp"
#include "blocking_cached_stack2.hpp"
#include "blocking_cached_stack2.hpp"
...
@@ -39,12 +41,13 @@ template<typename Queue, typename Processor>
...
@@ -39,12 +41,13 @@ template<typename Queue, typename Processor>
void
consumer
(
Queue
&
q
,
Processor
&
p
,
size_t
num_messages
)
void
consumer
(
Queue
&
q
,
Processor
&
p
,
size_t
num_messages
)
{
{
// vector<bool> scales better (in memory) than bool[num_messages]
// vector<bool> scales better (in memory) than bool[num_messages]
std
::
vector
<
bool
>
received
(
num_messages
);
//
std::vector<bool> received(num_messages);
for
(
size_t
i
=
0
;
i
<
num_messages
;
++
i
)
received
[
i
]
=
false
;
//
for (size_t i = 0; i < num_messages; ++i) received[i] = false;
for
(
size_t
i
=
0
;
i
<
num_messages
;
++
i
)
for
(
size_t
i
=
0
;
i
<
num_messages
;
++
i
)
{
{
size_t
value
;
size_t
value
;
p
(
q
.
pop
(),
value
);
p
(
q
.
pop
(),
value
);
/*
if (value >= num_messages)
if (value >= num_messages)
{
{
throw std::runtime_error("value out of bounds");
throw std::runtime_error("value out of bounds");
...
@@ -56,6 +59,7 @@ void consumer(Queue& q, Processor& p, size_t num_messages)
...
@@ -56,6 +59,7 @@ void consumer(Queue& q, Processor& p, size_t num_messages)
throw std::runtime_error(oss.str());
throw std::runtime_error(oss.str());
}
}
received[value] = true;
received[value] = true;
*/
}
}
// done
// done
}
}
...
@@ -64,14 +68,15 @@ void usage()
...
@@ -64,14 +68,15 @@ void usage()
{
{
cout
<<
"usage:"
<<
endl
cout
<<
"usage:"
<<
endl
<<
"queue_test [messages] [producer threads] "
<<
"queue_test [messages] [producer threads] "
<<
"[list impl.] {format string}"
"[list impl.] {format string}"
<<
endl
<<
endl
<<
" available implementations:"
<<
endl
<<
" available implementations:"
<<
endl
<<
" - sutter_list"
<<
endl
<<
" - sutter_list"
<<
endl
<<
" - intrusive_sutter_list"
<<
endl
<<
" - blocking_sutter_list"
<<
endl
<<
" - blocking_sutter_list"
<<
endl
<<
" - cached_stack"
<<
endl
<<
" - cached_stack"
<<
endl
<<
" - blocking_cached_stack"
<<
endl
<<
" - blocking_cached_stack"
<<
endl
<<
" - blocking_cached_stack2"
<<
endl
<<
" - blocking_cached_stack2"
<<
endl
<<
" - lockfree_list"
<<
endl
<<
endl
<<
endl
<<
" possible format string variables: "
<<
endl
<<
" possible format string variables: "
<<
endl
<<
" - $MESSAGES"
<<
endl
<<
" - $MESSAGES"
<<
endl
...
@@ -158,6 +163,35 @@ int main(int argc, char** argv)
...
@@ -158,6 +163,35 @@ int main(int argc, char** argv)
}
}
);
);
}
}
else
if
(
list_name
==
"intrusive_sutter_list"
)
{
typedef
intrusive_sutter_list
<
size_t
>
isl
;
elapsed_time
=
run_test
<
isl
>
(
num_messages
,
num_producers
,
[]
(
size_t
value
)
->
isl
::
node
*
{
return
new
isl
::
node
(
value
);
},
[]
(
const
size_t
&
value
,
size_t
&
storage
)
{
storage
=
value
;
}
);
}
else
if
(
list_name
==
"lockfree_list"
)
{
typedef
lockfree_list
<
size_t
>
isl
;
elapsed_time
=
run_test
<
isl
>
(
num_messages
,
num_producers
,
[]
(
size_t
value
)
->
isl
::
node
*
{
return
new
isl
::
node
(
value
);
},
[]
(
const
size_t
&
value
,
size_t
&
storage
)
{
storage
=
value
;
}
);
}
else
if
(
list_name
==
"blocking_sutter_list"
)
else
if
(
list_name
==
"blocking_sutter_list"
)
{
{
elapsed_time
=
run_test
<
blocking_sutter_list
<
size_t
>>
(
elapsed_time
=
run_test
<
blocking_sutter_list
<
size_t
>>
(
...
...
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