Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 14 Feb 2002 10:19:51 -0000
From:      "Tariq Rashid" <tariq@inty.net>
To:        <freebsd-net@FreeBSD.ORG>
Subject:   RE: squeeze more performance out of natd? - some gprof stats
Message-ID:  <MPENKFCCIIDAJKJJOLBHIEEFCIAA.tariq@inty.net>
In-Reply-To: <MPENKFCCIIDAJKJJOLBHGECICIAA.tariq@inty.net>

next in thread | previous in thread | raw e-mail | index | archive | help

attached are some gprof stats - it seems that sendto() is taking most of the
time... does this mean that nothing can be done about it?

what affects the speed of sendto() returning... i have the following boosted
kernel params:

net.local.stream.sendspace: 8192
net.local.stream.recvspace: 8192
net.local.dgram.recvspace: 4096
net.inet.tcp.sendspace: 16384
net.inet.tcp.recvspace: 16384
net.inet.udp.recvspace: 41600
net.inet.raw.recvspace: 8192

and the ulimit -a shows a healthy max proc /fds... the kernel option
maxusers is set to 1024.

cpu time (seconds)         unlimited
file size (blocks)         unlimited
data seg size (kbytes)     524288
stack size (kbytes)        65536
core file size (blocks)    unlimited
resident set size (kbytes) unlimited
locked-in-memory size (kb) unlimited
processes                  16403
file descriptors           32808
socket buffer size (kb)    unlimited

i do note that sometimes the SendNeedIcmpFrag is called after sendto() - i
guess thats due to the sendto() not happening atomically at that particular
time.

my earlier thoughts that it migt be select() don't seem to be reflected by
the gprof output below?

any advice from those with more profiling experience would be gratefully
recieved.


the top bit of gprof attched...


--------------- gprof natd natd.gmon ------------------------------



                                  called/total       parents
index  %time    self descendents  called+self    name           index
                                  called/total       children

                                                     <spontaneous>
[1]     99.9    0.23       24.49                 main [1]
                0.14       23.19   94551/94551       DoAliasing [2]
                1.04        0.00   94552/94552       select [7]
                0.00        0.08       1/1           ParseArgs [19]
                0.04        0.00  189104/189104      bzero [28]
                0.00        0.00       1/1
SetAliasAddressFromIfName [67]
                0.00        0.00       1/2           PacketAliasSetMode [66]
                0.00        0.00       1/1           PacketAliasInit [79]
                0.00        0.00       1/1           printf [89]
                0.00        0.00       2/4           socket [119]
                0.00        0.00       2/3           siginterrupt [126]
                0.00        0.00       2/3           signal [128]
                0.00        0.00       1/1           openlog [150]
                0.00        0.00       1/1           _bind [658]
                0.00        0.00       1/1           _shutdown [663]
                0.00        0.00       1/27362       __error_unthreaded
[639]

-----------------------------------------------

                0.14       23.19   94551/94551       main [1]
[2]     94.3    0.14       23.19   94551         DoAliasing [2]
                0.05       20.19   94551/94551       FlushPacketBuffer [3]
                1.16        0.00   94551/94551       recvfrom [5]
                0.05        0.91   50094/50094       PacketAliasOut [8]
                0.04        0.79   44457/44457       PacketAliasIn [9]

-----------------------------------------------

                0.05       20.19   94551/94551       DoAliasing [2]
[3]     81.8    0.05       20.19   94551         FlushPacketBuffer [3]
               20.19        0.00   94551/94552       _sendto [4]

-----------------------------------------------

                0.00        0.00       1/94552       send [70]
               20.19        0.00   94551/94552       FlushPacketBuffer [3]
[4]     81.6   20.19        0.00   94552         _sendto [4]

-----------------------------------------------

                1.16        0.00   94551/94551       DoAliasing [2]
[5]      4.7    1.16        0.00   94551         recvfrom [5]

