Performance problems with HTTPText. This is a test program for the problems.
Dependencies: EthernetNetIf mbed
Revision 1:20a89656f772, committed 2010-10-09
- Comitter:
- shintamainjp
- Date:
- Sat Oct 09 22:51:52 2010 +0000
- Parent:
- 0:fd0a4a9e317c
- Commit message:
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Fri Oct 08 22:06:26 2010 +0000 +++ b/main.cpp Sat Oct 09 22:51:52 2010 +0000 @@ -1,6 +1,6 @@ /** * Performance problems with HTTPText. - * + * * Copyright (C) 2010 Shinichiro Nakamura (CuBeatSystems) * http://shinta.main.jp/ */ @@ -9,6 +9,8 @@ #include "EthernetNetIf.h" #include "HTTPClient.h" +static const int ClientTimeoutMs = 1000; + EthernetNetIf netif; Timer timer; @@ -24,7 +26,9 @@ HTTPClient client; HTTPMap map; HTTPText text("text/html", bufsiz); - + + client.setTimeout(ClientTimeoutMs); + int sizelist[10] = { 8, 16, @@ -38,10 +42,10 @@ 4096 }; - printf("(Buffer size of a HTTPText : %d)\n", bufsiz); - printf("+---------+--------+----+\n"); - printf("|File size|Time[ms]|Code|\n"); - printf("+---------+--------+----+\n"); + printf("(Buffer size of a HTTPText : %d)\n", bufsiz); + printf("+---------+--------+------+--------+\n"); + printf("|File size|Time[ms]|Result|Response|\n"); + printf("+---------+--------+------+--------+\n"); for (int i = 0; i < sizeof(sizelist) / sizeof(sizelist[0]); i++) { char url[256]; sprintf(url, "http://mbed.org/media/uploads/shintamainjp/textfile_%dbytes.txt", sizelist[i]); @@ -50,9 +54,9 @@ timer.start(); HTTPResult r = client.get(url, &text); timer.stop(); - printf("|%9d|%8d|%4d|\n", sizelist[i], timer.read_ms(), client.getHTTPResponseCode()); + printf("|%9d|%8d|%6d|%8d|\n", sizelist[i], timer.read_ms(), (int)r, client.getHTTPResponseCode()); } - printf("+---------+--------+----+\n"); + printf("+---------+--------+------+--------+\n"); } /**