Erts_debug: get_internal_state is the main method used to obtain the internal information of Erlang during runtime. However, this function is used for developers or to understand the internal details of the system, such as system tuning.
Options available in r13b04 are:
1. reds_left
2. node_and_dist_references
3. monitoring_nodes
4. next_pid
5. next_port
6. 'dbtable _ word'
7. check_io_debug
8. process_info_args
9. Processes
10. processes_bif_info
11. max_atom_out_cache_index
12. nbalance
13. available_internal_state
14. force_heap_frags
15. {process_status, PID}
16. {link_list, PID} or {link_list, port} or {link_list, nodename}
17. {monitor_list, PID} or {monitor_list, nodename}
18. {channel_number, sysname}
19. {have_pending_exit, PID}
20. {binary_info, binary}
21. {dist_port, sysname}
22. {atom_out_cache_index, Atom}
23. {fake_scheduler_bindings, how} How = SPREAD | processor_spread | thread_spread | default_bind | no_node_processor_spread | no_node_thread_spread | no_spread | unbound
The premise of using this function is to first use erts_debug: set_internal_state (available_internal_state, true). Otherwise, the call to get_internal_state will prompt failure.
Let's demonstrate:
View Source
Print?
root@ubuntu:~/otp/test# erl -sname x |
Erlang R14A (erts-5.8) [source] [smp:2:2] [rq:2] [async-threads:0] [kernel-poll:false] |
Eshell V5.8 (abort with ^G) |
(x@ubuntu)1> erts_debug:get_internal_state(check_io_debug). |
** exception error: undefined function erts_debug:get_internal_state/1 |
(x@ubuntu)2> erts_debug:set_internal_state(available_internal_state, true). |
=ERROR REPORT==== 7-Apr-2010::14:40:41 === |
Process <0.38.0> on node 'x@ubuntu' enabled access to the emulator internal state. |
NOTE: This is an erts internal test feature and should *only* be used by OTP test-suites. |
(x@ubuntu)3> erts_debug:get_internal_state(check_io_debug). |
--- fds in pollset -------------------------------------- |
fd=0 type=chr driver_select ev=IN inport=#Port<0.294> inname=tty_sl -c -e indrv=tty_sl |
fd=3 type=fifo internal ep_ev=IN |
fd=7 type=sock driver_select ev=IN inport=#Port<0.62> inname=tcp_inet indrv=tcp_inet |
fd=8 type=sock driver_select ev=IN inport=#Port<0.65> inname=tcp_inet indrv=tcp_inet |
fd=9 type=fifo driver_select ev=IN inport=#Port<0.486> inname=inet_gethost 4 indrv=spawn |
fd=10 type=sock driver_select ev=IN inport=#Port<0.492> inname=tcp_inet indrv=tcp_inet |
fd=11 type=sock driver_select ev=IN inport=#Port<0.495> inname=tcp_inet indrv=tcp_inet |
--------------------------------------------------------- |
(x@ubuntu)4> erts_debug:get_internal_state({process_status, self()}). |