Skip to content

Instantly share code, notes, and snippets.

View ten0s's full-sized avatar

Dmitry Klionsky ten0s

View GitHub Profile
-module(bench).
-compile(export_all).
%% Luke Gorrie's favourite profiling macro.
-define(TIME(Tag, Expr),
(fun() ->
%% NOTE: timer:tc/4 does an annoying 'catch' so we
%% need to wrap the result in 'ok' to be able to
%% detect an unhandled exception.
{__TIME, __RESULT} =
#!/usr/bin/env escript
% -*- mode: erlang -*-
main([BeamFile]) ->
{ok,{_,[{abstract_code,{_,AC}}]}} = beam_lib:chunks(BeamFile,[abstract_code]),
io:fwrite("~s~n", [erl_prettypr:format(erl_syntax:form_list(AC))]).
@ten0s
ten0s / graph_fsm.erl
Created July 8, 2019 10:14 — forked from erszcz/graph_fsm.erl
Vance Shipley's graph_fsm - a tool for drawing Erlang gen_fsm diagrams (http://www1.erlang.org/pipermail/erlang-questions/2001-October/003716.html)
%% graph_fsm.erl
%%
%% Author: Vance Shipley, Motivity Telecom Inc. <vances@motivity.ca>
%% Date: November, 2000
%%
%%
%% This library is free software; you can redistribute it and/or
%% modify it under the terms of the GNU Lesser General Public
%% License as published by the Free Software Foundation; either
%% version 2 of the License, or (at your option) any later