-----------------------------------------------

                                   94551             SendNeedFragIcmp [6]
                0.08        0.44   44457/94551       PacketAliasIn [9]
                0.09        0.50   50094/94551       PacketAliasOut [8]
[6]      4.5    0.17        0.94   94551+94551   SendNeedFragIcmp [6]
                0.02        0.36   50094/50094       FindUdpTcpOut [14]
                0.02        0.31   44457/44457       FindUdpTcpIn [17]
                0.05        0.00   94551/94551       GetAckModified [26]
                0.04        0.00   94551/94551       GetAliasAddress [29]
                0.02        0.00   50094/50094       ProxyCheck [33]
                0.02        0.00   50094/50594       GetAliasPort [32]
                0.02        0.00   50094/50094       GetStateOut [34]
                0.02        0.00   44457/44957       GetOriginalPort [35]
                0.02        0.00   44457/44457       GetProxyAddress [36]
                0.01        0.00   44457/44457       GetProxyPort [37]
                0.01        0.00   44457/44957       GetOriginalAddress [44]
                0.01        0.00   50094/50094       SetStartSeq [45]
                0.01        0.00   44457/44457       GetStateIn [49]
                0.01        0.00   44457/44457       GetFlags [52]
                0.00        0.00     500/500         SetStateOut [61]
                0.00        0.00     500/500         SetStateIn [101]
                                   94551             SendNeedFragIcmp [6]

-----------------------------------------------

                1.04        0.00   94552/94552       main [1]
[7]      4.2    1.04        0.00   94552         select [7]

-----------------------------------------------

                0.05        0.91   50094/50094       DoAliasing [2]
[8]      3.9    0.05        0.91   50094         PacketAliasOut [8]
                0.09        0.50   50094/94551       SendNeedFragIcmp [6]
                0.05        0.25   50094/94552       HouseKeeping [12]
                0.01        0.00   50094/50094       GetDefaultAliasAddress
[39]
                0.00        0.00   50094/50094       SetDefaultAliasAddress
[53]
                0.00        0.00   50094/94551       ClearCheckNewLink [47]

-----------------------------------------------

                0.04        0.79   44457/44457       DoAliasing [2]
[9]      3.4    0.04        0.79   44457         PacketAliasIn [9]
                0.08        0.44   44457/94551       SendNeedFragIcmp [6]
                0.05        0.22   44457/94552       HouseKeeping [12]
                0.00        0.00   44457/94551       ClearCheckNewLink [47]

-----------------------------------------------

[10]     2.7    0.30        0.37   95949+99575   <cycle 2 as a whole>   [10]
                0.26        0.37   96449+98083       FindNewPortGroup <cycle
2> [11]
                0.04        0.00   99075             DifferentialChecksum
<cycle 2> [27]

-----------------------------------------------

                                   98083             FindNewPortGroup <cycle
2> [11]
                                     500             DifferentialChecksum
<cycle 2> [27]
                0.00        0.00       1/95949       PacketAliasSetAddress
[78]
                0.00        0.00       1/95949       PacketAliasUninit [63]
                0.00        0.00       8/95949       PacketAliasRedirectPort
[72]
                0.00        0.00     388/95949       HouseKeeping [12]
                0.00        0.00     500/95949       FindAliasAddress [54]
                0.14        0.17   44457/95949       FindUdpTcpIn [17]
                0.16        0.20   50594/95949       FindUdpTcpOut [14]
[11]     2.5    0.26        0.37   96449+98083   FindNewPortGroup <cycle 2>
[11]
                0.00        0.37    1008/1010        PunchFWHole [15]
                0.00        0.00    1016/1047        malloc [58]
                0.00        0.00    1016/1045        free [59]
                                   99075             DifferentialChecksum
<cycle 2> [27]
                                   98083             FindNewPortGroup <cycle
2> [11]

-----------------------------------------------

                0.00        0.00       1/94552       PacketAliasUninit [63]
                0.05        0.22   44457/94552       PacketAliasIn [9]
                0.05        0.25   50094/94552       PacketAliasOut [8]
