naive-arch2 #8

Merged
zxq9 merged 2 commits from naive-arch2 into master 2025-08-11 15:18:04 +09:00
3 changed files with 20 additions and 8 deletions

View File

@ -101,16 +101,28 @@ start_link() ->
init(none) -> init(none) ->
ok = log(info, "Starting"), 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} = {Acc, Keys, Network, MaxCores, MaxMem} =
case read_conf() of case read_conf() of
{ok, C} -> {ok, C} ->
{maps:get(account, C, none), {maps:get(account, C, none),
maps:get(keys, C, []), maps:get(keys, C, []),
maps:get(network, C, <<"mainnet">>), maps:get(network, C, <<"mainnet">>),
maps:get(max_cores, C, 2), maps:get(max_cores, C, RProcs),
maps:get(max_mem, C, 3550722201)}; maps:get(max_mem, C, RMem)};
none -> none ->
{none, [], <<"mainnet">>, 2, 3550722201} {none, [], <<"mainnet">>, RProcs, RMem}
end, end,
State = #s{network = Network, acc = Acc, keys = Keys, max_cores = MaxCores, max_mem = MaxMem}, State = #s{network = Network, acc = Acc, keys = Keys, max_cores = MaxCores, max_mem = MaxMem},
{ok, start_gui(State)}. {ok, start_gui(State)}.
@ -252,7 +264,7 @@ optimize_count(MaxC, MaxM) ->
MaxMem = max(MapSize, MaxM), MaxMem = max(MapSize, MaxM),
{Procs, Memory} = proc_mem(), {Procs, Memory} = proc_mem(),
MeanMaps = min(MaxMem, Memory) div MapSize, 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, Notice = fun(F, A) -> gmc_gui:message({notice, io_lib:format(F, A)}) end,
ok = Notice("Physical Processors: ~p", [Procs]), ok = Notice("Physical Processors: ~p", [Procs]),
ok = Notice("Physical Memory: ~p", [Memory]), ok = Notice("Physical Memory: ~p", [Memory]),

View File

@ -277,7 +277,7 @@ do_message({pool_notification, #{info := #{msg := MSG}}}, State = #s{height = He
ok = wxStaticText:setLabel(CandT, Candidate), ok = wxStaticText:setLabel(CandT, Candidate),
State; State;
#{solution_accepted := #{seq := Seq}} -> #{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); do_message2(Entry, State);
Other -> Other ->
Entry = io_lib:format("~nUnexpected 'pool_notification': ~tp", [Other]), Entry = io_lib:format("~nUnexpected 'pool_notification': ~tp", [Other]),

View File

@ -5,10 +5,10 @@
{desc,"Mining client for the Gajumaru Root"}. {desc,"Mining client for the Gajumaru Root"}.
{author,"Craig Everett"}. {author,"Craig Everett"}.
{package_id,{"qpq","gajumine",{0,2,6}}}. {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}}, {"uwiger","gmcuckoo",{1,2,3}},
{"qpq","cuckoo_cpu",{0,3,0}},
{"uwiger","gmhive_worker",{0,3,0}},
{"uwiger","gmconfig",{0,1,2}}, {"uwiger","gmconfig",{0,1,2}},
{"uwiger","gproc",{1,0,1}}, {"uwiger","gproc",{1,0,1}},
{"uwiger","gmhive_protocol",{0,1,1}}, {"uwiger","gmhive_protocol",{0,1,1}},