Commit 70acf790 authored by Alejandro Homs Puron's avatar Alejandro Homs Puron
Browse files

Add GlobalCPUAffinity::acq, replacing obsolete model_threads

parent 3324529d
......@@ -575,12 +575,11 @@ inline CPUAffinity RecvCPUAffinityList_all(const RecvCPUAffinityList& l,
struct GlobalCPUAffinity {
RecvCPUAffinityList recv;
CPUAffinityList model_threads;
CPUAffinity acq;
CPUAffinity lima;
CPUAffinity other;
NetDevGroupCPUAffinityList netdev;
GlobalCPUAffinity();
CPUAffinity all() const;
void updateRecvAffinity(CPUAffinity a);
};
......@@ -667,7 +666,7 @@ class GlobalCPUAffinityMgr
void setLimaAffinity(CPUAffinity lima_affinity);
void setRecvAffinity(const RecvCPUAffinityList& recv_affinity_list);
void setModelAffinity(const CPUAffinityList& model_affinity_list);
void setAcqAffinity(CPUAffinity acq_affinity);
AutoMutex lock()
{ return AutoMutex(m_cond.mutex()); }
......
......@@ -314,6 +314,7 @@ private:
TimeRangesChangedCallback *m_time_ranges_cb;
PixelDepthCPUAffinityMap m_cpu_affinity_map;
GlobalCPUAffinityMgr m_global_cpu_affinity_mgr;
CPUAffinity m_acq_thread_cpu_affinity;
AutoPtr<AcqThread> m_acq_thread;
};
......
......@@ -398,12 +398,11 @@ SlsDetector::CPUAffinity RecvCPUAffinityList_all(
struct GlobalCPUAffinity {
SlsDetector::RecvCPUAffinityList recv;
SlsDetector::CPUAffinityList model_threads;
SlsDetector::CPUAffinity acq;
SlsDetector::CPUAffinity lima;
SlsDetector::CPUAffinity other;
SlsDetector::NetDevGroupCPUAffinityList netdev;
GlobalCPUAffinity();
SlsDetector::CPUAffinity all() const;
};
......
......@@ -1485,11 +1485,6 @@ RecvCPUAffinity& RecvCPUAffinity::operator =(CPUAffinity a)
return *this;
}
GlobalCPUAffinity::GlobalCPUAffinity()
: model_threads(1)
{
}
CPUAffinity GlobalCPUAffinity::all() const
{
return (RecvCPUAffinityList_all(recv) |
......@@ -1672,7 +1667,7 @@ void GlobalCPUAffinityMgr::applyAndSet(const GlobalCPUAffinity& o)
setLimaAffinity(o.lima);
setRecvAffinity(o.recv);
setModelAffinity(o.model_threads);
setAcqAffinity(o.acq);
if (!m_system_mgr)
m_system_mgr = new SystemCPUAffinityMgr();
......@@ -1720,16 +1715,16 @@ void GlobalCPUAffinityMgr::setRecvAffinity(
m_curr.recv = recv_affinity_list;
}
void GlobalCPUAffinityMgr::setModelAffinity(
const CPUAffinityList& model_affinity_list)
void GlobalCPUAffinityMgr::setAcqAffinity(CPUAffinity acq_affinity)
{
DEB_MEMBER_FUNCT();
DEB_PARAM() << DEB_VAR1(model_affinity_list);
DEB_PARAM() << DEB_VAR1(acq_affinity);
if (model_affinity_list == m_curr.model_threads)
if (acq_affinity == m_curr.acq)
return;
m_curr.model_threads = model_affinity_list;
m_cam->m_acq_thread_cpu_affinity = acq_affinity;
m_curr.acq = acq_affinity;
}
void GlobalCPUAffinityMgr::updateRecvRestart()
......@@ -1834,7 +1829,7 @@ void GlobalCPUAffinityMgr::limaFinished()
<< m_set.lima;
setLimaAffinity(m_set.lima);
setRecvAffinity(m_set.recv);
setModelAffinity(m_set.model_threads);
setAcqAffinity(m_set.acq);
}
m_state = Ready;
......
......@@ -127,6 +127,13 @@ void Camera::AcqThread::start(AutoMutex& l)
while (m_state == Starting)
m_cond.wait();
const CPUAffinity& acq_affinity = m_cam->m_acq_thread_cpu_affinity;
if (!acq_affinity.isDefault()) {
DEB_ALWAYS() << "Setting CPUAffinity for AcqThread to "
<< acq_affinity;
acq_affinity.applyToTask(getThreadID(), false, false);
}
}
void Camera::AcqThread::stop(AutoMutex& l, bool wait)
......
......@@ -377,7 +377,7 @@ class SlsDetector(PyTango.Device_4Impl):
self.expandPixelDepthRefs(aff_map_raw)
aff_map = {}
for pixel_depth, aff_data in aff_map_raw.items():
recv_aff, model_threads, lima, other, netdev_aff = aff_data
recv_aff, acq, lima, other, netdev_aff = aff_data
global_aff = GlobalCPUAffinity()
recv_list = []
for listeners in recv_aff:
......@@ -385,7 +385,7 @@ class SlsDetector(PyTango.Device_4Impl):
recv.listeners = list(listeners)
recv_list.append(recv)
global_aff.recv = recv_list
global_aff.model_threads = list(model_threads)
global_aff.acq = acq
global_aff.lima = lima
global_aff.other = other
ng_aff_list = []
......@@ -425,7 +425,7 @@ class SlsDetector(PyTango.Device_4Impl):
for r in global_aff.recv:
recv_list.append(r.listeners)
recv_str = aff_2_str(recv_list)
model_threads_str = aff_2_str(global_aff.model_threads)
acq_str = aff_2_str(global_aff.acq)
lima_str = aff_2_str(global_aff.lima)
other_str = aff_2_str(global_aff.other)
netdev_grp_list = []
......@@ -439,9 +439,8 @@ class SlsDetector(PyTango.Device_4Impl):
netdev_grp_list.append(netdev_str)
netdev_grp_str = '(%s)' % ', '.join(netdev_grp_list)
aff_str = '%d: (%s, %s, %s, %s, %s)' % (pixel_depth, recv_str,
model_threads_str,
lima_str, other_str,
netdev_grp_str)
acq_str, lima_str,
other_str, netdev_grp_str)
pixel_depth_aff_list.append(aff_str)
return '{%s}' % ', '.join(pixel_depth_aff_list)
......@@ -476,10 +475,8 @@ class SlsDetector(PyTango.Device_4Impl):
s = "Recv[%d]:" % i
s += " listeners=%s" % [A(x) for x in r.listeners]
deb.Always(' ' + s)
model_threads = global_aff.model_threads
deb.Always(' ModelThreads=%s' % [A(x) for x in model_threads])
lima, other = global_aff.lima, global_aff.other
deb.Always(' Lima=%s, Other=%s' % (A(lima), A(other)))
acq, lima, other = global_aff.acq, global_aff.lima, global_aff.other
deb.Always(' Acq=%s, Lima=%s, Other=%s' % (A(acq), A(lima), A(other)))
for netdev_grp in global_aff.netdev:
s = "NetDevGroup[%s]: {" % ','.join(netdev_grp.name_list)
l = []
......@@ -541,9 +538,9 @@ class SlsDetectorClass(PyTango.DeviceClass):
[PyTango.DevVarStringArray,
"Default PixelDepthCPUAffinityMap as Python string(s) defining a dict: "
"{<pixel_depth>: <global_affinity>}, being global_affinity a tuple: "
"(<recv_list>, <model_threads>, <lima>, <other>, <netdev_grp_list>), "
"(<recv_list>, <acq>, <lima>, <other>, <netdev_grp_list>), "
"where recv_list is a list of tuples of listeners affinities, "
"model_threads a tuple of affinities, lima and other are affinities, "
"acq, lima and other are affinities, "
"and netdev_grp_list is a list of tuples in the form: "
"(<comma_separated_netdev_name_list>, <rx_queue_affinity_map>), the "
"latter in the form of: {<queue>: (<irq>, <processing>)}. "
......
Markdown is supported
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