Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable stats in lwIP config #1932

Closed
1 of 4 tasks
igrr opened this issue Apr 18, 2016 · 6 comments
Closed
1 of 4 tasks

Enable stats in lwIP config #1932

igrr opened this issue Apr 18, 2016 · 6 comments

Comments

@igrr
Copy link
Member

igrr commented Apr 18, 2016

lwIP provides some stats which may be useful to benchmark library/network performance and do some troubleshooting.
stats.h

  • check which subset of useful stats we can enable without sacrificing too much RAM (e.g. ≤ 256 bytes).
  • switch to GCC-built lwIP (Make gcc-built lwIP default one #1926)
  • enable relevant stats in lwipopts.h
  • update prebuilt lwIP binary

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@devyte
Copy link
Collaborator

devyte commented Oct 17, 2017

@igrr what is the status of this? If it's not done, maybe it should be pushed back?
Also, maybe it would make sense to make it a configurable option?

@d-a-v
Copy link
Collaborator

d-a-v commented Nov 27, 2017

@devyte, as suggested, I made some tests with lwip2.
@igrr what could be useful ?

in lwipopts.h:

#define LWIP_STATS 1
#define LWIP_STATS_LARGE 1 // enabled (32 bits counters instead of 16)
... // every stat type enabled, ```stats_display()``` function enabled

usage:

#include <lwip/stats.h>
...
stats_display();

Flash usage / Ram usage / free heap (a minute after sketch starts)

367812 / 40680 heap: 32168 (enabled + include + stats_display())
367056 / 40338 heap: 32456 (enabled + include)
367056 / 40338 heap: 32456 (enabled)
365852 / 39872 heap: 32976 (disabled)

to sum up:

enabled, no display: +466 ram +1206 flash -520 heap
enabled, stats_display() called: +808 ram +1960 flash -808 heap

The stats_display()'s output may be debugged because block titles are not shown.
I put in (...) what it should be according to what's inside the stats_output function and to my sketch (2 tcp servers, 2 long-run running tcp echo clients, 1 repeated-short-run tcp echo client)

(tcp/udp)
xmit: 0
recv: 0
fw: 0
drop: 0
chkerr: 0
lenerr: 0
memerr: 0
rterr: 0
proterr: 0
opterr: 0
err: 0
cachehit: 0

(tcp/udp)
xmit: 3
recv: 2
fw: 0
drop: 10
chkerr: 0
lenerr: 0
memerr: 0
rterr: 0
proterr: 10
opterr: 0
err: 0
cachehit: 607482

(tcp/udp)
xmit: 607490
recv: 381944
fw: 0
drop: 20
chkerr: 0
lenerr: 0
memerr: 0
rterr: 0
proterr: 0
opterr: 0
err: 0
cachehit: 0

(igmp)
xmit: 5
recv: 0
drop: 0
chkerr: 0
lenerr: 0
memerr: 0
proterr: 0
rx_v1: 0
rx_group: 0
rx_general: 0
rx_report: 0
tx_join: 2
tx_leave: 0
tx_report: 3

(tcp/udp)
xmit: 0
recv: 0
fw: 0
drop: 0
chkerr: 0
lenerr: 0
memerr: 0
rterr: 0
proterr: 0
opterr: 0
err: 0
cachehit: 0

(tcp/udp)
xmit: 4
recv: 717
fw: 0
drop: 0
chkerr: 0
lenerr: 0
memerr: 0
rterr: 0
proterr: 0
opterr: 0
err: 0
cachehit: 3

(tcp/udp)
xmit: 302679
recv: 381207
fw: 0
drop: 0
chkerr: 0
lenerr: 0
memerr: 0
rterr: 0
proterr: 0
opterr: 0
err: 0
cachehit: 152553

@devyte
Copy link
Collaborator

devyte commented Dec 18, 2017

@d-a-v

enabled, no display: +466 ram +1206 flash -520 heap
enabled, stats_display() called: +808 ram +1960 flash -808 heap

That is significant heap usage just by enabling it. I suggest making an option in the IDE to enable/disable this, and have it disabled by default. If someone wants it, it's available, but let's avoid the mem usage impact for the rest.

@igrr igrr modified the milestones: 2.4.0, 2.5.0 Dec 27, 2017
@devyte devyte modified the milestones: 2.5.0, 2.6.0 Jan 7, 2018
@d-a-v
Copy link
Collaborator

d-a-v commented Jan 7, 2018

What about documenting this in tools/sdk/lwip2/README.md ?

@devyte
Copy link
Collaborator

devyte commented Jan 8, 2018

In that case, I think it would be better to have a formal documentation, i.e.: readthedocs. Something like an lwip customization section.

@d-a-v
Copy link
Collaborator

d-a-v commented Aug 28, 2019

Closing as the way to recompile lwIP is documented.
Users who know the existence of lwIP stats will find their way to enable and recompile for them.

@d-a-v d-a-v closed this as completed Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants