summaryrefslogtreecommitdiffstatshomepage
path: root/unix/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'unix/main.c')
-rw-r--r--unix/main.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/unix/main.c b/unix/main.c
index f00bf3d33a..983afd2a30 100644
--- a/unix/main.c
+++ b/unix/main.c
@@ -54,9 +54,9 @@
#include "stackctrl.h"
// Command line options, with their defaults
-bool compile_only = false;
-uint emit_opt = MP_EMIT_OPT_NONE;
-uint mp_verbose_flag;
+STATIC bool compile_only = false;
+STATIC uint emit_opt = MP_EMIT_OPT_NONE;
+mp_uint_t mp_verbose_flag = 0;
#if MICROPY_ENABLE_GC
// Heap size of GC heap (if enabled)
@@ -222,8 +222,9 @@ int usage(char **argv) {
return 1;
}
+#if MICROPY_MEM_STATS
STATIC mp_obj_t mem_info(void) {
- printf("mem: total=%d, current=%d, peak=%d\n",
+ printf("mem: total=" UINT_FMT ", current=" UINT_FMT ", peak=" UINT_FMT "\n",
m_get_total_bytes_allocated(), m_get_current_bytes_allocated(), m_get_peak_bytes_allocated());
printf("stack: " UINT_FMT "\n", mp_stack_usage());
#if MICROPY_ENABLE_GC
@@ -232,6 +233,7 @@ STATIC mp_obj_t mem_info(void) {
return mp_const_none;
}
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mem_info_obj, mem_info);
+#endif
STATIC mp_obj_t qstr_info(void) {
uint n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
@@ -325,7 +327,9 @@ int main(int argc, char **argv) {
mp_obj_list_init(mp_sys_argv, 0);
+ #if MICROPY_MEM_STATS
mp_store_name(qstr_from_str("mem_info"), (mp_obj_t*)&mem_info_obj);
+ #endif
mp_store_name(qstr_from_str("qstr_info"), (mp_obj_t*)&qstr_info_obj);
// Here is some example code to create a class and instance of that class.