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
7ce2ee9d
Commit
7ce2ee9d
authored
Aug 23, 2012
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'unstable' of github.com:Neverlord/libcppa into unstable
parents
55802684
0d225bcd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
34 deletions
+32
-34
benchmarks/scala/Distributed.scala
benchmarks/scala/Distributed.scala
+32
-34
No files found.
benchmarks/scala/Distributed.scala
View file @
7ce2ee9d
...
@@ -313,10 +313,7 @@ class AkkaClientActor(system: ActorSystem) extends AkkaActor {
...
@@ -313,10 +313,7 @@ class AkkaClientActor(system: ActorSystem) extends AkkaActor {
}
}
}
}
object
DistributedClientApp
{
object
Distributed
{
val
NumPings
=
"num_pings=([0-9]+)"
.
r
val
SimpleUri
=
"([0-9a-zA-Z\\.]+):([0-9]+)"
.
r
@tailrec
def
run
(
args
:
List
[
String
],
paths
:
List
[
String
],
numPings
:
Option
[
Int
],
finalizer
:
(
List
[
String
],
Int
)
=>
Unit
)
:
Unit
=
args
match
{
@tailrec
def
run
(
args
:
List
[
String
],
paths
:
List
[
String
],
numPings
:
Option
[
Int
],
finalizer
:
(
List
[
String
],
Int
)
=>
Unit
)
:
Unit
=
args
match
{
case
NumPings
(
num
)
::
tail
=>
numPings
match
{
case
NumPings
(
num
)
::
tail
=>
numPings
match
{
...
@@ -333,42 +330,43 @@ object DistributedClientApp {
...
@@ -333,42 +330,43 @@ object DistributedClientApp {
}
}
}
}
def
main
(
args
:
Array
[
String
])
:
Unit
=
{
try
{
args
(
0
)
match
{
case
"remote_actors"
=>
run
(
args
.
toList
.
drop
(
1
),
Nil
,
None
,
((
paths
,
x
)
=>
{
(
new
ClientActor
(
paths
map
(
path
=>
path
match
{
case
SimpleUri
(
host
,
port
)
=>
RemoteActorPath
(
path
,
host
,
port
.
toInt
)
}),
x
)).
start
}))
case
"akka"
=>
run
(
args
.
toList
.
drop
(
1
),
Nil
,
None
,
((
paths
,
x
)
=>
{
val
system
=
ActorSystem
(
"benchmark"
,
ConfigFactory
.
load
.
getConfig
(
"benchmark"
))
system
.
actorOf
(
Props
(
new
AkkaClientActor
(
system
)))
!
RunAkkaClient
(
paths
,
x
)
global
.
latch
.
await
system
.
shutdown
System
.
exit
(
0
)
}))
}
}
catch
{
case
e
=>
{
println
(
"usage: DistributedClientApp (remote_actors|akka) {nodes...} num_pings={num}\nexample: DistributedClientApp remote_actors localhost:1234 localhost:2468 num_pings=1000\n"
)
throw
e
}
}
}
}
object
DistributedServerApp
{
val
IntStr
=
"([0-9]+)"
.
r
val
IntStr
=
"([0-9]+)"
.
r
val
NumPings
=
"num_pings=([0-9]+)"
.
r
val
SimpleUri
=
"([0-9a-zA-Z\\.]+):([0-9]+)"
.
r
def
main
(
args
:
Array
[
String
])
:
Unit
=
args
match
{
def
main
(
args
:
Array
[
String
])
:
Unit
=
args
match
{
case
Array
(
"remote_actors"
,
IntStr
(
istr
))
=>
(
new
ServerActor
(
istr
.
toInt
)).
start
// server mode
case
Array
(
"akka"
)
=>
{
case
Array
(
"mode=server"
,
"remote_actors"
,
IntStr
(
istr
))
=>
(
new
ServerActor
(
istr
.
toInt
)).
start
case
Array
(
"mode=server"
,
"akka"
)
=>
{
val
system
=
ActorSystem
(
"pongServer"
,
ConfigFactory
.
load
.
getConfig
(
"pongServer"
))
val
system
=
ActorSystem
(
"pongServer"
,
ConfigFactory
.
load
.
getConfig
(
"pongServer"
))
val
pong
=
system
.
actorOf
(
Props
(
new
AkkaServerActor
(
system
)),
"pong"
)
val
pong
=
system
.
actorOf
(
Props
(
new
AkkaServerActor
(
system
)),
"pong"
)
Unit
Unit
}
}
case
_
=>
println
(
"usage: DistributedServerApp remote_actors PORT\n"
+
// client mode
" or: DistributedServerApp akka"
)
case
Array
(
"mode=benchmark"
,
"remote_actors"
,
_
*)
=>
{
run
(
args
.
toList
.
drop
(
2
),
Nil
,
None
,
((
paths
,
x
)
=>
{
(
new
ClientActor
(
paths
map
(
path
=>
path
match
{
case
SimpleUri
(
host
,
port
)
=>
RemoteActorPath
(
path
,
host
,
port
.
toInt
)
}),
x
)).
start
}))
}
case
Array
(
"mode=benchmark"
,
"akka"
,
_
*)
=>
{
run
(
args
.
toList
.
drop
(
2
),
Nil
,
None
,
((
paths
,
x
)
=>
{
val
system
=
ActorSystem
(
"benchmark"
,
ConfigFactory
.
load
.
getConfig
(
"benchmark"
))
system
.
actorOf
(
Props
(
new
AkkaClientActor
(
system
)))
!
RunAkkaClient
(
paths
,
x
)
global
.
latch
.
await
system
.
shutdown
System
.
exit
(
0
)
}))
}
// error
case
_
=>
{
println
(
"Running in server mode:\n"
+
" mode=server\n"
+
" remote_actors PORT *or* akka\n"
+
"\n"
+
"Running the benchmark:\n"
+
" mode=benchmark\n"
+
" remote_actors ... *or* akka\n"
);
}
}
}
}
}
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