Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8d3d30425b | |||
| 92d061f572 | |||
| 6795c187c3 | |||
| 09ec2a8e0d | |||
| a9581291aa | |||
| 2938686b1c | |||
| bd1c779d09 | |||
| 002196059e | |||
| e86a130180 |
+1
-1
@@ -3,6 +3,6 @@
|
||||
{registered,[]},
|
||||
{included_applications,[]},
|
||||
{applications,[stdlib,kernel]},
|
||||
{vsn,"0.2.0"},
|
||||
{vsn,"0.2.5"},
|
||||
{modules,[gajumine,gmc_con,gmc_conf,gmc_gui,gmc_sup]},
|
||||
{mod,{gajumine,[]}}]}.
|
||||
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(gajumine).
|
||||
-vsn("0.2.0").
|
||||
-vsn("0.2.5").
|
||||
-behavior(application).
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||
|
||||
+30
-14
@@ -3,7 +3,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(gmc_con).
|
||||
-vsn("0.2.0").
|
||||
-vsn("0.2.5").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
@@ -205,10 +205,7 @@ do_start_stop(#s{acc = PubKey, keys = Keys, network = Network, max_cores = MaxCo
|
||||
{Fatness, Type} =
|
||||
case os:type() of
|
||||
{unix, linux} ->
|
||||
case Network of
|
||||
<<"mainnet">> -> {"mean", "avx2"};
|
||||
<<"testnet">> -> {"mean", "generic"}
|
||||
end;
|
||||
{"mean", "generic"};
|
||||
{unix, darwin} ->
|
||||
% Check memory. >7gb gets mean, <7gb gets lean
|
||||
{"mean", "generic"};
|
||||
@@ -216,10 +213,7 @@ do_start_stop(#s{acc = PubKey, keys = Keys, network = Network, max_cores = MaxCo
|
||||
% Check memory. >7gb gets mean, <7gb gets lean
|
||||
% Check avx2.
|
||||
% Both should be provided by the F# start program
|
||||
case Network of
|
||||
<<"mainnet">> -> {"mean", "avx2.exe"};
|
||||
<<"testnet">> -> {"mean", "generic.exe"}
|
||||
end
|
||||
{"mean", "generic"}
|
||||
end,
|
||||
Miner = filename:join(platform_dir(), unicode:characters_to_binary([Fatness, Bits, "-", Type])),
|
||||
Count = optimize_count(MaxCores, MaxMem),
|
||||
@@ -283,18 +277,40 @@ proc_mem() ->
|
||||
{unix, linux} ->
|
||||
{processor, Cores} = hd(erlang:system_info(cpu_topology)),
|
||||
P = length(Cores),
|
||||
M = list_to_integer(string:trim(os:cmd("cat /proc/meminfo | grep MemTotal | awk '{print $2}'"))) * 1024,
|
||||
M = s_to_i(mem, string:trim(os:cmd("cat /proc/meminfo | grep MemTotal | awk '{print $2}'"))) * 1024,
|
||||
{P, M};
|
||||
{unix, darwin} ->
|
||||
P = list_to_integer(string:trim(os:cmd("sysctl -n hw.physicalcpu"))),
|
||||
M = list_to_integer(string:trim(os:cmd("sysctl -n hw.memsize"))),
|
||||
P = s_to_i(cpu, string:trim(os:cmd("sysctl -n hw.physicalcpu"))),
|
||||
M = s_to_i(mem, string:trim(os:cmd("sysctl -n hw.memsize"))),
|
||||
{P, M};
|
||||
{win32, nt} ->
|
||||
P = list_to_integer(os:getenv("NUMBER_OF_PROCESSORS")),
|
||||
M = list_to_integer(string:strip(lists:nth(2, string:split(os:cmd("wmic computersystem get TotalPhysicalMemory"), "\r\r\n", all)))),
|
||||
P = s_to_i(cpu, os:getenv("NUMBER_OF_PROCESSORS")),
|
||||
M = win_mem(),
|
||||
{P, M}
|
||||
end.
|
||||
|
||||
s_to_i(Type, "") ->
|
||||
default_spec(Type);
|
||||
s_to_i(Type, String) ->
|
||||
case is_0_9(String) of
|
||||
true -> list_to_integer(String);
|
||||
false -> default_spec(Type)
|
||||
end.
|
||||
|
||||
is_0_9("") ->
|
||||
true;
|
||||
is_0_9([H | T]) when $0 =< H, H =< $9 ->
|
||||
is_0_9(T);
|
||||
is_0_9(_) ->
|
||||
false.
|
||||
|
||||
default_spec(cpu) -> 1;
|
||||
default_spec(mem) -> 3550722201.
|
||||
|
||||
win_mem() ->
|
||||
Out = os:cmd("powershell -Command \"(Get-CimInstance Win32_ComputerSystem).TotalPhysicalMemory\""),
|
||||
s_to_i(mem, lists:last(string:split(string:trim(Out), "\r\n", all))).
|
||||
|
||||
|
||||
do_gajudesk() ->
|
||||
ok = tell(info, "Running gajudesk"),
|
||||
|
||||
+9
-4
@@ -3,7 +3,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(gmc_conf).
|
||||
-vsn("0.2.0").
|
||||
-vsn("0.2.5").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
@@ -51,7 +51,6 @@ trouble(Info) ->
|
||||
start_link(Prefs) ->
|
||||
wx_object:start_link({local, ?MODULE}, ?MODULE, Prefs, []).
|
||||
|
||||
|
||||
init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) ->
|
||||
ok = log(info, "GUI starting..."),
|
||||
Lang = maps:get(lang, Prefs, en_US),
|
||||
@@ -70,8 +69,8 @@ init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) ->
|
||||
KeysTx = wxTextCtrl:new(Frame, ?wxID_ANY, [{style, ?wxTE_MULTILINE}, {value, keys(Keys)}]),
|
||||
_ = wxStaticBoxSizer:add(KeysSz, KeysTx, wide(5)),
|
||||
StatSz = wxStaticBoxSizer:new(?wxVERTICAL, Frame, [{label, J("Max System Committment (optional)")}]),
|
||||
AProcsS = integer_to_list(AProcs),
|
||||
MProcsS = integer_to_list(MProcs),
|
||||
AProcsS = i_to_l(AProcs),
|
||||
MProcsS = i_to_l(MProcs),
|
||||
AMemS = gigs(AMem),
|
||||
MMemS = gigs(MMem),
|
||||
Labels = [{J("HW Cores"), J("Max Cores"), AProcsS, MProcsS}, {J("Memory (GB)"), J("Max Memory"), AMemS, MMemS}],
|
||||
@@ -105,12 +104,18 @@ init({Prefs, {Net, Acc, Keys, {AProcs, AMem, MProcs, MMem}}}) ->
|
||||
{Frame, State}.
|
||||
|
||||
|
||||
i_to_l(none) -> "0";
|
||||
i_to_l(N) when is_integer(N) -> integer_to_list(N).
|
||||
|
||||
|
||||
base(Padding) -> [{proportion, 0}, {flag, ?wxEXPAND bor ?wxALL}, {border, Padding}].
|
||||
|
||||
wide(Padding) -> [{proportion, 1}, {flag, ?wxEXPAND bor ?wxALL}, {border, Padding}].
|
||||
|
||||
center() -> [{proportion, 0}, {flag, ?wxEXPAND bor ?wxALIGN_CENTER_VERTICAL}].
|
||||
|
||||
gigs(none) ->
|
||||
"0";
|
||||
gigs(Bytes) ->
|
||||
float_to_list(Bytes / gig(), [{decimals, 2}, compact]).
|
||||
|
||||
|
||||
+4
-3
@@ -3,7 +3,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(gmc_gui).
|
||||
-vsn("0.2.0").
|
||||
-vsn("0.2.5").
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||
-license("GPL-3.0-or-later").
|
||||
@@ -87,13 +87,14 @@ start_link(Title) ->
|
||||
|
||||
|
||||
init(Prefs) ->
|
||||
ok = log(info, "GUI starting..."),
|
||||
Lang = maps:get(lang, Prefs, en_US),
|
||||
Trans = gd_jt:read_translations(?MODULE),
|
||||
J = gd_jt:j(Lang, Trans),
|
||||
|
||||
AppName = J("GajuMine"),
|
||||
VSN = proplists:get_value(vsn, ?MODULE:module_info(attributes)),
|
||||
WX = wx:new(),
|
||||
Frame = wxFrame:new(WX, ?wxID_ANY, J("GajuMine")),
|
||||
Frame = wxFrame:new(WX, ?wxID_ANY, AppName ++ " v" ++ VSN),
|
||||
MainSz = wxBoxSizer:new(?wxVERTICAL),
|
||||
LeftRight = wxBoxSizer:new(?wxHORIZONTAL),
|
||||
Left = wxBoxSizer:new(?wxVERTICAL),
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@
|
||||
%%% @end
|
||||
|
||||
-module(gmc_sup).
|
||||
-vsn("0.2.0").
|
||||
-vsn("0.2.5").
|
||||
-behaviour(supervisor).
|
||||
-author("Craig Everett <craigeverett@qpq.swiss>").
|
||||
-copyright("QPQ AG <craigeverett@qpq.swiss>").
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
{prefix,"gmc"}.
|
||||
{author,"Craig Everett"}.
|
||||
{desc,"Mining client for the Gajumaru Root"}.
|
||||
{package_id,{"qpq","gajumine",{0,2,0}}}.
|
||||
{deps,[{"qpq","cuckoo_cpu",{0,3,0}},
|
||||
{"uwiger","gmhive_client",{0,4,0}},
|
||||
{"uwiger","gmcuckoo",{1,1,1}},
|
||||
{package_id,{"qpq","gajumine",{0,2,5}}}.
|
||||
{deps,[{"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}},
|
||||
|
||||
Reference in New Issue
Block a user