Finished getLoad(type)
This commit is contained in:
parent
3effcb7384
commit
03ecb47f6f
@ -74,6 +74,7 @@ Allows the user to have multi auto set priorities (Requires chronos). Also adds
|
|||||||
|
|
||||||
Added
|
Added
|
||||||
---
|
---
|
||||||
|
- STP:getLoad(type) -- returns a table where the index is the threadID and the value is the number of objects[type] running on that thread. `type`: "threads" for coroutines running or nil for all other objects running.
|
||||||
- multi:newTargetedFunction(ID, proc, name, func, holup) -- This is used internally to handle thread.hold(proxy.conn)
|
- multi:newTargetedFunction(ID, proc, name, func, holup) -- This is used internally to handle thread.hold(proxy.conn)
|
||||||
- proxy.getThreadID() -- Returns the threadID of the thread that the proxy is running in
|
- proxy.getThreadID() -- Returns the threadID of the thread that the proxy is running in
|
||||||
- proxy:getUniqueName() -- Gets the special name that identifies the object on the thread the proxy refers to
|
- proxy:getUniqueName() -- Gets the special name that identifies the object on the thread the proxy refers to
|
||||||
|
|||||||
@ -374,7 +374,7 @@ function multi:newSystemThreadedProcessor(cores)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Special functions
|
-- Special functions
|
||||||
c.getLeastLoaded = thread:newFunction(function(self, tp)
|
c.getLoad = thread:newFunction(function(self, tp)
|
||||||
local loads = {}
|
local loads = {}
|
||||||
local func
|
local func
|
||||||
|
|
||||||
@ -390,7 +390,7 @@ function multi:newSystemThreadedProcessor(cores)
|
|||||||
|
|
||||||
conn = c.jobqueue.OnJobCompleted(function(id, data)
|
conn = c.jobqueue.OnJobCompleted(function(id, data)
|
||||||
if id == jid then
|
if id == jid then
|
||||||
table.insert(loads, {v, data})
|
loads[v] = data
|
||||||
multi:newAlarm(1):OnRing(function(alarm)
|
multi:newAlarm(1):OnRing(function(alarm)
|
||||||
c.jobqueue.OnJobCompleted:Unconnect(conn)
|
c.jobqueue.OnJobCompleted:Unconnect(conn)
|
||||||
alarm:Destroy()
|
alarm:Destroy()
|
||||||
@ -400,14 +400,8 @@ function multi:newSystemThreadedProcessor(cores)
|
|||||||
end
|
end
|
||||||
|
|
||||||
thread.hold(function() return #loads == c.cores end)
|
thread.hold(function() return #loads == c.cores end)
|
||||||
if tp then
|
|
||||||
multi.print("Threads\n-------")
|
return loads
|
||||||
else
|
|
||||||
multi.print("Tasks\n-----")
|
|
||||||
end
|
|
||||||
for i,v in pairs(loads) do
|
|
||||||
print(v[1], v[2])
|
|
||||||
end
|
|
||||||
end)
|
end)
|
||||||
|
|
||||||
return c
|
return c
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user