Eliminating gettimeofday from construct_reply

Richard Sharpe rsharpe at ns.aus.com
Thu Aug 1 10:39:01 GMT 2002


OK,

Here is some profiling data from Samba. I profiled around each of the 
GetTimeOfDay calls in construct_reply. So, it does not count all 
gettimeofday calls. I was more interested in the fastpath.

I then ran a test that read a single 50MB file from the server. The file 
would pretty much be in cache as I wrote it there a few minutes before and 
I have 2GB on the server.

Here are the non-zero syscall values:

opendir_count:                  1
opendir_time:                   113
readdir_count:                  13
readdir_time:                   55
rmdir_count:                    1
rmdir_time:                     39
closedir_count:                 1
closedir_time:                  62
open_count:                     2
open_time:                      37
close_count:                    2
close_time:                     18
read_count:                     833
read_time:                      144950
stat_count:                     8
stat_time:                      160
fstat_count:                    833
fstat_time:                     3023
chdir_count:                    1
chdir_time:                     28
fcntl_lock_count:               833
fcntl_lock_time:                1493
gettimeofday_count:             852
gettimeofday_time:              1527

All times are in microseconds. 

Firstly, my earlier assertion that gettimeofday is about as costly as 
fstat is off by about a factor of two.

Secondly, this code includes the sendfile patch, and the read times are 
all the time attributed to sendfile.

The overall cost of gettimeofday seems to be less than 1% here and would 
be smaller in a more realistic mix.

Regards
-----
Richard Sharpe, rsharpe at ns.aus.com, rsharpe at samba.org, 
sharpe at ethereal.com





More information about the samba-technical mailing list