Skip to content

Instantly share code, notes, and snippets.

@robertoaloi
Last active July 16, 2019 13:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertoaloi/5576f79f0378c9f504b99a1731d918b5 to your computer and use it in GitHub Desktop.
Save robertoaloi/5576f79f0378c9f504b99a1731d918b5 to your computer and use it in GitHub Desktop.
-module(atom_table).
-export([count/0]).
count() ->
Info = erlang:system_info(info),
Chunks = binary:split(Info, <<"=">>, [global]),
[TabInfo] = [X || <<"index_table:atom_tab", X/binary>> <- Chunks],
Lines = binary:split(TabInfo, <<"\n">>, [global]),
Chunks2 = [binary:split(L, <<": ">>) || L <- Lines, L =/= <<>>],
binary_to_integer(proplists:get_value(<<"entries">>, Chunks2)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment