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
2ee9b056
Commit
2ee9b056
authored
Jan 21, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
benchmark update
parent
ba07120a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
21 deletions
+20
-21
benchmarks/mk_theron.sh
benchmarks/mk_theron.sh
+2
-3
benchmarks/theron_actor_creation.cpp
benchmarks/theron_actor_creation.cpp
+11
-15
benchmarks/theron_mailbox_performance.cpp
benchmarks/theron_mailbox_performance.cpp
+1
-1
benchmarks/utility.hpp
benchmarks/utility.hpp
+6
-2
No files found.
benchmarks/mk_theron.sh
View file @
2ee9b056
#!/bin/bash
#!/bin/bash
IFLAGS
=
"-I../../Theron/Include/"
IFLAGS
=
"-I../../Theron/Include/"
LFLAGS
=
"-L../../Theron/Lib -ltheron -lboost_thread"
LFLAGS
=
"-L../../Theron/Lib -ltheron -lboost_thread"
FLAGS
=
"-O2 -fno-strict-aliasing -DNDEBUG"
FLAGS
=
"-O2 -fno-strict-aliasing -DNDEBUG
-DTHERON_MAX_ACTORS=530000
"
for
i
in
theron_
*
.cpp
;
do
for
i
in
theron_
*
.cpp
;
do
echo
"compile
$i
"
out_file
=
$(
echo
$i
|
sed
's/\(.*\)\..*/\1/'
)
out_file
=
$(
echo
$i
|
sed
's/\(.*\)\..*/\1/'
)
echo
"
out_file =
$out_file
"
echo
"
g++ -std=c++0x
$i
-o
$out_file
$FLAGS
$LFLAGS
$IFLAGS
"
g++
-std
=
c++0x
$i
-o
$out_file
$FLAGS
$LFLAGS
$IFLAGS
g++
-std
=
c++0x
$i
-o
$out_file
$FLAGS
$LFLAGS
$IFLAGS
done
done
benchmarks/theron_actor_creation.cpp
View file @
2ee9b056
...
@@ -15,18 +15,13 @@ using std::endl;
...
@@ -15,18 +15,13 @@ using std::endl;
using
std
::
int64_t
;
using
std
::
int64_t
;
using
std
::
uint32_t
;
using
std
::
uint32_t
;
using
namespace
Theron
;
struct
spread
{
int
value
;
};
struct
spread
{
int
value
;
};
struct
result
{
uint32_t
value
;
};
struct
result
{
uint32_t
value
;
};
THERON_REGISTER_MESSAGE
(
spread
);
using
namespace
Theron
;
THERON_REGISTER_MESSAGE
(
result
);
template
<
typename
RefType
>
struct
testee_base
:
Actor
;
struct
testee
:
testee_base
<
RefType
>
struct
testee
:
Actor
{
{
typedef
struct
{
Address
arg0
;
}
Parameters
;
typedef
struct
{
Address
arg0
;
}
Parameters
;
...
@@ -34,7 +29,7 @@ struct testee : testee_base<RefType>
...
@@ -34,7 +29,7 @@ struct testee : testee_base<RefType>
Address
m_parent
;
Address
m_parent
;
bool
m_first_result_received
;
bool
m_first_result_received
;
uint32_t
m_first_result
;
uint32_t
m_first_result
;
std
::
vector
<
RefType
>
m_children
;
std
::
vector
<
ActorRef
>
m_children
;
void
spread_handler
(
spread
const
&
arg
,
const
Address
)
void
spread_handler
(
spread
const
&
arg
,
const
Address
)
{
{
...
@@ -48,7 +43,7 @@ struct testee : testee_base<RefType>
...
@@ -48,7 +43,7 @@ struct testee : testee_base<RefType>
Parameters
params
=
{
GetAddress
()};
Parameters
params
=
{
GetAddress
()};
for
(
int
i
=
0
;
i
<
2
;
++
i
)
for
(
int
i
=
0
;
i
<
2
;
++
i
)
{
{
m_children
.
push_back
(
GetFramework
().
CreateActor
<
testee
<
RefType
>
>
(
params
));
m_children
.
push_back
(
GetFramework
().
CreateActor
<
testee
>
(
params
));
m_children
.
back
().
Push
(
msg
,
GetAddress
());
m_children
.
back
().
Push
(
msg
,
GetAddress
());
}
}
}
}
...
@@ -63,15 +58,15 @@ struct testee : testee_base<RefType>
...
@@ -63,15 +58,15 @@ struct testee : testee_base<RefType>
}
}
else
else
{
{
Send
(
result
{
m_first_result
+
arg
.
value
});
Send
(
result
{
m_first_result
+
arg
.
value
}
,
m_parent
);
m_children
.
clear
();
m_children
.
clear
();
}
}
}
}
send_
testee
(
Parameters
const
&
p
)
:
m_parent
(
p
.
arg0
),
m_first_result_received
(
false
)
testee
(
Parameters
const
&
p
)
:
m_parent
(
p
.
arg0
),
m_first_result_received
(
false
)
{
{
RegisterHandler
(
this
,
&
send_
testee
::
spread_handler
);
RegisterHandler
(
this
,
&
testee
::
spread_handler
);
RegisterHandler
(
this
,
&
send_
testee
::
result_handler
);
RegisterHandler
(
this
,
&
testee
::
result_handler
);
}
}
}
;
}
;
...
@@ -92,8 +87,9 @@ int main(int argc, char** argv)
...
@@ -92,8 +87,9 @@ int main(int argc, char** argv)
}
}
int
num
=
rd
<
int
>
(
argv
[
2
]);
int
num
=
rd
<
int
>
(
argv
[
2
]);
Receiver
r
;
Receiver
r
;
Framework
framework
;
Framework
framework
(
num_cores
())
;
ActorRef
aref
(
framework
.
CreateActor
<
testee
>
(
teste
::
Parameters
{
r
.
GetAddress
()}));
ActorRef
aref
(
framework
.
CreateActor
<
testee
>
(
teste
e
::
Parameters
{
r
.
GetAddress
()}));
aref
.
Push
(
spread
{
num
},
r
.
GetAddress
());
aref
.
Push
(
spread
{
num
},
r
.
GetAddress
());
r
.
Wait
();
r
.
Wait
();
}
}
benchmarks/theron_mailbox_performance.cpp
View file @
2ee9b056
...
@@ -70,7 +70,7 @@ int main(int argc, char** argv)
...
@@ -70,7 +70,7 @@ int main(int argc, char** argv)
Receiver
r
;
Receiver
r
;
t_max
=
num_sender
*
num_msgs
;
t_max
=
num_sender
*
num_msgs
;
auto
receiverAddr
=
r
.
GetAddress
();
auto
receiverAddr
=
r
.
GetAddress
();
Framework
framework
;
Framework
framework
(
num_cores
())
;
ActorRef
aref
(
framework
.
CreateActor
<
receiver
>
());
ActorRef
aref
(
framework
.
CreateActor
<
receiver
>
());
std
::
list
<
std
::
thread
>
threads
;
std
::
list
<
std
::
thread
>
threads
;
auto
impl_fun
=
(
impl
==
push_impl
)
?
send_sender
:
push_sender
;
auto
impl_fun
=
(
impl
==
push_impl
)
?
send_sender
:
push_sender
;
...
...
benchmarks/utility.hpp
View file @
2ee9b056
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#define UTILITY_HPP
#define UTILITY_HPP
#include <stdexcept>
#include <stdexcept>
#include <algorithm>
template
<
typename
T
>
template
<
typename
T
>
T
rd
(
char
const
*
cstr
)
T
rd
(
char
const
*
cstr
)
...
@@ -52,12 +53,15 @@ T rd(char const* cstr)
...
@@ -52,12 +53,15 @@ T rd(char const* cstr)
int
num_cores
()
int
num_cores
()
{
{
char
cbuf
[
100
];
char
cbuf
[
100
];
FILE
*
cmd
=
popen
(
"
cat /proc/cpuinfo | grep processor |
wc -l"
,
"r"
);
FILE
*
cmd
=
popen
(
"
/bin/cat /proc/cpuinfo | /bin/grep processor | /usr/bin/
wc -l"
,
"r"
);
if
(
fgets
(
cbuf
,
100
,
get_uuid_cmd
)
!
=
0
)
if
(
fgets
(
cbuf
,
100
,
cmd
)
=
=
0
)
{
{
throw
std
::
runtime_error
(
"cannot determine number of cores"
);
throw
std
::
runtime_error
(
"cannot determine number of cores"
);
}
}
pclose
(
cmd
);
pclose
(
cmd
);
// erase trailing newline
auto
i
=
std
::
find
(
cbuf
,
cbuf
+
100
,
'\n'
);
*
i
=
'\0'
;
return
rd
<
int
>
(
cbuf
);
return
rd
<
int
>
(
cbuf
);
}
}
...
...
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