Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
ea0461dc
Commit
ea0461dc
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Add option to micropython.qstr_info() to dump actual qstrs.
parent
53716fcc
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
py/modmicropython.c
+7
-2
7 additions, 2 deletions
py/modmicropython.c
py/qstr.c
+11
-0
11 additions, 0 deletions
py/qstr.c
py/qstr.h
+1
-0
1 addition, 0 deletions
py/qstr.h
with
19 additions
and
2 deletions
py/modmicropython.c
+
7
−
2
View file @
ea0461dc
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
py/qstr.c
+
11
−
0
View file @
ea0461dc
...
...
@@ -26,6 +26,7 @@
#include
<assert.h>
#include
<string.h>
#include
<stdio.h>
#include
"py/mpstate.h"
#include
"py/qstr.h"
...
...
@@ -229,3 +230,13 @@ void qstr_pool_info(mp_uint_t *n_pool, mp_uint_t *n_qstr, mp_uint_t *n_str_data_
}
*
n_total_bytes
+=
*
n_str_data_bytes
;
}
#if MICROPY_PY_MICROPYTHON_MEM_INFO
void
qstr_dump_data
(
void
)
{
for
(
qstr_pool_t
*
pool
=
MP_STATE_VM
(
last_pool
);
pool
!=
NULL
&&
pool
!=
&
const_pool
;
pool
=
pool
->
prev
)
{
for
(
const
byte
**
q
=
pool
->
qstrs
,
**
q_top
=
pool
->
qstrs
+
pool
->
len
;
q
<
q_top
;
q
++
)
{
printf
(
"Q(%s)
\n
"
,
Q_GET_DATA
(
*
q
));
}
}
}
#endif
This diff is collapsed.
Click to expand it.
py/qstr.h
+
1
−
0
View file @
ea0461dc
...
...
@@ -72,5 +72,6 @@ mp_uint_t qstr_len(qstr q);
const
byte
*
qstr_data
(
qstr
q
,
mp_uint_t
*
len
);
void
qstr_pool_info
(
mp_uint_t
*
n_pool
,
mp_uint_t
*
n_qstr
,
mp_uint_t
*
n_str_data_bytes
,
mp_uint_t
*
n_total_bytes
);
void
qstr_dump_data
(
void
);
#endif // __MICROPY_INCLUDED_PY_QSTR_H__
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment