Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Martin's suggestions
[simgrid.git] / examples / python / synchro-mutex / synchro-mutex.tesh
1 #!/usr/bin/env tesh
2
3 p Testing Mutex
4
5 $ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/synchro-mutex.py --platform ${platfdir}/two_hosts.xml --workers 0 "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
6 >[ 10.000000] (1:master@Tremblay) The final result is: 0
7
8 $ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/synchro-mutex.py --platform ${platfdir}/two_hosts.xml --workers 1 "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
9 >[  0.000000] (2:worker-0(mgr)@Jupiter) I just started
10 >[  0.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
11 >[  0.000000] (2:worker-0(mgr)@Jupiter) updated shared result, which is now 1
12 >[  0.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
13 >[  0.000000] (2:worker-0(mgr)@Jupiter) Bye now!
14 >[ 10.000000] (1:master@Tremblay) The final result is: 1
15
16 $ ${pythoncmd:=python3} ${PYTHON_TOOL_OPTIONS:=} ${bindir:=.}/synchro-mutex.py --platform ${platfdir}/two_hosts.xml --workers 5 "--log=root.fmt:[%10.6r]%e(%i:%a@%h)%e%m%n"
17 >[  0.000000] (2:worker-0(mgr)@Jupiter) I just started
18 >[  0.000000] (2:worker-0(mgr)@Jupiter) acquired the mutex with context manager
19 >[  0.000000] (2:worker-0(mgr)@Jupiter) updated shared result, which is now 1
20 >[  0.000000] (3:worker-1@Tremblay) I just started
21 >[  0.000000] (2:worker-0(mgr)@Jupiter) released the mutex after leaving the context manager
22 >[  0.000000] (2:worker-0(mgr)@Jupiter) Bye now!
23 >[  0.000000] (3:worker-1@Tremblay) acquired the mutex manually
24 >[  0.000000] (3:worker-1@Tremblay) updated shared result, which is now 2
25 >[  0.000000] (4:worker-2(mgr)@Jupiter) I just started
26 >[  0.000000] (3:worker-1@Tremblay) released the mutex manually
27 >[  0.000000] (3:worker-1@Tremblay) Bye now!
28 >[  0.000000] (4:worker-2(mgr)@Jupiter) acquired the mutex with context manager
29 >[  0.000000] (4:worker-2(mgr)@Jupiter) updated shared result, which is now 3
30 >[  0.000000] (5:worker-3@Tremblay) I just started
31 >[  0.000000] (4:worker-2(mgr)@Jupiter) released the mutex after leaving the context manager
32 >[  0.000000] (4:worker-2(mgr)@Jupiter) Bye now!
33 >[  0.000000] (5:worker-3@Tremblay) acquired the mutex manually
34 >[  0.000000] (5:worker-3@Tremblay) updated shared result, which is now 4
35 >[  0.000000] (6:worker-4(mgr)@Jupiter) I just started
36 >[  0.000000] (5:worker-3@Tremblay) released the mutex manually
37 >[  0.000000] (5:worker-3@Tremblay) Bye now!
38 >[  0.000000] (6:worker-4(mgr)@Jupiter) acquired the mutex with context manager
39 >[  0.000000] (6:worker-4(mgr)@Jupiter) updated shared result, which is now 5
40 >[  0.000000] (6:worker-4(mgr)@Jupiter) released the mutex after leaving the context manager
41 >[  0.000000] (6:worker-4(mgr)@Jupiter) Bye now!
42 >[ 10.000000] (1:master@Tremblay) The final result is: 5