aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_bif_info.c
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2015-11-16 14:57:12 +0100
committerLukas Larsson <[email protected]>2015-11-16 15:45:06 +0100
commit9d0a5bf2c1cc564fd38268cbb5313cd8813ea138 (patch)
tree021538f095dcde9fb51ce20e819fdc4a03a2c8d2 /erts/emulator/beam/erl_bif_info.c
parent263d1e6bb37cb09f0d09039da625f14db656f552 (diff)
downloadotp-9d0a5bf2c1cc564fd38268cbb5313cd8813ea138.tar.gz
otp-9d0a5bf2c1cc564fd38268cbb5313cd8813ea138.tar.bz2
otp-9d0a5bf2c1cc564fd38268cbb5313cd8813ea138.zip
erts: Add garbage_collection_info to process_info/2
This info request returns greater details about the current gc state. This info is not included in the default process_info/1 as it would clutter the default printout with too much information.
Diffstat (limited to 'erts/emulator/beam/erl_bif_info.c')
-rw-r--r--erts/emulator/beam/erl_bif_info.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/erts/emulator/beam/erl_bif_info.c b/erts/emulator/beam/erl_bif_info.c
index 1eb106a551..855ef8742a 100644
--- a/erts/emulator/beam/erl_bif_info.c
+++ b/erts/emulator/beam/erl_bif_info.c
@@ -589,7 +589,8 @@ static Eterm pi_args[] = {
am_min_bin_vheap_size,
am_current_location,
am_current_stacktrace,
- am_off_heap_message_queue
+ am_off_heap_message_queue,
+ am_garbage_collection_info
};
#define ERTS_PI_ARGS ((int) (sizeof(pi_args)/sizeof(Eterm)))
@@ -638,6 +639,7 @@ pi_arg2ix(Eterm arg)
case am_current_location: return 29;
case am_current_stacktrace: return 30;
case am_off_heap_message_queue: return 31;
+ case am_garbage_collection_info: return 32;
default: return -1;
}
}
@@ -1395,6 +1397,32 @@ process_info_aux(Process *BIF_P,
break;
}
+ case am_garbage_collection_info: {
+ Uint sz = 0, actual_sz = 0;
+
+ if (rp == BIF_P) {
+ sz += ERTS_PROCESS_GC_INFO_MAX_SIZE;
+ } else {
+ erts_process_gc_info(rp, &sz, NULL);
+ sz += 3;
+ }
+
+ hp = HAlloc(BIF_P, sz);
+ res = erts_process_gc_info(rp, &actual_sz, &hp);
+
+ /* We may have some extra space, fill with 0 tuples */
+ if (actual_sz <= sz - 3) {
+ for (; actual_sz < sz - 3; hp++, actual_sz++)
+ hp[0] = make_arityval(0);
+ } else {
+ for (; actual_sz < sz; hp++, actual_sz++)
+ hp[0] = make_arityval(0);
+ hp = HAlloc(BIF_P, 3);
+ }
+
+ break;
+ }
+
case am_group_leader: {
int sz = NC_HEAP_SIZE(rp->group_leader);
hp = HAlloc(BIF_P, 3 + sz);