patchlwIP - A Lightweight TCP/IP stack - Patches: patch #6483, Stats module improvement


You are not allowed to post comments on this tracker with your current authentication level.

patch #6483: Stats module improvement

Submitted by:  Frédéric Bernon <fbernon>
Submitted on:  Sun 30 Mar 2008 08:53:03 AM UTC  
Category:  None Priority:  5 - Normal
Status:  Done Privacy:  Public
Assigned to:  Simon Goldschmidt <goldsimon> Open/Closed:  Closed
Planned Release:  None

Mon 30 Jun 2008 03:18:17 PM UTC, comment #4: 

Thanks for that Simon, nice!

Since the stats are primarily for use during development rather than production code, I can also live with it.

Jonathan Larmour <jifl>
Project Member
Fri 27 Jun 2008 06:44:36 PM UTC, comment #3: 

Checked in. Regarding the protocol-specific stats fields (I have not changed anything there except removing the rexmit field): Since we are talking about ~ 32 counters we could save (which amounts to 64 or bytes), at least I can live with that!

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Fri 27 Jun 2008 06:23:57 PM UTC, comment #2: 

Since noone seems to disagree, I'll check it in now...  - for now, without the change from UDP_STATS_INC(udp.recv) to UDP_STATS_INC(recv)

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Thu 19 Jun 2008 06:05:31 PM UTC, comment #1: 

I propose a number of changes in attached patch files.

Some changes to stats.h:
- remove rexmit member in struct stats_proto
- introduce defines like TCP_STATS_DISPLAY() to display stats for a specific protocol (or mem, heap, sys...)
- introduce defines for SYS/MEM/MEMP (used #if's and directly accessed struct before

and in stats.c:
- added functions to display memp and sys (for the macros)
- stats_display() uses the macros defined in stats.h

Additionally, I change the format of the defines. Previously, the code using them looked like this:


I removed the 'udp.'-part, which is redundant:


I attach a patch file for stats.h/.c each and a patch file for the complete src directory (because of the last change).

(file #15873, file #15874, file #15875)

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Sun 30 Mar 2008 08:53:03 AM UTC, original submission:  

In patch #6459, we have talk to some changes to do in stats module. I list them here:

- some protocols needs some specific stats fields. add them in the stats_proto will increase the memory needs, and there is already some fields in this struct which are specific to only some protocols, and increase the struct size for all others.

xmit (icmp.c, ip.c, ip_frag.c, icmp6.c, ip6.c, tcp_out.c, udp.c, ppp.c, etharp.c) ~6 modules
rexmit (not used?) 0 modules
recv (used in icmp.c, ip.c, ip_frag.c, icmp6.c, ip6.c, tcp_in.c, udp.c, ppp.c, etharp.c, slipif.c) ~6 modules
fw (used in ip.c and ip6.c) ~1 module
drop (used in icmp.c, ip.c, ip_frag.c, icmp6.c, ip6.c, tcpin.c, udp.c, ppp.c, etharp.c, slipif.c) ~6 modules
chkerr (used in icmp.c, igmp.c, ip.c, icmp6.c, tcp_in.c, udp.c, ppp.c) ~6 modules
lenerr (used in icmp.c, igmp.c, ip.c, icmp6.c, tcp_in.c, udp.c, ppp.c, ppp_oe.c, etharp.c) ~6 modules
memerr (used in ip_frag.c, tcp_in.c, tcp_out.c, ppp.c, etharp.c) ~3 modules
rterr (used in ip.c, ip6.c, udp.c, ppp.c) ~3 modules
proterr (used in icmp.c, ip.c, icmp6.c, ip6.c, tcp_in.c, udp.c, ppp.c, etharp.c) ~5 modules
opterr (used in ip.c and ppp.c) ~2 modules
err (used in icmp.c, ip.c, ip_frag.c, ip6.c, tcp_out.c, ppp.c, etharp.c) ~5 modules
cachehit (used in ip_frag.c, udp.c, etharp.c) ~3 modules

There is 8 "proto" stats modules (7+1 for igmp). We could improve a little bit the memory use for that.

- the stats_display function display all stats, and we can't really use it in a production code. We need to find a solution to choose which informations are displayed. In patch #6459, I wrote :

I think it would be good to add a function
stats_display_proto(struct stats_proto) or something to selectively display
the stats of one protocol only instead of displaying all. Only the current
functions are not nice enough for that.

yes, I think we could have some defines like ...

#define STATSDISPLAY_LINK   0x00000001
#define STATSDISPLAY_ETHARP 0x00000002
#define STATSDISPLAY_IPFRAG 0x00000004

add change the stats_display prototype with a "u32_t flags" parameter, or add
a stats_display_with_flags function and make stats_display as a macro.

- SYS_STATS can't be displayed.

Frédéric Bernon <fbernon>
Project Member


Attached Files
file #15873:  stats.h.patch added by goldsimon (5KiB - text/x-patch)
file #15874:  stats.c.patch added by goldsimon (3KiB - text/x-patch)
file #15875:  stats_complete.patch added by goldsimon (47KiB - text/x-patch)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jifl (Posted a comment)
  • -email is unavailable- added by goldsimon (Updated the item)
  • -email is unavailable- added by fbernon (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.




    Follow 6 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2008-06-27 goldsimon Open/ClosedOpen => Closed
    2008-06-27 goldsimon StatusNone => Done
        Assigned toNone => goldsimon
    2008-06-19 goldsimon Attached File- => Added stats.h.patch, #15873
        Attached File- => Added stats.c.patch, #15874
        Attached File- => Added stats_complete.patch, #15875

    Back to the top

    Powered by Savane 3.5