CARMA C++
WorkerPool.h
Go to the documentation of this file.
1 #ifndef CARMA_CONTROL_WORKERPOOL_H
2 #define CARMA_CONTROL_WORKERPOOL_H
3 
4 
7 
8 
9 #include <set>
10 #include <string>
11 
12 
13 struct timespec;
14 struct timeval;
15 
16 
17 namespace carma {
18 namespace util {
19  class WorkRequest;
20 } // namespace carma::util
21 
22 namespace control {
23 
26  unsigned int frameExceptions;
27  unsigned int totalExceptions;
28 
29  unsigned int instExecuteCount;
30  unsigned int instQueueCount;
31 
32  std::string frameQueueTimeMaxId;
33  unsigned int frameQueueCount;
34  unsigned int frameQueueTimeMax;
35  unsigned int frameQueueTimeMin;
36  unsigned int frameQueueTimeAvg;
37 
38  std::string totalQueueTimeMaxId;
39  unsigned int totalQueueCount;
40  unsigned int totalQueueTimeMax;
41  unsigned int totalQueueTimeMin;
42  unsigned int totalQueueTimeAvg;
43 
44  std::string frameExecuteTimeMaxId;
45  unsigned int frameExecuteCount;
46  unsigned int frameExecuteTimeMax;
47  unsigned int frameExecuteTimeMin;
48  unsigned int frameExecuteTimeAvg;
49 
50  std::string totalExecuteTimeMaxId;
51  unsigned int totalExecuteCount;
52  unsigned int totalExecuteTimeMax;
53  unsigned int totalExecuteTimeMin;
54  unsigned int totalExecuteTimeAvg;
55 };
56 
57 
63 class WorkerPool {
64  public:
66  WorkerPool( const ::std::string & id,
67  ::size_t numWorkers,
68  bool logStatsByDefault );
69 
71  virtual ~WorkerPool( );
72 
78  void queueRequestGroup(
79  const ::std::set< util::WorkRequest > & group );
80 
86  void queueRequestGroup(
87  const ::std::set< util::WorkRequest > & group,
88  bool logStats );
89 
95  void queueRequestGroup(
96  const ::std::set< util::WorkRequest > & group,
97  struct ::timeval & queueTime );
98 
104  void queueRequestGroup(
105  const ::std::set< util::WorkRequest > & group,
106  bool logStats,
107  struct ::timeval & queueTime );
108 
114  void queueRequestGroup(
115  const ::std::set< util::WorkRequest > & group,
116  struct ::timespec & queueTime );
117 
123  void queueRequestGroup(
124  const ::std::set< util::WorkRequest > & group,
125  bool logStats,
126  struct ::timespec & queueTime );
127 
132  void getStatistics(struct WorkerPoolStats &stats);
133 
134  private:
135  // No copying
136  WorkerPool( const WorkerPool & rhs );
137  WorkerPool & operator=( const WorkerPool & rhs );
138 
139  class Impl;
140 
141  Impl * impl_;
142 };
143 
144 
145 } // namespace carma::control
146 } // namespace carma
147 
148 
149 #endif
void queueRequestGroup(const ::std::set< util::WorkRequest > &group)
Queue a group of work requests for servicing.
A structure which contains statistics about the WorkerPool.
Definition: WorkerPool.h:25
A pool of workers that can have work requests queued to it for servicing.
Definition: WorkerPool.h:63
virtual ~WorkerPool()
Destruct a pool of workers.
WorkerPool(const ::std::string &id,::size_t numWorkers, bool logStatsByDefault)
Construct a pool of workers.
void getStatistics(struct WorkerPoolStats &stats)
Get statistics about this WorkerPool object.