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
508ab179
Commit
508ab179
authored
Jan 21, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
theron benchmark
parent
4ea8218c
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
81 additions
and
45 deletions
+81
-45
benchmarks/Matching.scala
benchmarks/Matching.scala
+6
-6
benchmarks/mk_theron.sh
benchmarks/mk_theron.sh
+7
-2
benchmarks/scala_test.sh
benchmarks/scala_test.sh
+2
-1
benchmarks/theron_mailbox_performance.cpp
benchmarks/theron_mailbox_performance.cpp
+64
-36
benchmarks/theron_test.sh
benchmarks/theron_test.sh
+2
-0
No files found.
benchmarks/Matching.scala
View file @
508ab179
...
...
@@ -23,12 +23,12 @@ object Matching {
var
msg5Matched
:
Long
=
0
;
var
msg6Matched
:
Long
=
0
;
val
partFun
:
PF
[
Any
,
Unit
]
=
{
case
Msg1
(
_
)
=>
msg1Matched
+=
1
case
Msg2
(
_
)
=>
msg2Matched
+=
1
case
Msg3
(
_
)
=>
msg3Matched
+=
1
case
Msg4
(
_
,
_
)
=>
msg4Matched
+=
1
case
Msg5
(
_
,
_
,
_
)
=>
msg5Matched
+=
1
case
Msg6
(
_
,
_
,
_
)
=>
msg6Matched
+=
1
case
Msg1
(
0
)
=>
msg1Matched
+=
1
case
Msg2
(
0.0
)
=>
msg2Matched
+=
1
case
Msg3
(
List
(
0
)
)
=>
msg3Matched
+=
1
case
Msg4
(
0
,
"0"
)
=>
msg4Matched
+=
1
case
Msg5
(
0
,
0
,
0
)
=>
msg5Matched
+=
1
case
Msg6
(
0
,
0.0
,
"0"
)
=>
msg6Matched
+=
1
}
val
m1
=
Msg1
(
0
)
val
m2
=
Msg2
(
0.0
)
...
...
benchmarks/mk_theron.sh
View file @
508ab179
#!/bin/bash
IFLAGS
=
"-I../../Theron/Include/"
LFLAGS
=
"-L../../Theron/Lib -ltheron -lboost_thread"
FLAGS
=
"-O2 -fno-strict-aliasing -DNDEBUG"
for
i
in
theron_
*
.cpp
;
do
echo
compile
$i
...
g++
-std
=
c++0x
-O3
$i
-I
../../Theron/Include/
-L
../../Theron/Lib
-ltheron
-lboost_thread
-o
$(
echo
$i
|
grep
-o
-P
"^[a-z_]+"
)
echo
"compile
$i
"
out_file
=
$(
echo
$i
|
sed
's/\(.*\)\..*/\1/'
)
echo
"out_file =
$out_file
"
g++
-std
=
c++0x
$i
-o
$out_file
$FLAGS
$LFLAGS
$IFLAGS
done
benchmarks/scala_test.sh
View file @
508ab179
#!/bin/bash
#export JAVA_OPTS="-Xmx1024"
echo
"scala -cp ../../akka-microkernel-1.2/lib/akka/akka-actor-1.2.jar
$@
"
| ./exec.sh
#echo "scala -cp /home/neverlord/akka-microkernel-1.2/lib/akka/akka-actor-1.2.jar $@" | ./exec.sh
echo
"/home/neverlord/scala/bin/scala -cp /home/neverlord/akka-microkernel-1.2/lib/akka/akka-actor-1.2.jar
$@
"
| ./exec.sh
benchmarks/theron_mailbox_performance.cpp
View file @
508ab179
...
...
@@ -3,75 +3,103 @@
#include <Theron/Framework.h>
#include <Theron/Actor.h>
#include <iostream>
#include <thread>
#include <cstdint>
#include <iostream>
#include <functional>
using
std
::
cerr
;
using
std
::
cout
;
using
std
::
endl
;
using
std
::
int64_t
;
using
namespace
Theron
;
int64_t
t_max
=
0
;
// A trivial actor that does nothing.
struct
receiver
:
Theron
::
Actor
struct
receiver
:
Actor
{
int64_t
m_max
;
int64_t
m_num
;
Theron
::
Address
m_waiter
;
typedef
struct
{
int64_t
arg1
;
Theron
::
Address
arg2
;
}
Parameters
;
void
handler
(
int64_t
const
&
,
Theron
::
Address
)
void
handler
(
int64_t
const
&
,
Address
from
)
{
if
(
++
m_num
==
m
_max
)
Send
(
m_max
,
m_waiter
);
if
(
++
m_num
==
t
_max
)
Send
(
t_max
,
from
);
}
//receiver(int64_t max,
Theron::
Address waiter) : m_max(max), m_num(0), m_waiter(waiter)
receiver
(
Parameters
const
&
p
)
:
m_max
(
p
.
arg1
),
m_num
(
0
),
m_waiter
(
p
.
arg2
)
//receiver(int64_t max, Address waiter) : m_max(max), m_num(0), m_waiter(waiter)
receiver
(
)
:
m_num
(
0
)
{
RegisterHandler
(
this
,
&
receiver
::
handler
);
}
};
void
send
er
(
Theron
::
ActorRef
ref
,
int64_t
num
)
void
send
_sender
(
Framework
&
f
,
ActorRef
ref
,
Address
waiter
,
int64_t
num
)
{
auto
addr
=
ref
.
GetAddress
();
int64_t
msg
;
for
(
int64_t
i
=
0
;
i
<
num
;
++
i
)
{
ref
.
Push
(
msg
,
ref
.
GetAddress
());
}
f
.
Send
(
msg
,
waiter
,
addr
);
//ref.Push(msg, ref.GetAddress());
}
void
push_sender
(
Framework
&
f
,
ActorRef
ref
,
Address
waiter
,
int64_t
num
)
{
int64_t
msg
;
for
(
int64_t
i
=
0
;
i
<
num
;
++
i
)
ref
.
Push
(
msg
,
waiter
);
}
template
<
typename
T
>
T
rd
(
char
const
*
cstr
)
{
char
*
endptr
=
nullptr
;
T
result
=
static_cast
<
T
>
(
strtol
(
cstr
,
&
endptr
,
10
));
if
(
endptr
==
nullptr
||
*
endptr
!=
'\0'
)
{
std
::
string
errstr
;
errstr
+=
"
\"
"
;
errstr
+=
cstr
;
errstr
+=
"
\"
is not an integer"
;
throw
std
::
invalid_argument
(
errstr
);
}
return
result
;
}
void
usage
()
{
cout
<<
"usage ('push'|'send') (num_threads) (num_messages)"
<<
endl
;
exit
(
1
);
}
int
main
(
int
argc
,
char
**
argv
)
{
if
(
argc
!=
3
)
if
(
argc
!=
4
)
{
cout
<<
"usage (num_threads) (num_messages)"
<<
endl
;
return
1
;
}
char
*
endptr
=
nullptr
;
int64_t
num_sender
=
static_cast
<
int64_t
>
(
strtol
(
argv
[
1
],
&
endptr
,
10
));
if
(
endptr
==
nullptr
||
*
endptr
!=
'\0'
)
{
cerr
<<
"
\"
"
<<
argv
[
1
]
<<
"
\"
is not an integer"
<<
endl
;
return
1
;
}
int64_t
num_msgs
=
static_cast
<
int64_t
>
(
strtol
(
argv
[
2
],
&
endptr
,
10
));
if
(
endptr
==
nullptr
||
*
endptr
!=
'\0'
)
{
cerr
<<
"
\"
"
<<
argv
[
2
]
<<
"
\"
is not an integer"
<<
endl
;
return
1
;
}
Theron
::
Receiver
r
;
Theron
::
Framework
framework
;
Theron
::
ActorRef
aref
(
framework
.
CreateActor
<
receiver
>
(
receiver
::
Parameters
{
num_sender
*
num_msgs
,
r
.
GetAddress
()}));
enum
{
invalid_impl
,
push_impl
,
send_impl
}
impl
=
invalid_impl
;
if
(
strcmp
(
argv
[
1
],
"push"
)
==
0
)
impl
=
push_impl
;
else
if
(
strcmp
(
argv
[
1
],
"send"
)
==
0
)
impl
=
send_impl
;
else
usage
();
auto
num_sender
=
rd
<
int64_t
>
(
argv
[
2
]);
auto
num_msgs
=
rd
<
int64_t
>
(
argv
[
3
]);
Receiver
r
;
t_max
=
num_sender
*
num_msgs
;
auto
receiverAddr
=
r
.
GetAddress
();
Framework
framework
;
ActorRef
aref
(
framework
.
CreateActor
<
receiver
>
());
std
::
list
<
std
::
thread
>
threads
;
auto
impl_fun
=
(
impl
==
push_impl
)
?
send_sender
:
push_sender
;
for
(
int64_t
i
=
0
;
i
<
num_sender
;
++
i
)
{
std
::
thread
(
sender
,
aref
,
num_msgs
).
detach
(
);
}
{
threads
.
push_back
(
std
::
thread
(
impl_fun
,
std
::
ref
(
framework
),
aref
,
receiverAddr
,
num_msgs
)
);
}
r
.
Wait
();
for
(
auto
&
t
:
threads
)
t
.
join
();
return
0
;
}
benchmarks/theron_test.sh
0 → 100755
View file @
508ab179
#!/bin/bash
echo
"./theron_
$@
"
| ./exec.sh
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