runtime_tools
Clause's runtime_tools is the application's resource and start module (OTP applications) and the modules MongooseIM's dependencies call: msacc
(rabbit_common's rabbit_runtime:msacc_stats/1) and dbg's name (hackney's and gun's debug helpers). The library
is Erlang, in library/runtime_tools/.
msacc
msacc is OTP's module over the runtime's microstate accounting
(erlang:statistics(microstate_accounting), system information):
available/0istrue;start/0,stop/0andreset/0switch and zero the accounting and return whether it was on;start/1counts from zero for the given milliseconds and stops (a bad time raisestimer:sleep/1's error with the accounting on, as OTP's).stats/0gives each thread's counters in microseconds (#{'$type' => msacc_data, type, id, counters}), ordered by type and id; Clause's threads are its workers, asschedulerthreads.stats/2computes OTP's analyses:system_realtimeandsystem_runtime(microseconds of all threads, with and withoutsleep),realtimeandruntime(each state's share of its thread and of the system, in percent; 0.0 for an empty total), andtype(counters summed per type, or shares averaged per type with system shares summed).print/0,1,2,3print OTP's tables: for counters the real-time and run-time averages (integer microseconds; no scheduler thread raisesbadarith), then each thread's and each type's shares, columns in OTP's state order (emulator,port,aux,check_io,gc,other,sleep), with#{system => true}the system share beside each;print([])raisesfunction_clause.to_file/1writesstats/0as a term,from_file/1reads it back.
Checked by the msacc_accounting golden.
dbg
dbg is declined: Clause has no tracing (erlang:trace/3,
trace_pattern/2,3 are notsup), so each of OTP's 69 functions raises {not_implemented, Name, Arity}. Code that
calls it compiles and fails only when called.
Clause