Skip to content

Instantly share code, notes, and snippets.

@frankmullerl
Last active January 7, 2020 16:59
Show Gist options
  • Save frankmullerl/d9e8379b8250d84c5b170577c2ad3b89 to your computer and use it in GitHub Desktop.
Save frankmullerl/d9e8379b8250d84c5b170577c2ad3b89 to your computer and use it in GitHub Desktop.
LCNT output continued (macOS): switching from prim_file:sendfile/8 to file:pread + gen_tcp:send/2
> 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(120000),
> lcnt:collect(),
> lcnt:conflicts().
lock id #tries #collisions collisions [%] time [us] duration [%]
----- --- ------- ------------ --------------- ---------- -------------
run_queue 14 17230386 619118 3.5932 10880271 16.7387
alcu_allocator 11 3115406 107001 3.4346 1995484 3.0699
dirty_run_queue_sleep_list 2 1234640 23396 1.8950 243006 0.3739
drv_ev_state 128 1003858 23473 2.3383 219408 0.3375
code_server 5 2338520 23114 0.9884 27220 0.0419
port_sched_lock 203424 2803324 2739 0.0977 7423 0.0114
<app@127.0.0.1.5715.1> 5 84 4 4.7619 3878 0.0060
pix_lock 1024 324 1 0.3086 3662 0.0056
#Port<app@127.0.0.1.10> 1 276834 1100 0.3974 3340 0.0051
<app@127.0.0.1.5721.1> 5 77 2 2.5974 2432 0.0037
<app@127.0.0.1.5729.1> 5 77 2 2.5974 2384 0.0037
<app@127.0.0.1.31417.5> 5 64 4 6.2500 1328 0.0020
<app@127.0.0.1.30177.5> 5 77 2 2.5974 1107 0.0017
<app@127.0.0.1.31397.5> 5 93 3 3.2258 1084 0.0017
<app@127.0.0.1.30005.5> 5 87 3 3.4483 1083 0.0017
<app@127.0.0.1.31405.5> 5 72 2 2.7778 1004 0.0015
<app@127.0.0.1.13289.4> 5 64 4 6.2500 960 0.0015
<app@127.0.0.1.11353.0> 5 72 2 2.7778 924 0.0014
<app@127.0.0.1.11359.0> 5 72 2 2.7778 920 0.0014
<app@127.0.0.1.25734.0> 5 95 4 4.2105 796 0.0012
> 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 17230386 619118 3.5932 10880271 16.7387 |X ....xx... |
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(alcu_allocator, [{locations, true}, {combine, true}]).
lock: alcu_allocator
id: 11
type: mutex
location #tries #collisions collisions [%] time [us] duration [%] histogram [log2(us)]
--------- ------- ------------ --------------- ---------- ------------- ---------------------
'beam/erl_alloc_util.c':5956 401173 39720 9.9010 771189 1.1864 |. ....Xx.... |
'beam/erl_alloc_util.c':1837 200008 24301 12.1500 478485 0.7361 |. ....Xx... |
'beam/erl_alloc_util.c':6422 201186 22661 11.2637 438379 0.6744 |. ....XX... |
'beam/erl_alloc_util.c':2109 2313000 20319 0.8785 307431 0.4730 | |
undefined:0 0 0 0.0000 0 0.0000 | |
'beam/erl_alloc_util.c':1654 39 0 0.0000 0 0.0000 | |
> lcnt:inspect(dirty_run_queue_sleep_list, [{locations, true}, {combine, true}]).
lock: dirty_run_queue_sleep_list
id: 2
type: mutex
location #tries #collisions collisions [%] time [us] duration [%] histogram [log2(us)]
--------- ------- ------------ --------------- ---------- ------------- ---------------------
'beam/erl_process.c':3520 406048 13850 3.4109 148487 0.2284 | |
'beam/erl_process.c':3635 422544 7214 1.7073 74641 0.1148 | |
'beam/erl_process.c':3358 406048 2332 0.5743 19878 0.0306 | |
undefined:0 0 0 0.0000 0 0.0000 | |
ok
> 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 317987 13590 4.2738 114092 0.1755 | X |
'sys/common/erl_check_io.c':825 610600 9883 1.6186 105316 0.1620 | |
undefined:0 0 0 0.0000 0 0.0000 | |
'sys/common/erl_check_io.c':479 75271 0 0.0000 0 0.0000 | |
> lcnt:inspect(port_sched_lock, [{locations, true}, {combine, true}]).
lock: port_sched_lock
id: 203424
type: mutex
location #tries #collisions collisions [%] time [us] duration [%] histogram [log2(us)]
--------- ------- ------------ --------------- ---------- ------------- ---------------------
'beam/erl_port_task.h':190 2803324 2739 0.0977 7423 0.0114 |X ...... |
undefined:0 0 0 0.0000 0 0.0000 | |
ok
ERTS_GLB_INLINE void
erts_port_task_sched_lock(ErtsPortTaskSched *ptsp)
{
erts_mtx_lock(&ptsp->mtx); // <<-------------------- points to this lock
}
> lcnt:inspect(pix_lock, [{locations, true}, {combine, true}]).
lock: pix_lock
id: 1024
type: mutex
location #tries #collisions collisions [%] time [us] duration [%] histogram [log2(us)]
--------- ------- ------------ --------------- ---------- ------------- ---------------------
'beam/erl_process_lock.h':561 324 1 0.3086 3662 0.0056 | X |
undefined:0 0 0 0.0000 0 0.0000 | |
ok
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment