Skip to content

Instantly share code, notes, and snippets.

@frankmullerl
Last active January 2, 2020 16:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save frankmullerl/008174c6594ca27584ac7f4e6724bee5 to your computer and use it in GitHub Desktop.
Save frankmullerl/008174c6594ca27584ac7f4e6724bee5 to your computer and use it in GitHub Desktop.
LCNT output (macOS)
> erlang:system_info(system_version).
"Erlang/OTP 22 [erts-10.6] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:144] [hipe] [lock-counting] [dtrace]\n"
> erlang:statistics(reductions).
{165925199,165925199}
> length(erlang:processes()).
135
> lcnt:rt_opt({copy_save, true}),
> lcnt:clear(),
> timer:sleep(12000),
> lcnt:collect(),
> lcnt:conflicts().
lock id #tries #collisions collisions [%] time [us] duration [%]
----- --- ------- ------------ --------------- ---------- -------------
#Port<app@127.0.0.1.12155> 1 4 1 25.0000 6707846 54.6453
#Port<app@127.0.0.1.12294> 1 4 1 25.0000 6330800 51.5737
#Port<app@127.0.0.1.12361> 1 4 1 25.0000 6327830 51.5495
#Port<app@127.0.0.1.12331> 1 4 1 25.0000 6325407 51.5297
#Port<app@127.0.0.1.12453> 1 4 1 25.0000 1025033 8.3504
#Port<app@127.0.0.1.12463> 1 4 1 25.0000 784936 6.3945
#Port<app@127.0.0.1.12167> 1 4 1 25.0000 602049 4.9046
run_queue 14 403859 6666 1.6506 306278 2.4951
#Port<app@127.0.0.1.12476> 1 4 1 25.0000 239565 1.9516
#Port<app@127.0.0.1.12473> 1 4 1 25.0000 232629 1.8951
#Port<app@127.0.0.1.12263> 1 4 1 25.0000 194355 1.5833
#Port<app@127.0.0.1.12160> 1 4 1 25.0000 162898 1.3270
#Port<app@127.0.0.1.12169> 1 4 1 25.0000 160238 1.3054
#Port<app@127.0.0.1.12161> 1 4 1 25.0000 151371 1.2331
#Port<app@127.0.0.1.12467> 1 4 1 25.0000 117102 0.9540
#Port<app@127.0.0.1.12472> 1 4 1 25.0000 105302 0.8578
#Port<app@127.0.0.1.12474> 1 4 1 25.0000 101243 0.8248
#Port<app@127.0.0.1.10> 1 8482 252 2.9710 25822 0.2104
drv_ev_state 128 38584 437 1.1326 17032 0.1388
code_server 5 77800 851 1.0938 16674 0.1358
> lcnt:inspect(run_queue, [{locations, true}, {combine, true}]).
lock: run_queue
id: 14
type: mutex
location #tries #collisions collisions [%] time [us] duration [%] histogram [log2(us)]
--------- ------- ------------ --------------- ---------- ------------- ---------------------
'beam/erl_process.h':2500 403859 6666 1.6506 306278 2.4951 |X ......x.... |
undefined:0 0 0 0.0000 0 0.0000 | |
ERTS_GLB_INLINE void
erts_runq_lock(ErtsRunQueue *rq)
{
erts_mtx_lock(&rq->mtx); // <<-------------------- points to this lock
}
> lcnt:inspect({lcnt:port(12155), port_lock}, [{locations, true}, {combine, true}]).
lock: #Port<app@127.0.0.1.12155>
id: 1
type: mutex
location #tries #collisions collisions [%] time [us] duration [%] histogram [log2(us)]
--------- ------- ------------ --------------- ---------- ------------- ---------------------
'beam/erl_port.h':437 1 1 100.0000 6707846 54.6453 | X|
undefined:0 3 0 0.0000 0 0.0000 | |
> lcnt:inspect({lcnt:port(12474), port_lock}, [{locations, true}, {combine, true}]).
lock: #Port<app@127.0.0.1.12474>
id: 1
type: mutex
location #tries #collisions collisions [%] time [us] duration [%] histogram [log2(us)]
--------- ------- ------------ --------------- ---------- ------------- ---------------------
'beam/erl_port.h':437 1 1 100.0000 101243 0.8248 | X |
undefined:0 3 0 0.0000 0 0.0000 | |
ERTS_GLB_INLINE void
erts_port_lock(Port *prt)
{
/* *Need* to be a managed thread */
ERTS_LC_ASSERT(erts_thr_progress_is_managed_thread());
erts_mtx_lock(prt->lock); // <<-------------------- points to this lock
}
> lcnt:inspect(port_sched_lock, [{locations, true}, {combine, true}]).
lock: port_sched_lock
id: 7342
type: mutex
location #tries #collisions collisions [%] time [us] duration [%] histogram [log2(us)]
--------- ------- ------------ --------------- ---------- ------------- ---------------------
'beam/erl_port_task.h':190 96833 101 0.1043 620 0.0051 | |
undefined:0 0 0 0.0000 0 0.0000 | |
ERTS_GLB_INLINE void
erts_port_task_sched_lock(ErtsPortTaskSched *ptsp)
{
erts_mtx_lock(&ptsp->mtx); // <<-------------------- points to this lock
}
> lcnt:inspect(drv_ev_state, [{locations, true}, {combine, true}]).
lock: drv_ev_state
id: 128
type: mutex
location #tries #collisions collisions [%] time [us] duration [%] histogram [log2(us)]
--------- ------- ------------ --------------- ---------- ------------- ---------------------
'sys/common/erl_check_io.c':1723 9916 432 4.3566 16171 0.1317 | |
'sys/common/erl_check_io.c':825 21771 3 0.0138 849 0.0069 | |
'sys/common/erl_check_io.c':479 6897 2 0.0290 12 0.0001 | |
undefined:0 0 0 0.0000 0 0.0000 | |
> lcnt:inspect(code_server, [{locations, true}, {combine, true}]).
lock: code_server
id: 5
type: proclock
location #tries #collisions collisions [%] time [us] duration [%] histogram [log2(us)]
--------- ------- ------------ --------------- ---------- ------------- ---------------------
'beam/erl_process.c':9722 21952 0 0.0000 11916 0.0971 |X X. ....... .. |
'beam/erl_proc_sig_queue.c':685 7343 128 1.7432 3808 0.0310 |X x. . . . |
'beam/erl_message.c':374 7346 69 0.9393 847 0.0069 |X x . .. |
'beam/erl_proc_sig_queue.c':4172 6533 37 0.5664 102 0.0008 |X . . |
'beam/erl_proc_sig_queue.c':3175 5330 15 0.2814 1 0.0000 |X . |
undefined:0 7346 602 8.1949 0 0.0000 | |
'beam/erl_process.c':9310 21950 0 0.0000 0 0.0000 | |
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment