[openrtm-commit:03303] r3269 - trunk/OpenRTM-aist/src/lib/rtm
openrtm @ openrtm.org
openrtm @ openrtm.org
2018年 3月 28日 (水) 12:50:22 JST
Author: miyamoto
Date: 2018-03-28 12:50:22 +0900 (Wed, 28 Mar 2018)
New Revision: 3269
Modified:
trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h
trunk/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.cpp
trunk/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.h
Log:
[merge] r3178-3180 have been merged from RELENG_1_2.
Modified: trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h 2018-03-28 03:43:20 UTC (rev 3268)
+++ trunk/OpenRTM-aist/src/lib/rtm/DefaultConfiguration.h 2018-03-28 03:50:22 UTC (rev 3269)
@@ -45,7 +45,6 @@
"manager.name", "manager",
"manager.naming_formats", "%h.host_cxt/%n.mgr",
"manager.pid", "",
- "manager.refstring_path", "/var/log/rtcmanager.ref",
"os.name", "",
"os.release", "",
"os.version", "",
Modified: trunk/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.cpp
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.cpp 2018-03-28 03:43:20 UTC (rev 3268)
+++ trunk/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.cpp 2018-03-28 03:50:22 UTC (rev 3269)
@@ -21,6 +21,7 @@
#ifdef RTM_OS_LINUX
#define _GNU_SOURCE
#include <pthread.h>
+#include <algorithm>
#endif // RTM_OS_LINUX
#include <coil/Time.h>
#include <coil/TimeValue.h>
@@ -123,39 +124,32 @@
RTC_TRACE(("svc()"));
int count(0);
-#ifdef RTM_OS_LINUX
- pthread_t tid(pthread_self());
- cpu_set_t cpu_set;
- CPU_ZERO(&cpu_set);
+ bool result = coil::setThreadCpuAffinity(m_cpu);
- for (size_t i(0); i < m_cpu.size(); ++i)
+ if (!result)
{
- RTC_DEBUG(("CPU affinity mask set to %d", m_cpu[i]));
- CPU_SET(m_cpu[i], &cpu_set);
- }
-
- int result = pthread_setaffinity_np(tid, sizeof(cpu_set_t), &cpu_set);
- if (result != 0)
- {
- RTC_ERROR(("pthread_getaffinity_np():"
+ RTC_ERROR(("setThreadCpuAffinity():"
"CPU affinity mask setting failed"));
- }
- CPU_ZERO(&cpu_set);
- tid = pthread_self();
- result = pthread_getaffinity_np(tid, sizeof(cpu_set_t), &cpu_set);
- if (result != 0)
- {
- RTC_ERROR(("pthread_getaffinity_np(): returned error."));
- }
- for (size_t j(0); j < CPU_SETSIZE; ++j)
- {
- if (CPU_ISSET(j, &cpu_set))
- {
- RTC_DEBUG(("Current CPU affinity mask is %d.", j));
- }
- }
-#endif // RTM_OS_LINUX
+ };
+
+ coil::CpuMask ret_cpu;
+ result = coil::getThreadCpuAffinity(ret_cpu);
+
+
+#ifdef RTM_OS_LINUX
+ std::sort(ret_cpu.begin(), ret_cpu.end());
+ std::sort(m_cpu.begin(), m_cpu.end());
+ if (result && ret_cpu.size() == ret_cpu.size() && std::equal(ret_cpu.cbegin(), ret_cpu.cend(), m_cpu.cbegin()))
+ {
+
+ }
+ else
+ {
+ RTC_ERROR(("pthread_getaffinity_np(): returned error."));
+ }
+#endif
+
do
{
ExecutionContextBase::invokeWorkerPreDo();
Modified: trunk/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.h
===================================================================
--- trunk/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.h 2018-03-28 03:43:20 UTC (rev 3268)
+++ trunk/OpenRTM-aist/src/lib/rtm/PeriodicExecutionContext.h 2018-03-28 03:50:22 UTC (rev 3269)
@@ -25,6 +25,7 @@
#include <coil/Task.h>
#include <coil/Mutex.h>
#include <coil/Condition.h>
+#include <coil/Affinity.h>
#include <rtm/ExecutionContextBase.h>
@@ -716,7 +717,7 @@
/*!
* @brief CPU affinity mask list
*/
- std::vector<int> m_cpu;
+ coil::CpuMask m_cpu;
}; // class PeriodicExecutionContext
}; // namespace RTC
openrtm-commit メーリングリストの案内