Faster mutex lock() and unlock()

Nikos Mavrogiannopoulos nmav at gnutls.org
Thu Jul 13 15:40:13 CEST 2006


On Thu 13 Jul 2006 10:32, Victor Stinner wrote:

> Ok, I understand. I don't want to break libgcrypt API/behaviour. I
> just try to understand where my program is spending a lot of time,
> and I have difficulties to read gprof results ...

I profiled gcrypt and gnutls quite some time ago using a (multithreaded) 
https server (on a single cpu system). The profiler I was using was 
oprofile. http://oprofile.sourceforge.net/

For libgcrypt the output wasn't really helpful, but I attach it anyway 
since it might be usefull to somebody.

regards,
Nikos
-------------- next part --------------
Flat profile:

Each sample counts as 1 samples.
  %   cumulative   self              self     total           
 time   samples   samples    calls  T1/call  T1/call  name    
 23.55   1247.00  1247.00                             Loop
 16.37   2114.00   867.00                             Loop
 14.41   2877.00   763.00                             gcry_mpih_divrem
  8.63   3334.00   457.00                             rijndael_encrypt
  5.44   3622.00   288.00                             transform
  3.76   3821.00   199.00                             transform
  2.12   3933.00   112.00                             gcry_mpih_sqr_n_basecase
  2.00   4039.00   106.00                             Loop
  1.81   4135.00    96.00                             gcry_burn_stack
  1.70   4225.00    90.00                             Loop
  1.51   4305.00    80.00                             Loop
  1.45   4382.00    77.00                             gcry_mpi_free_limb_space
  1.45   4459.00    77.00                             cipher_encrypt
  1.38   4532.00    73.00                             gcry_mpi_copy
  1.34   4603.00    71.00                             gcry_mpih_addmul_1
  1.27   4670.00    67.00                             gcry_mpih_sqr_n
  1.17   4732.00    62.00                             gcry_mpih_submul_1
  1.15   4793.00    61.00                             md_close
  0.96   4844.00    51.00                             mul_n_basecase
  0.68   4880.00    36.00                             mul_n
  0.66   4915.00    35.00                             gcry_mpi_add
  0.55   4944.00    29.00                             gcry_mpi_invm
  0.53   4972.00    28.00                             gcry_mpi_set
  0.38   4992.00    20.00                             gcry_mpih_mul_1
  0.38   5012.00    20.00                             mix_pool
  0.36   5031.00    19.00                             frame_dummy
  0.34   5049.00    18.00                             L2
  0.32   5066.00    17.00                             gcry_mpi_rshift
  0.30   5082.00    16.00                             gcry_mpi_powm
  0.28   5097.00    15.00                             gcry_mpih_sub_n
  0.26   5111.00    14.00                             gcry_malloc
  0.26   5125.00    14.00                             gcry_mpih_add_n
  0.26   5139.00    14.00                             transform
  0.23   5151.00    12.00                             Loop2
  0.23   5163.00    12.00                             add_randomness
  0.19   5173.00    10.00                             init
  0.19   5183.00    10.00                             gcry_mpi_sub
  0.19   5193.00    10.00                             sha1_write
  0.17   5202.00     9.00                             gcry_free
  0.13   5209.00     7.00                             gcry_mpi_free
  0.13   5216.00     7.00                             gcry_mpih_rshift
  0.13   5223.00     7.00                             gcry_mpi_test_bit
  0.11   5229.00     6.00                             gcry_malloc
  0.09   5234.00     5.00                             gcry_mpi_alloc
  0.09   5239.00     5.00                             gcry_mpi_alloc_limb_space
  0.06   5242.00     3.00                             gcry_md_ctl
  0.06   5245.00     3.00                             gcry_md_setkey
  0.06   5248.00     3.00                             gcry_xmalloc
  0.06   5251.00     3.00                             md5_final
  0.06   5254.00     3.00                             md5_write
  0.06   5257.00     3.00                             sexp_sscan
  0.04   5259.00     2.00                             gcry_mpi_normalize
  0.04   5261.00     2.00                             gcry_mpi_set_buffer
  0.04   5263.00     2.00                             do_fast_random_poll
  0.04   5265.00     2.00                             gcry_create_nonce
  0.04   5267.00     2.00                             md_get_algo
  0.04   5269.00     2.00                             rijndael_decrypt
  0.04   5271.00     2.00                             rmd160_write
  0.04   5273.00     2.00                             sha1_final
  0.02   5274.00     1.00                             L0
  0.02   5275.00     1.00                             Lend2
  0.02   5276.00     1.00                             gcry_ath_mutex_lock
  0.02   5277.00     1.00                             gcry_ath_mutex_unlock
  0.02   5278.00     1.00                             gcry_fast_random_poll
  0.02   5279.00     1.00                             gcry_mpi_alloc_secure
  0.02   5280.00     1.00                             gcry_mpi_resize
  0.02   5281.00     1.00                             gcry_mpih_mul_karatsuba_case
  0.02   5282.00     1.00                             gcry_rmd160_mixblock
  0.02   5283.00     1.00                             gcry_cipher_close
  0.02   5284.00     1.00                             gcry_is_secure
  0.02   5285.00     1.00                             gcry_md_reset
  0.02   5286.00     1.00                             gcry_mpi_cmp_ui
  0.02   5287.00     1.00                             gcry_mpi_invm
  0.02   5288.00     1.00                             gcry_pk_lookup_func_name
  0.02   5289.00     1.00                             gcry_sexp_cdr
  0.02   5290.00     1.00                             gcry_sexp_find_token
  0.02   5291.00     1.00                             gcry_xmalloc_secure
  0.02   5292.00     1.00                             md_open
  0.02   5293.00     1.00                             md_write
  0.02   5294.00     1.00                             rmd160_final
  0.02   5295.00     1.00                             sha1_init

 %         the percentage of the total running time of the
time       program used by this function.

cumulative a running sum of the number of seconds accounted
 seconds   for by this function and those listed above it.

 self      the number of seconds accounted for by this
seconds    function alone.  This is the major sort for this
           listing.

calls      the number of times this function was invoked, if
           this function is profiled, else blank.
 
 self      the average number of milliseconds spent in this
ms/call    function per call, if this function is profiled,
	   else blank.

 total     the average number of milliseconds spent in this
ms/call    function and its descendents per call, if this 
	   function is profiled, else blank.

name       the name of the function.  This is the minor sort
           for this listing. The index shows the location of
	   the function in the gprof listing. If the index is
	   in parenthesis it shows where it would appear in
	   the gprof listing if it were to be printed.


More information about the Gcrypt-devel mailing list