mirror of
https://github.com/micropython/micropython.git
synced 2025-07-23 14:01:10 +02:00
py: Add option to micropython.qstr_info() to dump actual qstrs.
This commit is contained in:
@@ -77,14 +77,19 @@ mp_obj_t mp_micropython_mem_info(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_mem_info_obj, 0, 1, mp_micropython_mem_info);
|
||||
|
||||
STATIC mp_obj_t qstr_info(void) {
|
||||
STATIC mp_obj_t mp_micropython_qstr_info(mp_uint_t n_args, const mp_obj_t *args) {
|
||||
(void)args;
|
||||
mp_uint_t n_pool, n_qstr, n_str_data_bytes, n_total_bytes;
|
||||
qstr_pool_info(&n_pool, &n_qstr, &n_str_data_bytes, &n_total_bytes);
|
||||
printf("qstr pool: n_pool=" UINT_FMT ", n_qstr=" UINT_FMT ", n_str_data_bytes=" UINT_FMT ", n_total_bytes=" UINT_FMT "\n",
|
||||
n_pool, n_qstr, n_str_data_bytes, n_total_bytes);
|
||||
if (n_args == 1) {
|
||||
// arg given means dump qstr data
|
||||
qstr_dump_data();
|
||||
}
|
||||
return mp_const_none;
|
||||
}
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_micropython_qstr_info_obj, qstr_info);
|
||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(mp_micropython_qstr_info_obj, 0, 1, mp_micropython_qstr_info);
|
||||
|
||||
#endif // MICROPY_PY_MICROPYTHON_MEM_INFO
|
||||
|
||||
|
Reference in New Issue
Block a user