[12]     2.3    0.10        0.47   94552         HouseKeeping [12]
                0.46        0.00   94551/94554       gettimeofday [13]
                0.00        0.00     388/95949       FindNewPortGroup <cycle
2> [11]

-----------------------------------------------

                0.00        0.00       1/94554       PacketAliasInit [79]
                0.00        0.00       2/94554       time [77]
                0.46        0.00   94551/94554       HouseKeeping [12]
[13]     1.9    0.46        0.00   94554         gettimeofday [13]

-----------------------------------------------

                0.02        0.36   50094/50094       SendNeedFragIcmp [6]
[14]     1.5    0.02        0.36   50094         FindUdpTcpOut [14]
                0.16        0.20   50594/95949       FindNewPortGroup <cycle
2> [11]
                0.00        0.00     500/500         FindAliasAddress [54]

-----------------------------------------------

                0.00        0.00       2/1010        PacketAliasCheckNewLink
[62]
                0.00        0.37    1008/1010        FindNewPortGroup <cycle
2> [11]
[15]     1.5    0.00        0.37    1010         PunchFWHole [15]
                0.37        0.00   28664/28664       _setsockopt [16]
                0.00        0.00     500/44957       GetOriginalPort [35]
                0.00        0.00     500/50594       GetAliasPort [32]
                0.00        0.00     500/44957       GetOriginalAddress [44]
                0.00        0.00     500/500         GetDestAddress [100]
                0.00        0.00       2/3           memset [123]

-----------------------------------------------

                0.37        0.00   28664/28664       PunchFWHole [15]
[16]     1.5    0.37        0.00   28664         _setsockopt [16]

-----------------------------------------------

                0.02        0.31   44457/44457       SendNeedFragIcmp [6]
[17]     1.3    0.02        0.31   44457         FindUdpTcpIn [17]
                0.14        0.17   44457/95949       FindNewPortGroup <cycle
2> [11]

-----------------------------------------------

[18]     0.3    0.00        0.08       4+9       <cycle 1 as a whole>   [18]
                0.00        0.08      12             ParseOption <cycle 1>
[20]
                0.00        0.00       1             ReadConfigFile <cycle
1> [81]

-----------------------------------------------

                0.00        0.08       1/1           main [1]
[19]     0.3    0.00        0.08       1         ParseArgs [19]
                0.00        0.08       4/4           ParseOption <cycle 1>
[20]
                0.00        0.00       4/4           strncat [120]

-----------------------------------------------

                                       8             ReadConfigFile <cycle
1> [81]
                0.00        0.08       4/4           ParseArgs [19]
[20]     0.3    0.00        0.08      12         ParseOption <cycle 1> [20]
                0.00        0.08       8/8           SetupPortRedirect [21]
root@exoserver.tariq11:/# gprof /sbin/natd natd.gmon | less
/usr/share/misc/gprof.callg: No such file or directory
        None


granularity: each sample hit covers 4 byte(s) for 0.00% of 24.73 seconds
granularity: each sample hit covers 4 byte(s) for 0.00% of 24.73 seconds

                                  called/total       parents
index  %time    self descendents  called+self    name           index
                                  called/total       children

                                                     <spontaneous>
[1]     99.9    0.23       24.49                 main [1]
                0.14       23.19   94551/94551       DoAliasing [2]
                1.04        0.00   94552/94552       select [7]
                0.00        0.08       1/1           ParseArgs [19]
                0.04        0.00  189104/189104      bzero [28]
                0.00        0.00       1/1
SetAliasAddressFromIfName [67]
                0.00        0.00       1/2           PacketAliasSetMode [66]
                0.00        0.00       1/1           PacketAliasInit [79]
                0.00        0.00       1/1           printf [89]
                0.00        0.00       2/4           socket [119]
                0.00        0.00       2/3           siginterrupt [126]
                0.00        0.00       2/3           signal [128]
                0.00        0.00       1/1           openlog [150]
                0.00        0.00       1/1           _bind [658]
                0.00        0.00       1/1           _shutdown [663]
                0.00        0.00       1/27362       __error_unthreaded
