aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2017-02-16 16:06:22 +0100
committerSverker Eriksson <[email protected]>2017-02-16 16:06:22 +0100
commitc44638e4f7e88eea38b7a1144c311826c12c197f (patch)
tree6e9ee70eb0ea962be075184741e83ee2524db317 /erts/emulator/beam
parentb10b410fd37f960d4842b35bd51ea0fb0506a186 (diff)
parent808b2f4d53e446aed07f85716c5c4b85abb3d18a (diff)
downloadotp-c44638e4f7e88eea38b7a1144c311826c12c197f.tar.gz
otp-c44638e4f7e88eea38b7a1144c311826c12c197f.tar.bz2
otp-c44638e4f7e88eea38b7a1144c311826c12c197f.zip
Merge branch 'sverker/include-module-literal-size/OTP-14228' into maint
* sverker/include-module-literal-size: erts: Add size of literals to module code size
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/break.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/erts/emulator/beam/break.c b/erts/emulator/beam/break.c
index 8b772a011c..f2eda6c0f8 100644
--- a/erts/emulator/beam/break.c
+++ b/erts/emulator/beam/break.c
@@ -379,6 +379,16 @@ info(fmtfn_t to, void *to_arg)
}
+static int code_size(struct erl_module_instance* modi)
+{
+ ErtsLiteralArea* lit = modi->code_hdr->literal_area;
+ int size = modi->code_length;
+ if (lit) {
+ size += (lit->end - lit->start) * sizeof(Eterm);
+ }
+ return size;
+}
+
void
loaded(fmtfn_t to, void *to_arg)
{
@@ -399,9 +409,9 @@ loaded(fmtfn_t to, void *to_arg)
if ((modp = module_code(i, code_ix)) != NULL &&
((modp->curr.code_length != 0) ||
(modp->old.code_length != 0))) {
- cur += modp->curr.code_length;
+ cur += code_size(&modp->curr);
if (modp->old.code_length != 0) {
- old += modp->old.code_length;
+ old += code_size(&modp->old);
}
}
}
@@ -422,12 +432,12 @@ loaded(fmtfn_t to, void *to_arg)
((modp->curr.code_length != 0) ||
(modp->old.code_length != 0))) {
erts_print(to, to_arg, "%T", make_atom(modp->module));
- cur += modp->curr.code_length;
- erts_print(to, to_arg, " %d", modp->curr.code_length );
+ cur += code_size(&modp->curr);
+ erts_print(to, to_arg, " %d", code_size(&modp->curr));
if (modp->old.code_length != 0) {
erts_print(to, to_arg, " (%d old)",
- modp->old.code_length );
- old += modp->old.code_length;
+ code_size(&modp->old));
+ old += code_size(&modp->old);
}
erts_print(to, to_arg, "\n");
}
@@ -442,7 +452,7 @@ loaded(fmtfn_t to, void *to_arg)
erts_print(to, to_arg, "%T", make_atom(modp->module));
erts_print(to, to_arg, "\n");
erts_print(to, to_arg, "Current size: %d\n",
- modp->curr.code_length);
+ code_size(&modp->curr));
code = modp->curr.code_hdr;
if (code != NULL && code->attr_ptr) {
erts_print(to, to_arg, "Current attributes: ");
@@ -456,7 +466,7 @@ loaded(fmtfn_t to, void *to_arg)
}
if (modp->old.code_length != 0) {
- erts_print(to, to_arg, "Old size: %d\n", modp->old.code_length);
+ erts_print(to, to_arg, "Old size: %d\n", code_size(&modp->old));
code = modp->old.code_hdr;
if (code->attr_ptr) {
erts_print(to, to_arg, "Old attributes: ");