[syslinux:lwip] lwip: show stats when displaying speedtest results

syslinux-bot for H. Peter Anvin hpa at zytor.com
Fri Apr 22 20:05:52 PDT 2011


Commit-ID:  f41a7c9225eb32379ef401a0ff419b75969e0f69
Gitweb:     http://syslinux.zytor.com/commit/f41a7c9225eb32379ef401a0ff419b75969e0f69
Author:     H. Peter Anvin <hpa at zytor.com>
AuthorDate: Fri, 18 Sep 2009 13:56:53 -0700
Committer:  Eric W. Biederman <ebiederm at xmission.com>
CommitDate: Tue, 12 Apr 2011 14:40:53 -0700

lwip: show stats when displaying speedtest results

Performance seems to be heavily inversely correlated with packet
loss...

Signed-off-by: H. Peter Anvin <hpa at zytor.com>


---
 core/fs/pxe/pxe.c |   28 +++++++++++++++++++++++++---
 1 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/core/fs/pxe/pxe.c b/core/fs/pxe/pxe.c
index 5a24917..3f84ea5 100644
--- a/core/fs/pxe/pxe.c
+++ b/core/fs/pxe/pxe.c
@@ -1000,6 +1000,24 @@ static void udp_init(void)
 }
 #endif
 
+static void undi_clear_stats(void)
+{
+    static __lowmem t_PXENV_UNDI_CLEAR_STATISTICS clear;
+
+    pxe_call(PXENV_UNDI_CLEAR_STATISTICS, &clear);
+}
+
+static void undi_stats(void)
+{
+    static __lowmem t_PXENV_UNDI_GET_STATISTICS stats;
+
+    pxe_call(PXENV_UNDI_GET_STATISTICS, &stats);
+
+    printf("UNDI: Xmit %u Rcv %u CRC %u Resource %u\n",
+	   stats.XmtGoodFrames, stats.RcvGoodFrames,
+	   stats.RcvCRCErrors, stats.RcvResourceErrors);
+}
+
 static void lwip_test(void)
 {
     err_t err;
@@ -1008,6 +1026,7 @@ static void lwip_test(void)
     char header_buf[512];
     int header_len;
     static const char host_str[] = "www3.kernel.org";
+    static const char path_str[] = "/pub/linux/kernel/v2.6/linux-2.6.31.tar.gz";
     struct netbuf *buf;
     mstime_t t0, t1;
     size_t bytes, x_bytes;
@@ -1026,7 +1045,9 @@ static void lwip_test(void)
 	   ((uint8_t *)&ip)[3],
 	   err);
 
-    for (i = 1; i < 20; i++) {
+    for (i = 1; i < 10; i++) {
+	undi_clear_stats();
+
 	conn = netconn_new(NETCONN_TCP);
 	err = netconn_connect(conn, &ip, 80);
 	if (err) {
@@ -1035,10 +1056,10 @@ static void lwip_test(void)
 	}
 	
 	header_len = snprintf(header_buf, sizeof header_buf,
-				  "GET /pub/linux/kernel/v2.6/linux-2.6.31.tar.gz HTTP/1.0\r\n"
+				  "GET %s HTTP/1.0\r\n"
 				  "Host: %s\r\n"
 				  "\r\n",
-				  host_str);
+				  path_str, host_str);
 	
 	err = netconn_write(conn, header_buf, header_len, NETCONN_NOCOPY);
 	if (err)
@@ -1091,6 +1112,7 @@ static void lwip_test(void)
 
 	printf("Done: %zu bytes in %u ms (%u.%03u Mbps)\n",
 	       bytes, ms, kbits_per_sec/1000, kbits_per_sec%1000);
+	undi_stats();
 	
 	netconn_disconnect(conn);
     }



More information about the Syslinux-commits mailing list