Commit | Line | Data |
---|---|---|
caf75ed8 SK |
1 | -module(beam_stats_sup). |
2 | ||
3 | -behaviour(supervisor). | |
4 | ||
5 | %% API | |
6 | -export([start_link/0]). | |
7 | ||
8 | %% Supervisor callbacks | |
9 | -export([init/1]). | |
10 | ||
11 | %% Helper macro for declaring children of supervisor | |
12 | -define(CHILD(Type, Module), | |
13 | {Module, {Module, start_link, []}, permanent, 5000, Type, [Module]}). | |
14 | ||
15 | %% =================================================================== | |
16 | %% API functions | |
17 | %% =================================================================== | |
18 | ||
19 | start_link() -> | |
20 | supervisor:start_link({local, ?MODULE}, ?MODULE, []). | |
21 | ||
22 | %% =================================================================== | |
23 | %% Supervisor callbacks | |
24 | %% =================================================================== | |
25 | ||
26 | init([]) -> | |
27 | Children = | |
28 | [ ?CHILD(worker , beam_stats_producer) | |
29 | , ?CHILD(supervisor , beam_stats_sup_consumers) | |
30 | ], | |
31 | SupFlags = {one_for_one, 5, 10}, | |
32 | {ok, {SupFlags, Children}}. |