30 #include "../../system/ProcessWatcher.h"
63 impl->processWatcher->start();
69 impl->processWatcher->stop();
80 std::unique_lock lock(impl->runListMutex);
81 Ice::StringSeq result;
83 for (std::set<RunningTaskIceBase*>::const_iterator it = impl->activeRunningTaskList.begin();
84 it != impl->activeRunningTaskList.end();
87 result.push_back((*it)->name);
96 std::unique_lock lock(impl->periodicListMutex);
98 Ice::StringSeq result;
100 for (std::set<PeriodicTaskIceBase*>::const_iterator it =
101 impl->activePeriodicTaskList.begin();
102 it != impl->activePeriodicTaskList.end();
105 result.push_back((*it)->name);
114 std::unique_lock lock(impl->procTotalTimeMutex);
115 return impl->processWatcher->getProcessCpuUsage().proc_total_time;
121 std::unique_lock lock(impl->runListMutex);
122 RunningTaskList resultList;
123 std::set<RunningTaskIceBase*>::const_iterator it = impl->activeRunningTaskList.begin();
125 for (; it != impl->activeRunningTaskList.end(); it++)
127 resultList.push_back(**it);
128 resultList.rbegin()->workload = impl->processWatcher->getThreadLoad((*it)->threadId);
137 std::unique_lock lock(impl->periodicListMutex);
138 PeriodicTaskList resultList;
139 std::set<PeriodicTaskIceBase*>::const_iterator it = impl->activePeriodicTaskList.begin();
141 for (; it != impl->activePeriodicTaskList.end(); it++)
143 resultList.push_back(**it);
152 std::unique_lock lock(impl->runListMutex);
153 impl->processWatcher->addThread(threadPtr->threadId);
155 if (impl->activeRunningTaskList.find(threadPtr) != impl->activeRunningTaskList.end())
160 impl->activeRunningTaskList.insert(threadPtr);
166 std::unique_lock lock(impl->runListMutex);
167 impl->processWatcher->removeThread(threadPtr->threadId);
169 if (impl->activeRunningTaskList.find(threadPtr) == impl->activeRunningTaskList.end())
174 impl->activeRunningTaskList.erase(threadPtr);
181 std::unique_lock lock(impl->periodicListMutex);
183 if (impl->activePeriodicTaskList.find(threadPtr) != impl->activePeriodicTaskList.end())
188 impl->activePeriodicTaskList.insert(threadPtr);
194 std::unique_lock lock(impl->periodicListMutex);
196 if (impl->activePeriodicTaskList.find(threadPtr) == impl->activePeriodicTaskList.end())
201 impl->activePeriodicTaskList.erase(threadPtr);
209 return applicationThreadList;
220 std::operator<<(std::ostream& stream,
const armarx::RunningTaskIceBase& task)
222 stream <<
"Threadname: " << task.name <<
" \n ";
223 stream <<
"\tWorldload: " << task.workload <<
" \n ";
224 stream <<
"\tRunning: " << task.running <<
" \n ";
225 stream <<
"\tStartTime: " << IceUtil::Time::microSeconds(task.startTime).toDateTime() <<
" \n ";
226 stream <<
"\tLastFeedbackTime: "
227 << IceUtil::Time::microSeconds(task.lastFeedbackTime).toDateTime() <<
" \n ";
228 stream <<
"\tStopped: " << task.stopped <<
" \n ";
229 stream <<
"\tFinished: " << task.finished <<
"";