diff options
author | Björn-Egil Dahlberg <[email protected]> | 2015-04-28 16:38:19 +0200 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2015-04-28 16:38:19 +0200 |
commit | 3ce2fe4c0e88da5ff8f50624f133e1fee9726473 (patch) | |
tree | 966ca8764a1d617eb23776594cbfd0a9727236f1 /lib/kernel | |
parent | 22173c2e4d65e47039975b91015560ae4256b3c1 (diff) | |
parent | 979d05fc326d0f6cf7c1c4a5182bb33942852dd7 (diff) | |
download | otp-3ce2fe4c0e88da5ff8f50624f133e1fee9726473.tar.gz otp-3ce2fe4c0e88da5ff8f50624f133e1fee9726473.tar.bz2 otp-3ce2fe4c0e88da5ff8f50624f133e1fee9726473.zip |
Merge branch 'egil/opt-instructions/OTP-12690'
* egil/opt-instructions/OTP-12690:
erts: Specialize minus and plus instruction
erts: Add move2 specialization for common move patterns
erts: Specialize rem instruction for common case
erts: Specialize band instruction for common case
erts: Batch loads and stores for move_window
erts: Fix loader increment from minus instruction
erts: Add move window instruction
erts: Add instruction move3 for xy and xx
erts: Specialize compare instructions
kernel: Add instruction_count helper to erts_debug
Diffstat (limited to 'lib/kernel')
-rw-r--r-- | lib/kernel/src/erts_debug.erl | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/lib/kernel/src/erts_debug.erl b/lib/kernel/src/erts_debug.erl index 17bee06b5e..8f81fcf825 100644 --- a/lib/kernel/src/erts_debug.erl +++ b/lib/kernel/src/erts_debug.erl @@ -20,7 +20,7 @@ %% Low-level debugging support. EXPERIMENTAL! --export([size/1,df/1,df/2,df/3]). +-export([size/1,df/1,df/2,df/3,ic/1]). %% This module contains the following *experimental* BIFs: %% disassemble/1 @@ -114,6 +114,19 @@ get_internal_state(_) -> instructions() -> erlang:nif_error(undef). +-spec ic(F) -> Result when + F :: function(), + Result :: term(). + +ic(F) when is_function(F) -> + Is0 = erlang:system_info(instruction_counts), + R = F(), + Is1 = erlang:system_info(instruction_counts), + Is = lists:keysort(2,[{I,C1 - C0}||{{I,C1},{I,C0}} <- lists:zip(Is1,Is0)]), + _ = [io:format("~12w ~w~n", [C,I])||{I,C}<-Is], + io:format("Total: ~w~n",[lists:sum([C||{_I,C}<-Is])]), + R. + -spec lock_counters(info) -> term(); (clear) -> ok; ({copy_save, boolean()}) -> boolean(); |