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;
220std::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 <<
"";
Profiler::ProfilerPtr getProfiler() const
getProfiler returns an instance of armarx::Profiler
The ProcessWatcher class is instantiated once in each armarx::Application an monitors thread,...
void addRunningTask(RunningTaskIceBase *threadPtr)
add RunningTask instance to this thread list
void onInitComponent() override
Pure virtual hook for the subclass.
RunningTaskList getRunningTasks(const Ice::Current &c=Ice::emptyCurrent) override
PeriodicTaskList getPeriodicTasks(const Ice::Current &c=Ice::emptyCurrent) override
bool removePeriodicTask(PeriodicTaskIceBase *threadPtr)
remove PeriodicTask instance from this thread list
Ice::StringSeq getPeriodicTaskNames(const Ice::Current &c=Ice::emptyCurrent) override
void onDisconnectComponent() override
Hook for subclass.
static ThreadListPtr getApplicationThreadList()
getApplicationThreadList retrieves the ThreadList, that contains all TimerTasks and PeriodicTasks in ...
void setApplicationThreadListName(const std::string &threadListName)
bool removeRunningTask(RunningTaskIceBase *threadPtr)
remove RunningTask instance from this thread list
void addPeriodicTask(PeriodicTaskIceBase *threadPtr)
add PeriodicTask instance to this thread list
void onConnectComponent() override
Pure virtual hook for the subclass.
Ice::StringSeq getRunningTaskNames(const Ice::Current &c=Ice::emptyCurrent) override
double getCpuUsage(const Ice::Current &c=Ice::emptyCurrent) override
This file offers overloads of toIce() and fromIce() functions for STL container types.
IceInternal::Handle< ThreadList > ThreadListPtr
ARMARXCORE_IMPORT_EXPORT ostream & operator<<(ostream &stream, const armarx::RunningTaskIceBase &task)
std::set< RunningTaskIceBase * > activeRunningTaskList
std::shared_ptr< ProcessWatcher > processWatcher
std::set< PeriodicTaskIceBase * > activePeriodicTaskList
std::mutex periodicListMutex
std::mutex procTotalTimeMutex