aboutsummaryrefslogtreecommitdiffstats
path: root/erts
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-04-08 15:00:06 +0200
committerBjörn Gustavsson <[email protected]>2019-04-08 16:25:01 +0200
commit9dca10bd14a3ee5b2e491e8249f3d5de7b5a116c (patch)
treed6f50ee46ecbb912fb3cf72262c3501229ab0185 /erts
parentf93862d2fe7e994523b1a6b2ca99635a4cf5bba3 (diff)
downloadotp-9dca10bd14a3ee5b2e491e8249f3d5de7b5a116c.tar.gz
otp-9dca10bd14a3ee5b2e491e8249f3d5de7b5a116c.tar.bz2
otp-9dca10bd14a3ee5b2e491e8249f3d5de7b5a116c.zip
Add erts_debug:interpreter_size/0
Add erts_debug:interpreter_size/0 for retrieving the approximate size of the BEAM interpreter (process_main()).
Diffstat (limited to 'erts')
-rw-r--r--erts/emulator/beam/beam_debug.c16
-rw-r--r--erts/emulator/beam/bif.tab1
2 files changed, 17 insertions, 0 deletions
diff --git a/erts/emulator/beam/beam_debug.c b/erts/emulator/beam/beam_debug.c
index 762c5da9be..4d52435139 100644
--- a/erts/emulator/beam/beam_debug.c
+++ b/erts/emulator/beam/beam_debug.c
@@ -353,6 +353,22 @@ erts_debug_disassemble_1(BIF_ALIST_1)
return TUPLE3(hp, addr, bin, mfa);
}
+BIF_RETTYPE
+erts_debug_interpreter_size_0(BIF_ALIST_0)
+{
+ int i;
+ BeamInstr low, high;
+
+ low = high = (BeamInstr) process_main;
+ for (i = 0; i < NUM_SPECIFIC_OPS; i++) {
+ BeamInstr a = BeamOpCodeAddr(i);
+ if (a > high) {
+ high = a;
+ }
+ }
+ return erts_make_integer(high - low, BIF_P);
+}
+
void
dbg_bt(Process* p, Eterm* sp)
{
diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab
index 34a0be4f2d..db9c258cb7 100644
--- a/erts/emulator/beam/bif.tab
+++ b/erts/emulator/beam/bif.tab
@@ -437,6 +437,7 @@ bif erts_debug:set_internal_state/2
bif erts_debug:display/1
bif erts_debug:dist_ext_to_term/2
bif erts_debug:instructions/0
+bif erts_debug:interpreter_size/0
bif erts_debug:dirty_cpu/2
bif erts_debug:dirty_io/2
bif erts_debug:dirty/3