This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eshell V5.7.4 (abort with ^G) | |
1> c(e26). | |
{ok,e26} | |
2> e26:ringBenchmark(4, "Hello", 5). | |
Spawned with NextNode [] | |
Spawned with NextNode <0.39.0> | |
Spawned with NextNode <0.40.0> | |
Spawned with NextNode <0.41.0> | |
Spawned with NextNode <0.42.0> | |
Message '"Hello"' with NumberOfHops 20 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module (e26). | |
-compile (export_all). | |
ringBenchmark(NumberOfNodes, Message, NumberOfLaps) -> | |
statistics(runtime), | |
statistics(wall_clock), | |
FirstNode = spawn(?MODULE, loop, [[]]), | |
LastNode = createNode(1, NumberOfNodes, FirstNode), | |
FirstNode ! LastNode, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eshell V5.7.4 (abort with ^G) | |
1> c(e25). | |
{ok,e25} | |
2> e25:ringBenchmark(4, "Hello", 5). | |
Sent 20 messages in time=0 (0) milliseconds | |
Spawned with NextNode [] | |
Spawned with NextNode <0.39.0> | |
Spawned with NextNode <0.40.0> | |
Spawned with NextNode <0.41.0> | |
Spawned with NextNode <0.42.0> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module (e25). | |
-compile (export_all). | |
ringBenchmark(NumberOfNodes, Message, NumberOfLaps) -> | |
statistics(runtime), | |
statistics(wall_clock), | |
FirstNode = spawn(?MODULE, loop, [[]]), | |
LastNode = createNode(1, NumberOfNodes, FirstNode), | |
FirstNode ! LastNode, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loop(NextNode) -> | |
io:format("Spawned with NextNode ~p~n", [NextNode]), | |
receive | |
{_From, Message, NumberOfHops} -> | |
io:format("Message '~p' with NumberOfHops ~p~n", [Message, NumberOfHops]), | |
sendMessage(Message, NextNode, NumberOfHops - 1), | |
loop(NextNode); | |
NewNext when NextNode =:= [] -> | |
loop(NewNext) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sendMessage(_Message, _ToNode, 0) -> void; | |
sendMessage(Message, ToNode, NumberOfHops) -> | |
ToNode ! {self(), Message, NumberOfHops}. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Eshell V5.7.4 (abort with ^G) | |
1> c(e24). | |
{ok,e24} | |
2> e24:ringBenchmark(4, "Hello", 5). | |
Sent 20 messages in time=0 (0) milliseconds | |
Spawned with NextNode [] | |
Spawned with NextNode <0.39.0> | |
Spawned with NextNode <0.40.0> | |
Spawned with NextNode <0.41.0> | |
Spawned with NextNode <0.42.0> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NewNext when NextNode =:= [] -> | |
loop(NewNext) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loop(NextNode) -> | |
io:format("Spawned with NextNode ~p~n", [NextNode]), | |
receive | |
NewNext when NextNode =:= [] -> | |
loop(NewNext) | |
end. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FirstNode ! LastNode, |