[erlang-questions] profiling network apps: fprof vs sequential tracing

Björn-Egil Dahlberg <>
Mon Sep 20 14:28:20 CEST 2010


On 2010-09-20 13:57, Joel Reymont wrote:
>
> On Sep 17, 2010, at 4:01 PM, Björn-Egil Dahlberg wrote:
>
>> lcnt will pinpoint locks with long acquisition time and high collision rates, which is a signal of high contention for specific memory areas.
>
> Does this tell you anything?
>
> 6>  lcnt:conflicts().
>                     lock   id   #tries  #collisions  collisions [%]  time [us]  duration [%]
>                    -----  ---  ------- ------------ --------------- ---------- -------------
>           alcu_allocator   26 95048664       317604          0.3341    3113330        1.8408
>                run_queue    4 10342831       210812          2.0382    2924435        1.7291
>                 pix_lock  256  9795287        17111          0.1747    1416804        0.8377
>                  pollset    1   992163        24805          2.5001    1350653        0.7986
>                proc_msgq 1816  7019209        67222          0.9577     628357        0.3715
>              proc_status 1816 15674155        92564          0.5906     592533        0.3503
>                proc_link 1816  4471858         9593          0.2145     574034        0.3394
>                port_lock  335  3263611        19866          0.6087     545129        0.3223
>                   db_tab   51  7044068         2975          0.0422     476275        0.2816
>                timeofday    1  4417012        20162          0.4565     439839        0.2601
>                proc_main 1816  8389632       301788          3.5972     188551        0.1115
>             drv_ev_state   16   657921          811          0.1233     126814        0.0750
>              timer_wheel    1  1594264         4582          0.2874      89597        0.0530
>                 make_ref    1  1093840         1314          0.1201      38031        0.0225
>                fix_alloc   11  4387004        15027          0.3425      30502        0.0180
>     run_queue_sleep_list    4  3562460           79          0.0022      12454        0.0074
>   inet_buffer_stack_lock    1   168484          117          0.0694      11138        0.0066
>    ptimer_pre_alloc_lock    4   828826           47          0.0057       8794        0.0052
>   message_pre_alloc_lock    4  5894368         2725          0.0462       7282        0.0043
>              driver_list    1   746783          127          0.0170       5112        0.0030
> ok
> 7>

Initially this looks good, however, you should examine the process locks 
more closely.

Use,
lcnt:swap_pid_keys() and lcnt:conflicts([{combine, false}]) to see the 
contention on individual locks. The 1816 processes has together 3.6% 
collision rate which suggests that some process has a lot of contention 
on its main_lock.

Regards,
Björn-Egil


More information about the erlang-questions mailing list