This file contains 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
%%% @doc Calling start() on the socket problem will create a socket client | |
%%% which will create 100 connections to an echo server (in separate file) and | |
%%% load them in an uneven random manner. | |
%%% Find the most busy one. | |
-module(socket_problem). | |
%% API | |
-export([start/0]). | |
-define(CONNECT_PORT, 11111). |
This file contains 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
%%% @doc Calling start() will create an echo socket server which will do nothing | |
%%% but echo the incoming data till it disconnects. | |
%%% See socket_problem.erl for the problem description. | |
-module(socket_problem_server). | |
-export([start/0, server/1, handle_messages/1]). | |
-define(LISTEN_PORT, 11111). | |
start() -> |
This file contains 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
%%%------------------------------------------------------------------- | |
%%% @copyright (C) 2020, Erlang Solutions Ltd. | |
%%% @doc Create a long running process which consumes CPU periodically | |
%%% @end | |
%%%------------------------------------------------------------------- | |
-module(problem_cpu). | |
%% API | |
-export([start/0]). |
This file contains 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
defmodule BeamWorkshop do | |
def start() do | |
spawn(&process_loop/0) | |
end | |
def process_loop() do | |
big_data = | |
for _ <- 1..1024 do | |
big_data(1_048_576) | |
end |
This file contains 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
%%%------------------------------------------------------------------- | |
%%% @copyright (C) 2020, Erlang Solutions Ltd. | |
%%% @doc Create a long running process which consumes 1 GB of memory | |
%%% @end | |
%%%------------------------------------------------------------------- | |
-module(problem_mem). | |
%% API | |
-export([start/0]). |
This file contains 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
int a; | |
abstract class PMItem { public bool Match(value) {return false;} } | |
class PMVar: extends PMItem { public Integer p; public bool Match() { // assign value to p; return true } } | |
class PM_: extends PMItem { public bool Match(_) { return true;}} | |
class Obj { | |
public int a; | |
public String x; | |
public int zero; | |
publie float zerof; | |
} |
This file contains 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(otp13722). | |
-export([go/0]). | |
-compile(export_all). | |
flush() -> | |
receive X -> io:format("received: ~p~n", [X]), flush() | |
after 1000 -> ok | |
end. | |
tr_apply(M, F, Args) -> |
This file contains 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(fptr). | |
-export([main1/0, main2/0, main3/1, callable/1]). | |
main1() -> | |
fun() -> fptr:callable(111) end. | |
main2() -> | |
fun() -> erlang:apply(fptr, callable, [111]) end. | |
main3(M) -> | |
fun() -> erlang:apply(M, callable, [111]) end. |
This file contains 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(otp13722). | |
-export([main/1]). | |
flush() -> | |
receive X -> io:format("received: ~p~n", [X]), flush() | |
after 1000 -> ok | |
end. | |
tr1(M, F, Args) -> | |
dbg:tracer(), |
NewerOlder