This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] (Updated) trace tcp connections parameters


On Tue, 2009-10-06 at 14:27 -0700, Josh Stone wrote:

> Thanks, you've addressed those points nicely.
> 
> > - I re-wrote print_packet_info() to support variable length output
> > records.  However in doing so I may have added string copies against
> > Josh's advice :(
> 
> That wasn't a critical point, just a suggestion to avoid our sub-optimal
> code generation.  But anyway, you could change this:
> 
>   ..
>   txq_prnt = txq_flg ? sprintf("%8d",txq[key]) : empty
>   rxq_prnt = rxq_flg ? sprintf("%8d",rxq[key]) : empty
>   ...
>   printf("...%s%s...\n", ..., txq_prnt, rxq_prnt, ...)
> 
> into this:
> 
>   ...
>   if (txq_flg) printf("%8d", txq[key])
>   if (rxq_flg) printf("%8d", rxq[key])
>   ...
>   printf("\n")

I will make that change here and in print_header().

> 
> So you can just print each piece as it comes, with no string temps.  The
> printfs go into a percpu buffer that's flushed at the end of the probe,
> so even writing it piecemeal should still come out atomically.
> 
> > Note: Rules can be used to limit tracing to a single socket
> > or allow many sockets to be traced at one time. Memory consumed
> > by the tracer will increase with the number of connections
> > being traced.
> 
> That's not really true -- we allocate fixed memory for the maps at the
> beginning of the script, so actually a single connection and many
> connections will still have the same memory consumption on our end.
> 
> But that does remind me, when a connection is finished you should
> probably delete the corresponding key from all the maps.  Otherwise, the
> script will die as soon as it sees more than MAXMAPENTRIES connections
> (default 2048).  You'll still have that limit concurrently, but you
> don't want to accumulate data for old connections.  I left this running
> in the background on my laptop, and it died after about an hour due to
> overflowing the maps.

Ok, Once the state of a socket goes to "closed" I can delete the entry,
but I am wondering if "delete ARRAY[y,x,z]" will truly make the slot
available for re-use or just mark it invalid. I will give it a try.

> 
> Thanks,
> 
> Josh


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]