summaryrefslogtreecommitdiff
path: root/xmake/modules/private/service/distcc_build/client_session.lua
diff options
context:
space:
mode:
authorruki <[email protected]>2022-07-30 00:51:53 +0800
committerruki <[email protected]>2022-07-30 00:51:53 +0800
commitf007e83c6fe3027b453e56d522a8dab15b8cd2bc (patch)
treeb7b9fbf2f500ca176ec244615de73d08d10847fe /xmake/modules/private/service/distcc_build/client_session.lua
parent0fc00866ab00a5713a3a86d449fd1fbc8250c7fc (diff)
improve distcc for cpu/mem
Diffstat (limited to 'xmake/modules/private/service/distcc_build/client_session.lua')
-rw-r--r--xmake/modules/private/service/distcc_build/client_session.lua13
1 files changed, 12 insertions, 1 deletions
diff --git a/xmake/modules/private/service/distcc_build/client_session.lua b/xmake/modules/private/service/distcc_build/client_session.lua
index d913878fa..2048531fc 100644
--- a/xmake/modules/private/service/distcc_build/client_session.lua
+++ b/xmake/modules/private/service/distcc_build/client_session.lua
@@ -100,9 +100,10 @@ function client_session:stream()
end
-- open session
-function client_session:open()
+function client_session:open(host_status)
assert(not self:is_opened(), "%s: has been opened!", self)
self._OPENED = true
+ self._HOST_STATUS = host_status
end
-- close session
@@ -115,6 +116,13 @@ function client_session:is_opened()
return self._OPENED
end
+-- get host status
+function client_session:host_status()
+ return self._HOST_STATUS
+end
+
+
+
-- run compilation job
function client_session:compile(sourcefile, objectfile, cppfile, cppflags, opt)
assert(self:is_opened(), "%s: has been not opened!", self)
@@ -128,6 +136,7 @@ function client_session:compile(sourcefile, objectfile, cppfile, cppflags, opt)
local cachekey = opt.cachekey
local toolchain = tool:toolchain():name()
local stream = self:stream()
+ local host_status = self:host_status()
local outdata, errdata
if stream:send_msg(message.new_compile(self:id(), toolname, toolkind, plat, arch, toolchain,
cppflags, path.filename(sourcefile), {token = self:token(), cachekey = cachekey})) and
@@ -140,6 +149,8 @@ function client_session:compile(sourcefile, objectfile, cppfile, cppflags, opt)
local body = msg:body()
outdata = body.outdata
errdata = body.errdata
+ host_status.cpurate = body.cpurate
+ host_status.memrate = body.memrate
ok = true
else
errors = msg:errors()