-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDebug.cpp
More file actions
34 lines (29 loc) · 807 Bytes
/
Copy pathDebug.cpp
File metadata and controls
34 lines (29 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
/****
* Sming Framework Project - Open Source framework for high efficiency native ESP8266 development.
* Created 2015 by Skurydin Alexey
* http://github.com/SmingHub/Sming
* All files of the Sming Core are provided under the LGPL v3 license.
*
* Debug.cpp
*/
#include "include/Jerryscript/Debug.h"
#include <debug_progmem.h>
namespace Jerryscript
{
bool printHeap()
{
jerry_heap_stats_t stats;
if(!jerry_heap_stats(&stats)) {
m_printf(_F("[JS] Heap stats disabled"));
return false;
}
m_printf(_F("[JS] Heap size %u, allocated %u, peak %u\r\n"), unsigned(stats.size), unsigned(stats.allocated_bytes),
unsigned(stats.peak_allocated_bytes));
return true;
}
size_t getHeapUsed()
{
HeapStats stats;
return getHeapStats(stats) ? stats.allocated_bytes : 0;
}
} // namespace Jerryscript