Wireshark-commits: [Wireshark-commits] rev 36849: /trunk/ /trunk/epan/dissectors/: packet-tcp.c /tr
Date: Mon, 25 Apr 2011 19:01:13 GMT
http://anonsvn.wireshark.org/viewvc/viewvc.cgi?view=rev&revision=36849

User: guy
Date: 2011/04/25 12:01 PM

Log:
 Store the frame_data structures in a tree, rather than a linked list. 
 This lets us get rid of the per-frame_data-structure prev and next
 pointers, saving memory (at least according to Activity Monitor's report
 of the virtual address space size on my Snow Leopard machine, it's a
 noticeable saving), and lets us look up frame_data structures by frame
 number in O(log2(number of frames)) time rather than O(number of frames)
 time.  It seems to take more CPU time when reading in the file, but
 seems to go from "finished reading in all the packets" to "displaying
 the packets" faster and seems to free up the frame_data structures
 faster when closing the file.
 
 It *is* doing more copying, currently, as we now don't allocate the
 frame_data structure until after the packet has passed the read filter,
 so that might account for the additional CPU time.
 
 (Oh, and, for what it's worth, on an LP64 platform, a frame_data
 structure is exactly 128 bytes long.  However, there's more stuff to
 remove, so the power-of-2 size is not guaranteed to remain, and it's not
 a power-of-2 size on an ILP32 platform.)
 
 It also means we don't need GLib 2.10 or later for the two-pass mode in
 TShark.
 
 It also means some code in the TCP dissector that was checking
 pinfo->fd->next to see if it's NULL, in order to see if this is the last
 packet in the file, no longer works, but that wasn't guaranteed to work
 anyway:
 
 	we might be doing a one-pass read through the capture in TShark;
 
 	we might be dissecting the frame while we're reading in the
 	packets for the first time in Wireshark;
 
 	we might be doing a live capture in Wireshark;
 
 in which case packets might be prematurely considered "the last packet".
 #if 0 the no-longer-working tests, pending figuring out a better way of
 doing it.

Directory: /trunk/epan/dissectors/
  Changes    Path            Action
  +11 -2     packet-tcp.c    Modified

Directory: /trunk/epan/
  Changes    Path            Action
  +0 -2      frame_data.c    Modified
  +0 -2      frame_data.h    Modified

Directory: /trunk/gtk/
  Changes    Path                 Action
  +1 -1      new_packet_list.c    Modified

Directory: /trunk/
  Changes    Path                  Action
  +222 -62   cfile.c               Modified
  +24 -17    cfile.h               Modified
  +31 -65    file.c                Modified
  +21 -23    packet-range.c        Modified
  +4 -1      proto_hier_stats.c    Modified
  +6 -9      summary.c             Modified
  +14 -21    tshark.c              Modified