27 #include "../../system/ProcessWatcher.h"
62 impl->processWatcher->start();
67 impl->processWatcher->stop();
76 std::unique_lock lock(impl->runListMutex);
77 Ice::StringSeq result;
79 for (std::set<RunningTaskIceBase*> ::const_iterator it = impl->activeRunningTaskList.begin(); it != impl->activeRunningTaskList.end(); ++it)
81 result.push_back((*it)->name);
89 std::unique_lock lock(impl->periodicListMutex);
91 Ice::StringSeq result;
93 for (std::set<PeriodicTaskIceBase*>::const_iterator it = impl->activePeriodicTaskList.begin(); it != impl->activePeriodicTaskList.end(); ++it)
95 result.push_back((*it)->name);
103 std::unique_lock lock(impl->procTotalTimeMutex);
104 return impl->processWatcher->getProcessCpuUsage().proc_total_time;
109 std::unique_lock lock(impl->runListMutex);
110 RunningTaskList resultList;
111 std::set<RunningTaskIceBase*>::const_iterator it = impl->activeRunningTaskList.begin();
113 for (; it != impl->activeRunningTaskList.end(); it++)
115 resultList.push_back(**it);
116 resultList.rbegin()->workload = impl->processWatcher->getThreadLoad((*it)->threadId);
124 std::unique_lock lock(impl->periodicListMutex);
125 PeriodicTaskList resultList;
126 std::set<PeriodicTaskIceBase*>::const_iterator it = impl->activePeriodicTaskList.begin();
128 for (; it != impl->activePeriodicTaskList.end(); it++)
130 resultList.push_back(**it);
139 std::unique_lock lock(impl->runListMutex);
140 impl->processWatcher->addThread(threadPtr->threadId);
142 if (impl->activeRunningTaskList.find(threadPtr) != impl->activeRunningTaskList.end())
147 impl->activeRunningTaskList.insert(threadPtr);
152 std::unique_lock lock(impl->runListMutex);
153 impl->processWatcher->removeThread(threadPtr->threadId);
155 if (impl->activeRunningTaskList.find(threadPtr) == impl->activeRunningTaskList.end())
160 impl->activeRunningTaskList.erase(threadPtr);
166 std::unique_lock lock(impl->periodicListMutex);
168 if (impl->activePeriodicTaskList.find(threadPtr) != impl->activePeriodicTaskList.end())
173 impl->activePeriodicTaskList.insert(threadPtr);
178 std::unique_lock lock(impl->periodicListMutex);
180 if (impl->activePeriodicTaskList.find(threadPtr) == impl->activePeriodicTaskList.end())
185 impl->activePeriodicTaskList.erase(threadPtr);
192 return applicationThreadList;
201 std::ostream&
std::operator<<(std::ostream& stream,
const armarx::RunningTaskIceBase& task)
203 stream <<
"Threadname: " << task.name <<
" \n ";
204 stream <<
"\tWorldload: " << task.workload <<
" \n ";
205 stream <<
"\tRunning: " << task.running <<
" \n ";
206 stream <<
"\tStartTime: " << IceUtil::Time::microSeconds(task.startTime).toDateTime() <<
" \n ";
207 stream <<
"\tLastFeedbackTime: " << IceUtil::Time::microSeconds(task.lastFeedbackTime).toDateTime() <<
" \n ";
208 stream <<
"\tStopped: " << task.stopped <<
" \n ";
209 stream <<
"\tFinished: " << task.finished <<
"";