From ce697c352036aa278aa66883102146a7d4d36307 Mon Sep 17 00:00:00 2001 From: Ivan Lanese Date: Fri, 4 Oct 2024 22:52:40 +0200 Subject: [PATCH 1/2] Dropped outdated information on trace format --- case-studies/info.txt | 44 ------------------------------------------- 1 file changed, 44 deletions(-) diff --git a/case-studies/info.txt b/case-studies/info.txt index 63d68d7..1d24690 100644 --- a/case-studies/info.txt +++ b/case-studies/info.txt @@ -7,47 +7,3 @@ Traces are in a dedicated directory including a file trace_result.log with general information and a number of files trace_NNN.log containing the trace of file NNN. -The file trace_result.log contains the following information: - -1) executed call - -call "module:function()" e.g. call "purchase:main()" - -2) pid assigned to main process - -main_pid NNN e.g. main_pid 63 - -3) result of the main process - -result VALUE e.g. result false - -Each file trace_NNN.log is a sequence of tuples with the following forms: - -1) spawn instructions - -{PID1,spawn,PID2} e.g. {63,spawn,70} - -Process with pid PID1 spawned process with pid PID2 - -2) send instructions - -{PID,send,MSGID} e.g. {70,send,2} - -Process with pid PID sent message with unique message identifier MSGID. - -NOTE: unique message identifiers do not exist in Erlang and are added -by our instrumentation. They allow one to link a send with the -corresponding receive and allow one to have more precise causal -information. - -3) receive instructions - -{PID,'receive',MSGID} e.g. {63,'receive',3} - -Process with pid PID received message with unique message identifier -MSGID. - -NOTE: unique message identifiers do not exist in Erlang and are added -by our instrumentation. They allow one to link a send with the -corresponding receive and allow one to have more precise causal -information. From 4bdf3bbff4e96b60d5a1dc6ba69d1d346d528981 Mon Sep 17 00:00:00 2001 From: Ivan Lanese Date: Fri, 4 Oct 2024 23:19:35 +0200 Subject: [PATCH 2/2] Added new case study --- case-studies/airlineMe/airline.erl | 45 +++++++++++++++++++ case-studies/airlineMe/info.txt | 3 ++ case-studies/airlineMe/info.txt~ | 5 +++ case-studies/airlineMe/trace/trace_0.log | 19 ++++++++ case-studies/airlineMe/trace/trace_1.log | 13 ++++++ case-studies/airlineMe/trace/trace_2.log | 13 ++++++ case-studies/airlineMe/trace/trace_3.log | 13 ++++++ case-studies/airlineMe/trace/trace_result.log | 8 ++++ 8 files changed, 119 insertions(+) create mode 100755 case-studies/airlineMe/airline.erl create mode 100644 case-studies/airlineMe/info.txt create mode 100644 case-studies/airlineMe/info.txt~ create mode 100644 case-studies/airlineMe/trace/trace_0.log create mode 100644 case-studies/airlineMe/trace/trace_1.log create mode 100644 case-studies/airlineMe/trace/trace_2.log create mode 100644 case-studies/airlineMe/trace/trace_3.log create mode 100644 case-studies/airlineMe/trace/trace_result.log diff --git a/case-studies/airlineMe/airline.erl b/case-studies/airlineMe/airline.erl new file mode 100755 index 0000000..af20867 --- /dev/null +++ b/case-studies/airlineMe/airline.erl @@ -0,0 +1,45 @@ +-module(airline). +-export([main/0, agent/3, meManager/0]). + +main() -> + Main = self(), + MePid = spawn(?MODULE, meManager, []), + spawn(?MODULE, agent, [1, Main, MePid]), + spawn(?MODULE, agent, [2, Main, MePid]), + seats(3). + +seats(Num) -> + receive + {numOfSeats, Pid} -> + Pid ! {seats, Num}, + seats(Num); + {sell, Pid} -> + io:format("Seat ~p sold!~n",[Num]), + Pid ! {booked, Num}, + seats(Num - 1) + end. + +agent(NAg, Pid, MePid) -> + MePid ! {requestMe, self()}, + receive + grantMe -> Pid ! {numOfSeats, self()}, + receive + {seats, Num} when Num > 0 -> + Pid ! {sell, self()}, + MePid ! {releaseMe}, + receive + {booked, _} -> agent(NAg, Pid, MePid) + end; + _ -> + MePid ! {releaseMe}, + io:format("Agent~p done!~n", [NAg]) + end + end. + +meManager() -> + receive + {requestMe, Pid} -> Pid ! grantMe + end, + receive + {releaseMe} -> meManager() + end. diff --git a/case-studies/airlineMe/info.txt b/case-studies/airlineMe/info.txt new file mode 100644 index 0000000..82406f2 --- /dev/null +++ b/case-studies/airlineMe/info.txt @@ -0,0 +1,3 @@ +Example combining airline and meViolation case study. + + diff --git a/case-studies/airlineMe/info.txt~ b/case-studies/airlineMe/info.txt~ new file mode 100644 index 0000000..dfb59a4 --- /dev/null +++ b/case-studies/airlineMe/info.txt~ @@ -0,0 +1,5 @@ +Example described in the chapter on debugging in the final book of +COST Action 1405, which is to appear. +A copy of the chapter is available in this directory. + + diff --git a/case-studies/airlineMe/trace/trace_0.log b/case-studies/airlineMe/trace/trace_0.log new file mode 100644 index 0000000..8197427 --- /dev/null +++ b/case-studies/airlineMe/trace/trace_0.log @@ -0,0 +1,19 @@ +{trace_spawn,nonode@nohost,1,true}. +{trace_spawn,nonode@nohost,2,true}. +{trace_spawn,nonode@nohost,3,true}. +{trace_receive,3}. +{trace_send,4}. +{trace_receive,5}. +{trace_send,7}. +{trace_receive,9}. +{trace_send,11}. +{trace_receive,12}. +{trace_send,14}. +{trace_receive,16}. +{trace_send,17}. +{trace_receive,22}. +{trace_send,23}. +{trace_receive,19}. +{trace_send,24}. +{trace_receive,25}. +{trace_send,27}. diff --git a/case-studies/airlineMe/trace/trace_1.log b/case-studies/airlineMe/trace/trace_1.log new file mode 100644 index 0000000..b58f0b3 --- /dev/null +++ b/case-studies/airlineMe/trace/trace_1.log @@ -0,0 +1,13 @@ +{trace_receive,0}. +{trace_send,1}. +{trace_receive,6}. +{trace_receive,2}. +{trace_send,8}. +{trace_receive,13}. +{trace_receive,10}. +{trace_send,15}. +{trace_receive,20}. +{trace_receive,18}. +{trace_send,21}. + + diff --git a/case-studies/airlineMe/trace/trace_2.log b/case-studies/airlineMe/trace/trace_2.log new file mode 100644 index 0000000..254f4b8 --- /dev/null +++ b/case-studies/airlineMe/trace/trace_2.log @@ -0,0 +1,13 @@ +{trace_send,0}. +{trace_receive,1}. +{trace_send,3}. +{trace_receive,4}. +{trace_send,5}. +{trace_send,6}. +{trace_receive,7}. +{trace_send,10}. +{trace_receive,15}. +{trace_send,16}. +{trace_receive,17}. +{trace_send,19}. +{trace_send,20}. \ No newline at end of file diff --git a/case-studies/airlineMe/trace/trace_3.log b/case-studies/airlineMe/trace/trace_3.log new file mode 100644 index 0000000..6738b9c --- /dev/null +++ b/case-studies/airlineMe/trace/trace_3.log @@ -0,0 +1,13 @@ +{trace_send,2}. +{trace_receive,8}. +{trace_send,9}. +{trace_receive,11}. +{trace_send,12}. +{trace_send,13}. +{trace_receive,14}. +{trace_send,18}. +{trace_receive,21}. +{trace_send,22}. +{trace_receive,23}. +{trace_send,25}. +{trace_send,26}. \ No newline at end of file diff --git a/case-studies/airlineMe/trace/trace_result.log b/case-studies/airlineMe/trace/trace_result.log new file mode 100644 index 0000000..f4c1105 --- /dev/null +++ b/case-studies/airlineMe/trace/trace_result.log @@ -0,0 +1,8 @@ +{call,{airline,main,[]}}. +{comp,1281000}. +{exec,10000000}. +{node,nonode@nohost}. +{pid,0}. +{return,none}. +{tracing,timeout}. +