Proyecto integrador para asignatura de Especialización
Revision 20:d851bc648f9e, committed 2017-11-18
- Comitter:
- Jan Jongboom
- Date:
- Sat Nov 18 13:58:34 2017 +0100
- Parent:
- 19:fbf5b033149a
- Child:
- 21:903bdf9a49f4
- Commit message:
- Remove heap stats tracking
Changed in this revision
| source/main-http.cpp | Show annotated file Show diff for this revision Revisions of this file |
| source/main-https-socket-reuse.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/source/main-http.cpp Thu Oct 26 17:08:32 2017 -0700
+++ b/source/main-http.cpp Sat Nov 18 13:58:34 2017 +0100
@@ -5,7 +5,6 @@
#include "mbed.h"
#include "easy-connect.h"
#include "http_request.h"
-#include "mbed_stats.h"
Serial pc(USBTX, USBRX);
@@ -22,11 +21,6 @@
int main() {
pc.baud(115200);
- mbed_stats_heap_t heap_stats;
-
- mbed_stats_heap_get(&heap_stats);
- printf("[1] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
// Connect to the network (see mbed_app.json for the connectivity method used)
NetworkInterface* network = easy_connect(true);
if (!network) {
@@ -34,9 +28,6 @@
return 1;
}
- mbed_stats_heap_get(&heap_stats);
- printf("[2] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
// Do a GET request to httpbin.org
{
// By default the body is automatically parsed and stored in a buffer, this is memory heavy.
@@ -55,9 +46,6 @@
delete get_req;
}
- mbed_stats_heap_get(&heap_stats);
- printf("[3] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
// POST request to httpbin.org
{
HttpRequest* post_req = new HttpRequest(network, HTTP_POST, "http://httpbin.org/post");
@@ -74,15 +62,9 @@
printf("\n----- HTTP POST response -----\n");
dump_response(post_res);
- mbed_stats_heap_get(&heap_stats);
- printf("[4] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
delete post_req;
}
- mbed_stats_heap_get(&heap_stats);
- printf("[5] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
Thread::wait(osWaitForever);
}
--- a/source/main-https-socket-reuse.cpp Thu Oct 26 17:08:32 2017 -0700
+++ b/source/main-https-socket-reuse.cpp Sat Nov 18 13:58:34 2017 +0100
@@ -9,7 +9,6 @@
#include "mbed.h"
#include "easy-connect.h"
#include "https_request.h"
-#include "mbed_stats.h"
Serial pc(USBTX, USBRX);
@@ -57,19 +56,11 @@
}
void run() {
- mbed_stats_heap_t heap_stats;
-
- mbed_stats_heap_get(&heap_stats);
- printf("[1] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
NetworkInterface* network = easy_connect(true);
if (!network) {
return;
}
- mbed_stats_heap_get(&heap_stats);
- printf("[2] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
// Create a TLS socket (which holds a TCPSocket)
printf("\n----- Setting up TLS connection -----\n");
@@ -80,9 +71,6 @@
return;
}
- mbed_stats_heap_get(&heap_stats);
- printf("[3] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
// GET request to httpbin.org
{
HttpsRequest* get_req = new HttpsRequest(socket, HTTP_GET, "https://httpbin.org/status/418");
@@ -96,15 +84,9 @@
printf("\n----- HTTPS GET response -----\n");
dump_response(get_res);
- mbed_stats_heap_get(&heap_stats);
- printf("[4a] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
delete get_req;
}
- mbed_stats_heap_get(&heap_stats);
- printf("[4b] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
// POST request to httpbin.org
{
HttpsRequest* post_req = new HttpsRequest(socket, HTTP_POST, "https://httpbin.org/post");
@@ -125,14 +107,8 @@
delete post_req;
}
- mbed_stats_heap_get(&heap_stats);
- printf("[5] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
delete socket;
- mbed_stats_heap_get(&heap_stats);
- printf("[6] Heap: %lu / %lu, max=%lu\n", heap_stats.current_size, heap_stats.reserved_size, heap_stats.max_size);
-
Thread::wait(osWaitForever);
}