MIRA
|
A thread monitor class. More...
#include <thread/ThreadMonitor.h>
Classes | |
struct | ThreadInfo |
A thread information type. More... | |
Public Types | |
typedef Base::Type | Type |
Public Member Functions | |
Constructor and destructor | |
ThreadMonitor () | |
Default constructor. More... | |
virtual | ~ThreadMonitor () |
The destructor. More... | |
Add and remove threads. | |
void | addThisThread (const std::string &pName) |
Add the calling thread to the thread monitor. More... | |
void | removeThisThread () |
Remove the calling thread from the monitor. More... | |
void | removeThread (const boost::thread &pThread) |
Remove a thread from the monitor. More... | |
void | removeThread (const boost::thread::id &pThreadID) |
Remove a thread from the monitor. More... | |
void | removeThread (ThreadID pThreadID) |
Remove a thread from the monitor. More... | |
Static Public Member Functions | |
static Type & | instance () |
Returns a reference to the singleton instance. More... | |
static bool | isDestroyed () |
Returns true, if the singleton was already destroyed. More... | |
Static Protected Member Functions | |
static Type * | makeInstance () |
static void | destroyInstance (void) |
Thread information | |
typedef std::vector< ThreadInfo > | ThreadInfoVector |
Definition of a vector of thread information. More... | |
ThreadInfoVector | getThreadInformation () |
Collect information about all threads of the current process. More... | |
A thread monitor class.
A thread monitor, which collects information about the resources of all running threads.
To add a new thread to the monitor, the method addThisThread must be called within the created thread. To remove a thread, the method removeThisThread or removeThread should be called. If a thread is stopped without calling removeThisThread first, it will be automatically removed from the internal thread list when getThreadInformation() is called.
The method getThreadInformation returns a vector of all threads of the current process (not only the threads, which are added using addThisThread). For each thread, the creation time and the used CPU time in user mode and kernel mode are determined. For threads, which were added using addThisThread also the name is returned in the vector.
Example:
typedef std::vector<ThreadInfo> ThreadInfoVector |
Definition of a vector of thread information.
|
inherited |
ThreadMonitor | ( | ) |
Default constructor.
|
virtual |
The destructor.
void addThisThread | ( | const std::string & | pName | ) |
Add the calling thread to the thread monitor.
[in] | pName | The name of the thread. |
void removeThisThread | ( | ) |
Remove the calling thread from the monitor.
void removeThread | ( | const boost::thread & | pThread | ) |
Remove a thread from the monitor.
[in] | pThread | The thread, which should be removed. |
void removeThread | ( | const boost::thread::id & | pThreadID | ) |
Remove a thread from the monitor.
[in] | pThreadID | The boost thread ID. |
void removeThread | ( | ThreadID | pThreadID | ) |
Remove a thread from the monitor.
[in] | pThreadID | The native thread ID. |
ThreadInfoVector getThreadInformation | ( | ) |
Collect information about all threads of the current process.
|
inlinestaticinherited |
Returns a reference to the singleton instance.
XSingleton | If the singleton was already destroyed (dead reference) or not yet created (when using ExplicitInstantiation). |
|
inlinestaticinherited |
Returns true, if the singleton was already destroyed.
Trying to access it will result in an exception.
|
inlinestaticprotectedinherited |
|
inlinestaticprotectedinherited |