Eliminating gettimeofday from construct_reply

Andrew Theurer habanero at us.ibm.com
Thu Aug 1 08:39:24 GMT 2002


On Thursday 01 August 2002 8:10 am, Green, Paul wrote:
> Andrew Bartlett [mailto:abartlet at samba.org] wrote:
> > Richard Sharpe wrote:
> > > Hi,
> > >
> > > I looked at this issue, and it looks possible to accumulate
> > > the timeouts that have occured in receive_message_or_smb and
> > > count those up.
> > >
> > > Given that the resolution of the dead time parameter is in
> > > minutes, this would seem to not get too far out of whack.
> >
> > Sounds like a fair optimization to me - assuming that's what
> > it is for.
>
> Pardon my skepticism, but is there any evidence that calling gettimeofday
> from this location in the code is actually contributing in any material way
> to the performance of Samba?  Any measurements? 

Here is the latest profile:
  8867 total                                      0.0044
   700 default_idle                              13.4615
   689 __generic_copy_to_user                    11.4833
   419 generic_file_write                         0.2272
   291 do_softirq                                 1.4265
   260 fget                                       3.8235
   250 _text_lock_inode                           1.1521
 * 241 system_call                                4.3036  *
   237 qdisc_restart                              0.6237
   205 schedule                                   0.2330
   153 d_lookup                                   0.5709
   145 mod_timer                                  0.6144
   134 skb_release_data                           1.1552
   134 ip_queue_xmit                              0.1047
   132 _text_lock_locks                           0.6600
   120 tcp_v4_rcv                                 0.0769
   118 link_path_walk                             0.0530
   113 kfree                                      0.7847
   107 tcp_recvmsg                                0.0459
   105 get_hash_table                             0.6562
   105 __kfree_skb                                0.3409
 *  99 do_gettimeofday                            0.8250  *

*these two are what I am focusing on.   I expect both to be reduced 
significantly if we can reduce the number of calls to gettimeofday.  I agree, 
we would need to see at least a few percent difference to make this worth 
while.  I am obviously going to test a before/after in any case.

> Let me just add that I've wasted all too many working days in my career by
> trying to optimize code by inspection.  When I actually take the time to
> run a benchmark and then optimize the hot spots, I get much better results
> in much less (human) time.

Yes, I agree.   I should have posted the profile with my original email.  
Obviously I would like to get rid of the idle time, too (the top routine), 
but I doubt that is a samba issue, so it didn't mention it.  

-Andrew Theurer






More information about the samba-technical mailing list