Merge pull request 'naive-arch2' (#8) from naive-arch2 into master
Reviewed-on: #8 Reviewed-by: Jarvis Carroll <jarviscarrol@qpq.swiss>
This commit is contained in:
commit
be63fe141b
@ -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]),
|
||||
|
||||
@ -5,10 +5,10 @@
|
||||
{desc,"Mining client for the Gajumaru Root"}.
|
||||
{author,"Craig Everett"}.
|
||||
{package_id,{"qpq","gajumine",{0,2,6}}}.
|
||||
{deps,[{"uwiger","gmhive_client",{0,4,4}},
|
||||
{deps,[{"uwiger","gmhive_worker",{0,4,0}},
|
||||
{"qpq","cuckoo_cpu",{0,3,1}},
|
||||
{"uwiger","gmhive_client",{0,4,4}},
|
||||
{"uwiger","gmcuckoo",{1,2,3}},
|
||||
{"qpq","cuckoo_cpu",{0,3,0}},
|
||||
{"uwiger","gmhive_worker",{0,3,0}},
|
||||
{"uwiger","gmconfig",{0,1,2}},
|
||||
{"uwiger","gproc",{1,0,1}},
|
||||
{"uwiger","gmhive_protocol",{0,1,1}},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user