[639]

-----------------------------------------------

                0.14       23.19   94551/94551       main [1]
[2]     94.3    0.14       23.19   94551         DoAliasing [2]
                0.05       20.19   94551/94551       FlushPacketBuffer [3]
                1.16        0.00   94551/94551       recvfrom [5]
                0.05        0.91   50094/50094       PacketAliasOut [8]
                0.04        0.79   44457/44457       PacketAliasIn [9]

-----------------------------------------------

                0.05       20.19   94551/94551       DoAliasing [2]
[3]     81.8    0.05       20.19   94551         FlushPacketBuffer [3]
               20.19        0.00   94551/94552       _sendto [4]

-----------------------------------------------

                0.00        0.00       1/94552       send [70]
               20.19        0.00   94551/94552       FlushPacketBuffer [3]
[4]     81.6   20.19        0.00   94552         _sendto [4]

-----------------------------------------------

                1.16        0.00   94551/94551       DoAliasing [2]
[5]      4.7    1.16        0.00   94551         recvfrom [5]

-----------------------------------------------

                                   94551             SendNeedFragIcmp [6]
                0.08        0.44   44457/94551       PacketAliasIn [9]
                0.09        0.50   50094/94551       PacketAliasOut [8]
[6]      4.5    0.17        0.94   94551+94551   SendNeedFragIcmp [6]
                0.02        0.36   50094/50094       FindUdpTcpOut [14]
                0.02        0.31   44457/44457       FindUdpTcpIn [17]
                0.05        0.00   94551/94551       GetAckModified [26]
                0.04        0.00   94551/94551       GetAliasAddress [29]
                0.02        0.00   50094/50094       ProxyCheck [33]
                0.02        0.00   50094/50594       GetAliasPort [32]
                0.02        0.00   50094/50094       GetStateOut [34]
                0.02        0.00   44457/44957       GetOriginalPort [35]
                0.02        0.00   44457/44457       GetProxyAddress [36]
                0.01        0.00   44457/44457       GetProxyPort [37]
                0.01        0.00   44457/44957       GetOriginalAddress [44]
                0.01        0.00   50094/50094       SetStartSeq [45]
                0.01        0.00   44457/44457       GetStateIn [49]
                0.01        0.00   44457/44457       GetFlags [52]
                0.00        0.00     500/500         SetStateOut [61]
                0.00        0.00     500/500         SetStateIn [101]
                                   94551             SendNeedFragIcmp [6]

-----------------------------------------------

                1.04        0.00   94552/94552       main [1]
[7]      4.2    1.04        0.00   94552         select [7]

-----------------------------------------------

                0.05        0.91   50094/50094       DoAliasing [2]
[8]      3.9    0.05        0.91   50094         PacketAliasOut [8]
                0.09        0.50   50094/94551       SendNeedFragIcmp [6]
                0.05        0.25   50094/94552       HouseKeeping [12]
                0.01        0.00   50094/50094       GetDefaultAliasAddress
[39]
                0.00        0.00   50094/50094       SetDefaultAliasAddress
[53]
                0.00        0.00   50094/94551       ClearCheckNewLink [47]

-----------------------------------------------

                0.04        0.79   44457/44457       DoAliasing [2]
[9]      3.4    0.04        0.79   44457         PacketAliasIn [9]
                0.08        0.44   44457/94551       SendNeedFragIcmp [6]
                0.05        0.22   44457/94552       HouseKeeping [12]
                0.00        0.00   44457/94551       ClearCheckNewLink [47]

-----------------------------------------------


intY has automatically scanned this email with Sophos Anti-Virus (www.inty.com)



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-net" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?MPENKFCCIIDAJKJJOLBHIEEFCIAA.tariq>