Memory allocation performance

Alexander Motin mav at FreeBSD.org
Sat Feb 2 02:30:52 PST 2008


Joseph Koshy wrote:
> You cannot sample with the TSC since the TSC does not interrupt the CPU.
> For CPU cycles you would probably want to use "p4-global-power-events";
> see pmc(3).

Thanks, I have already found this. There was only problem, that by 
default it counts cycles only when both logical cores are active while 
one of my cores was halted.
Sampling on this, profiler shown results close to usual profiling, but 
looking more random:

          175.97     1.49       1/64          ip_input <cycle 1> [49]
          175.97     1.49       1/64          g_alloc_bio [81]
          175.97     1.49       1/64          ng_package_data [18]
         1055.81     8.93       6/64          em_handle_rxtx [4]
         2639.53    22.32      15/64          em_get_buf [19]
         3343.41    28.27      19/64          ng_getqblk [17]
         3695.34    31.25      21/64          ip_forward <cycle 1> [14]
[9]21.6 11262.00   95.23      64         uma_zalloc_arg [9]
           35.45    13.03       5/22          critical_exit [75]
           26.86     0.00      22/77          critical_enter [99]
           19.89     0.00      18/19          mb_ctor_mbuf [141]


           31.87     0.24       4/1324        ng_ether_rcvdata [13]
           31.87     0.24       4/1324        ip_forward <cycle 1> [14]
           95.60     0.73      12/1324        ng_iface_rcvdata <cycle 1> 
[16]
          103.57     0.79      13/1324        m_freem [25]
          876.34     6.71     110/1324        mb_free_ext [30]
         9408.75    72.01    1181/1324        ng_free_item [11]
[10]20.2 10548.00  80.73    1324         uma_zfree_arg [10]
           26.86     0.00      22/77          critical_enter [99]
           15.00    11.59       7/7           mb_dtor_mbuf [134]
           19.00     6.62       4/4           mb_dtor_pack [136]
            1.66     0.00       1/32          m_tag_delete_chain [114]


  21.4   11262.00 11262.00       64 175968.75 177456.76  uma_zalloc_arg [9]
  20.1   21810.00 10548.00     1324  7966.77  8027.74  uma_zfree_arg [10]
   5.6   24773.00  2963.00     1591  1862.35  2640.07  ng_snd_item 
<cycle 1> [15]
   3.5   26599.00  1826.00       33 55333.33 55333.33  ng_address_hook [20]
   2.4   27834.00  1235.00      319  3871.47  3871.47  ng_acquire_read [28]

To make statistics better I need to record sampling data with smaller 
period, but too much data creates additional overhead including disc 
operations and brakes statistics. Is there any way to make it more 
precise? What sampling parameters should I use for better results?

-- 
Alexander Motin


More information about the freebsd-performance mailing list