Commit 052b9a08 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron Committed by operator for beamline
Browse files

Add Receiver PacketStream threads (listeners) CPU affinity mask

parent c836a058
......@@ -483,12 +483,15 @@ class SystemCPUAffinityMgr
};
struct RecvCPUAffinity {
CPUAffinityList listeners;
CPUAffinityList recv_threads;
RecvCPUAffinity();
CPUAffinity all() const;
RecvCPUAffinity& operator =(CPUAffinity a);
const CPUAffinityList& Listeners() const
{ return listeners; }
const CPUAffinityList& RecvThreads() const
{ return recv_threads; }
......@@ -498,14 +501,16 @@ struct RecvCPUAffinity {
inline CPUAffinity RecvCPUAffinity::all() const
{
return CPUAffinityList_all(recv_threads);
return (CPUAffinityList_all(listeners) |
CPUAffinityList_all(recv_threads));
}
inline
bool operator ==(const RecvCPUAffinity& a, const RecvCPUAffinity& b)
{
return (a.recv_threads == b.recv_threads);
return ((a.listeners == b.listeners) &&
(a.recv_threads == b.recv_threads));
}
inline
......
......@@ -321,6 +321,7 @@ public:
};
struct RecvCPUAffinity {
SlsDetector::CPUAffinityList listeners;
SlsDetector::CPUAffinityList recv_threads;
RecvCPUAffinity();
......
Subproject commit dc8a031375ca776a481af339ff70bad0850edb5b
Subproject commit 4e8558b433ac3b8fea23189fbb19a6a37e1a8a11
......@@ -1331,12 +1331,13 @@ void SystemCPUAffinityMgr::setNetDevCPUAffinity(
}
RecvCPUAffinity::RecvCPUAffinity()
: recv_threads(1)
: listeners(1), recv_threads(1)
{
}
RecvCPUAffinity& RecvCPUAffinity::operator =(CPUAffinity a)
{
listeners.assign(1, a);
recv_threads.assign(1, a);
return *this;
}
......@@ -1746,7 +1747,7 @@ lima::SlsDetector::operator <<(ostream& os, const NetDevGroupCPUAffinity& a)
ostream& lima::SlsDetector::operator <<(ostream& os, const RecvCPUAffinity& a)
{
os << "<";
os << "recv_threads=" << a.recv_threads;
os << "listeners=" << a.listeners << ", recv_threads=" << a.recv_threads;
return os << ">";
}
......
......@@ -657,11 +657,13 @@ void Camera::setRecvCPUAffinity(const RecvCPUAffinityList& recv_affinity_list)
<< DEB_VAR2(nb_recv, nb_aff);
RecvCPUAffinityList::const_iterator ait = recv_affinity_list.begin();
for (int i = 0; i < nb_recv; ++i, ++ait) {
RecvList::iterator rit = m_recv_list.begin();
for (int i = 0; i < nb_recv; ++i, ++ait, ++rit) {
Model::Recv *recv = m_model->getRecv(i);
const RecvCPUAffinity& aff = *ait;
recv->setNbProcessingThreads(aff.recv_threads.size());
recv->setCPUAffinity(aff);
(*rit)->setCPUAffinity(aff);
}
}
......
......@@ -692,8 +692,6 @@ void Eiger::Recv::setCPUAffinity(const RecvCPUAffinity& recv_affinity)
ThreadList::iterator it, end = m_thread_list.end();
for (it = m_thread_list.begin(); it != end; ++it, ++rit)
(*it)->setCPUAffinity(*rit);
m_recv->setCPUAffinity(recv_affinity);
}
void Eiger::Recv::prepareAcq()
......
......@@ -67,6 +67,14 @@ void Receiver::setCPUAffinity(const RecvCPUAffinity& recv_affinity)
{
DEB_MEMBER_FUNCT();
const CPUAffinityList& aff_list = recv_affinity.listeners;
slsReceiverDefs::CPUMaskList cpu_masks(aff_list.size());
slsReceiverDefs::CPUMaskList::iterator mit = cpu_masks.begin();
CPUAffinityList::const_iterator it, end = aff_list.end();
for (it = aff_list.begin(); it != end; ++it, ++mit)
it->initCPUSet(*mit);
m_recv->setThreadCPUAffinity(cpu_masks);
string deb_head;
if (DEB_CHECK_ANY(DebTypeTrace) || DEB_CHECK_ANY(DebTypeWarning)) {
ostringstream os;
......
......@@ -359,8 +359,9 @@ class SlsDetector(PyTango.Device_4Impl):
recv_aff, lima, other, netdev_aff = aff_data
global_aff = GlobalCPUAffinity()
recv_list = []
for recv_threads in recv_aff:
for listeners, recv_threads in recv_aff:
recv = RecvCPUAffinity()
recv.listeners = list(listeners)
recv.recv_threads = list(recv_threads)
recv_list.append(recv)
global_aff.recv = recv_list
......@@ -401,7 +402,7 @@ class SlsDetector(PyTango.Device_4Impl):
for pixel_depth, global_aff in sorted(aff_map.items()):
recv_list = []
for r in global_aff.recv:
recv_list.append(r.recv_threads)
recv_list.append((r.listeners, r.recv_threads))
recv_str = aff_2_str(recv_list)
lima_str = aff_2_str(global_aff.lima)
other_str = aff_2_str(global_aff.other)
......@@ -450,7 +451,8 @@ class SlsDetector(PyTango.Device_4Impl):
return hex(NumAffinity(x))
for i, r in enumerate(global_aff.recv):
s = "Recv[%d]:" % i
s += " recv_threads=%s" % [A(x) for x in r.recv_threads]
s += " listeners=%s" % [A(x) for x in r.listeners]
s += ", recv_threads=%s" % [A(x) for x in r.recv_threads]
deb.Always(' ' + s)
lima, other = global_aff.lima, global_aff.other
deb.Always(' Lima=%s, Other=%s' % (A(lima), A(other)))
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment