C++ main module for emicrom Package  1.0
OMP_Thread.h
Go to the documentation of this file.
1 #ifndef OMP_Thread_H
2 #define OMP_Thread_H
3 
4 #include "CORE_Thread.h"
5 
6 #include "openMP.h"
7 
19 class OMP_Thread : public CORE_Thread {
21  // ATTRIBUTES
22 
23 private:
24 
26 
27  // ASSOCIATIONS
28 
29 
30 protected:
31  // METHODS
32 
33  // CONSTRUCTORS
34 
36  OMP_Thread(void);
37 
38 
39 
40  // DESTRUCTORS
41 
42 
45  virtual ~OMP_Thread(void);
46 
47 
48 public:
49  // NEW methods
52  static inline SP::OMP_Thread New() {
53  SP::OMP_Thread p(new OMP_Thread(),OMP_Thread::Delete());
54  p->setThis(p);
55  return p;
56  }
57  // SET methods
58 
63  virtual void setThreadsNumber(const tUIndex& nThreads,
64  const tBoolean& isProfiling) {
65  OMP_SET_THREADS_NUMBER(nThreads);
66  CORE_Thread::setThreadsNumber(nThreads,isProfiling);
67  }
71  virtual void setThreadsNumber(const tUIndex& nThreads) {
72  setThreadsNumber(nThreads,false);
73  }
77  virtual tBoolean isOpenMPMultiThreaded() const {
78  return OMP_IS_ENABLED();
79  }
80 
81 
82  // GET methods
83 
84 
88  virtual tUInteger getThreadId() const {
89  return OMP_GET_THREAD_ID();
90  }
94  virtual tUInteger getThreadsNumber() const;
95 
99  virtual tUInteger getMaxThreadsNumber() const;
100 
101 
105  virtual tULLInt getTime() const {
106  return OMP_GET_TIME();
107  }
111  virtual tULLInt getDuration(const tULLInt& startTime) const {
112  return getTime()-startTime;
113  }
114 
115 
116 };
117 
118 #endif
#define OMP_SET_THREADS_NUMBER(A)
Definition: openMP.h:77
virtual void setThreadsNumber(const tUIndex &nThreads, const tBoolean &isProfiling)
set the number of threads
Definition: OMP_Thread.h:63
This class describes a program routine analyser.
Definition: CORE_Thread.h:20
virtual tUInteger getThreadId() const
get the thread id
Definition: OMP_Thread.h:88
static SP::OMP_Thread New()
create an instance of thread
Definition: OMP_Thread.h:52
#define OMP_GET_THREAD_ID()
Definition: openMP.h:76
#define tUInteger
Definition: types.h:91
virtual void setThreadsNumber(const tUIndex &nThreads)
set the number of threads
Definition: OMP_Thread.h:71
SP_OBJECT(OMP_Thread)
virtual tUInteger getMaxThreadsNumber() const
get the max threads number
Definition: OMP_Thread.cpp:28
virtual tBoolean isOpenMPMultiThreaded() const
return true if the program is multithreaded by OpenMP
Definition: OMP_Thread.h:77
#define tBoolean
Definition: types.h:139
This class describes an Open MP process.
Definition: OMP_Thread.h:19
DEFINE_SPTR(OMP_Thread)
virtual ~OMP_Thread(void)
destroy an object.
Definition: OMP_Thread.cpp:12
OMP_Thread(void)
create an object
Definition: OMP_Thread.cpp:7
virtual tULLInt getTime() const
get time
Definition: OMP_Thread.h:105
#define OMP_GET_TIME()
Definition: openMP.h:79
virtual tUInteger getThreadsNumber() const
get the threads number
Definition: OMP_Thread.cpp:17
#define OMP_IS_ENABLED()
Definition: openMP.h:72
#define tUIndex
Definition: types.h:126
const tBoolean & isProfiling() const
return true if the code is profiling
Definition: CORE_Thread.h:117
virtual void setThreadsNumber(const tUIndex &nThreads, const tBoolean &isProfiling)
set the number of threads
Definition: CORE_Thread.cpp:26
#define tULLInt
Definition: types.h:45
virtual tULLInt getDuration(const tULLInt &startTime) const
get duration
Definition: OMP_Thread.h:111
class Free introduced for deleting a smart pointer
Definition: CORE_Object.h:141
static tUInteger MAX_THREADS_NUMBER
Definition: OMP_Thread.h:25