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
e6d6a30b
Commit
e6d6a30b
authored
May 01, 2012
by
neverlord
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bugfix
parent
a2ab17ed
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
7 deletions
+12
-7
benchmarks/distributed.erl
benchmarks/distributed.erl
+12
-7
No files found.
benchmarks/distributed.erl
View file @
e6d6a30b
...
@@ -9,7 +9,8 @@ ping_loop(Parent, Pong) ->
...
@@ -9,7 +9,8 @@ ping_loop(Parent, Pong) ->
ping_loop
(
Parent
,
Pong
);
ping_loop
(
Parent
,
Pong
);
{
kickoff
,
X
}
->
{
kickoff
,
X
}
->
Pong
!
{
ping
,
self
(),
X
},
Pong
!
{
ping
,
self
(),
X
},
ping_loop
(
Parent
,
Pong
)
ping_loop
(
Parent
,
Pong
);
_
->
ping_loop
(
Parent
,
Pong
)
end
.
end
.
server_loop
(
Pongs
)
->
server_loop
(
Pongs
)
->
...
@@ -41,7 +42,8 @@ server_loop(Pongs) ->
...
@@ -41,7 +42,8 @@ server_loop(Pongs) ->
server_loop
(
Pongs
);
server_loop
(
Pongs
);
{
kickoff
,
Pid
,
NumPings
}
->
{
kickoff
,
Pid
,
NumPings
}
->
lists
:
foreach
(
fun
({_,
P
})
->
spawn
(
distributed
,
ping_loop
,
[
Pid
,
P
])
!
{
kickoff
,
NumPings
}
end
,
Pongs
),
lists
:
foreach
(
fun
({_,
P
})
->
spawn
(
distributed
,
ping_loop
,
[
Pid
,
P
])
!
{
kickoff
,
NumPings
}
end
,
Pongs
),
server_loop
(
Pongs
)
server_loop
(
Pongs
);
_
->
server_loop
(
Pongs
)
end
.
end
.
server_mode
()
->
server_mode
()
->
...
@@ -58,12 +60,15 @@ add_pong_fun(Pong, Node, [H|T]) ->
...
@@ -58,12 +60,15 @@ add_pong_fun(Pong, Node, [H|T]) ->
after
10000
->
error
(
timeout
)
after
10000
->
error
(
timeout
)
end
.
end
.
client_mode_receive_done_msgs
(
0
)
->
true
;
client_mode_receive_done_msgs
(
Left
)
->
receive
done
->
client_mode_receive_done_msgs
(
Left
-
1
)
end
.
% receive a {done} message for each node
% receive a {done} message for each node
client_mode
([],
[],
[],
_)
->
true
;
client_mode
([],
[],
[],
_)
->
error
(
"no node, no fun"
);
client_mode
([],
[],
[_|
T
],
NumPings
)
->
client_mode
([],
[],
Nodes
,
_)
->
receive
done
->
client_mode_receive_done_msgs
(
length
(
Nodes
)
*
(
length
(
Nodes
)
-
1
));
client_mode
([],
[],
T
,
NumPings
)
end
;
% send kickoff messages
% send kickoff messages
client_mode
([
Pong
|
Pongs
],
[],
Nodes
,
NumPings
)
->
client_mode
([
Pong
|
Pongs
],
[],
Nodes
,
NumPings
)
->
...
...
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