naive-arch2 #8
@ -101,16 +101,28 @@ start_link() ->
|
||||
|
||||
init(none) ->
|
||||
ok = log(info, "Starting"),
|
||||
{AProcs, AMem} = proc_mem(),
|
||||
TwoMaps = default_spec(mem) * 2,
|
||||
RProcs =
|
||||
case AProcs >= 2 of
|
||||
true -> 2;
|
||||
false -> 1
|
||||
end,
|
||||
RMem =
|
||||
case AMem >= TwoMaps of
|
||||
true -> TwoMaps;
|
||||
false -> default_spec(mem)
|
||||
end,
|
||||
{Acc, Keys, Network, MaxCores, MaxMem} =
|
||||
case read_conf() of
|
||||
{ok, C} ->
|
||||
{maps:get(account, C, none),
|
||||
maps:get(keys, C, []),
|
||||
maps:get(network, C, <<"mainnet">>),
|
||||
maps:get(max_cores, C, 2),
|
||||
maps:get(max_mem, C, 3550722201)};
|
||||
maps:get(max_cores, C, RProcs),
|
||||
maps:get(max_mem, C, RMem)};
|
||||
none ->
|
||||
{none, [], <<"mainnet">>, 2, 3550722201}
|
||||
{none, [], <<"mainnet">>, RProcs, RMem}
|
||||
end,
|
||||
State = #s{network = Network, acc = Acc, keys = Keys, max_cores = MaxCores, max_mem = MaxMem},
|
||||
{ok, start_gui(State)}.
|
||||
@ -252,7 +264,7 @@ optimize_count(MaxC, MaxM) ->
|
||||
MaxMem = max(MapSize, MaxM),
|
||||
{Procs, Memory} = proc_mem(),
|
||||
MeanMaps = min(MaxMem, Memory) div MapSize,
|
||||
Recommended = min(MaxCores, max(min(Procs, MeanMaps) - 1, 1)),
|
||||
Recommended = min(MaxCores, min(Procs, MeanMaps)),
|
||||
Notice = fun(F, A) -> gmc_gui:message({notice, io_lib:format(F, A)}) end,
|
||||
ok = Notice("Physical Processors: ~p", [Procs]),
|
||||
ok = Notice("Physical Memory: ~p", [Memory]),
|
||||
|
||||
@ -277,7 +277,7 @@ do_message({pool_notification, #{info := #{msg := MSG}}}, State = #s{height = He
|
||||
ok = wxStaticText:setLabel(CandT, Candidate),
|
||||
State;
|
||||
#{solution_accepted := #{seq := Seq}} ->
|
||||
Entry = io_lib:format("~nSolution Accepted! You solved one! Sequence: ~w", [Seq]),
|
||||
Entry = io_lib:format("~nThe hive has produced a solution! Sequence: ~w", [Seq]),
|
||||
do_message2(Entry, State);
|
||||
Other ->
|
||||
Entry = io_lib:format("~nUnexpected 'pool_notification': ~tp", [Other]),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user