A performance-measurement tool beta

David Collier-Brown davec-b at rogers.com
Wed Dec 29 17:40:47 GMT 2004


  For people doing samba work on Solaris, I have a small tool
(a mere 14,011 lines) called libprof to get resource-usage 
profiles of libc calls.
  For example, If I run it on smbstatus, I get:
Samba version 3.1.0-SVN-build-4368
PID     Username      Group         Machine                        
-------------------------------------------------------------------

Service      pid     machine       Connected at
-------------------------------------------------------

No locked files


Resource usage profile for process 4907
Name                           Duration     Pct.        Calls Sec/Call  
----                           ------------ -----       ----- ----------
Entire program                 0.07961995 100.0           1 0.07961995
free                           0.02047744 25.72         309 0.00006627
fwrite                         0.01161187 14.58           8 0.00145148
setlocale                      0.00649854  8.16         122 0.00005327
strdup                         0.00203668  2.56         223 0.00000913
malloc                         0.00135389  1.70         595 0.00000228
strlen                         0.00102572  1.29         943 0.00000109
Measurement overhead           0.00086724  1.09           1 0.00086724
strcmp                         0.00082122  1.03         644 0.00000128
memcpy                         0.00080791  1.01         583 0.00000139
strcasecmp                     0.00076001  0.95         772 0.00000098
strcpy                         0.00052781  0.66         324 0.00000163
getenv                         0.00040845  0.51         166 0.00000246
strchr                         0.00030351  0.38         290 0.00000105
read                           0.00027614  0.35           5 0.00005523
calloc                         0.00017191  0.22          14 0.00001228
memmove                        0.00014977  0.19          97 0.00000154
realloc                        0.00013591  0.17          45 0.00000302
munmap                         0.00009577  0.12           4 0.00002394
close                          0.00007489  0.09           8 0.00000936
sigemptyset                    0.00006967  0.09           1 0.00006967
sigaction                      0.00006823  0.09           1 0.00006823
strrchr                        0.00004050  0.05           1 0.00004050
mbtowc                         0.00001656  0.02          14 0.00000118
mbstowcs                       0.00001602  0.02          10 0.00000160
memset                         0.00001584  0.02           7 0.00000226
strtok                         0.00001458  0.02           1 0.00001458
atexit                         0.00000918  0.01           3 0.00000306
gethostname                    0.00000882  0.01           1 0.00000882
fflush                         0.00000576  0.01           1 0.00000576
getpid                         0.00000540  0.01           1 0.00000540
getuid                         0.00000378  0.00           1 0.00000378
geteuid                        0.00000288  0.00           1 0.00000288
strspn                         0.00000216  0.00           1 0.00000216
strcat                         0.00000162  0.00           1 0.00000162

  From this, we see a surprising 25% of the time in a null call to 
smbstatus is spent calling free, and a perfectly sane 14% calling fwrite.
This tends to make one wonder at the mismatch between (m|c)alloc and free
times.  Plus there's a lot of strlens in there...

  Anyone interested in trying a copy of libprof drop me a line.
In principle it will run on Linux, but I haven't tried it yet.

--dave
-- 
David Collier-Brown,         | Always do right. This will gratify
System Programmer and Author | some people and astonish the rest
davecb at spamcop.net           |                      -- Mark Twain


More information about the samba-technical mailing list