souffle  2.0.2-371-g6315b36
Public Member Functions | Private Member Functions | Private Attributes
souffle::ProfileEventSingleton::ProfileTimer Class Reference

Profile Timer. More...

Collaboration diagram for souffle::ProfileEventSingleton::ProfileTimer:
Collaboration graph

Public Member Functions

 ProfileTimer (uint32_t interval=10)
 
void resetTimerInterval (uint32_t interval=10)
 Reset timer interval. More...
 
void start ()
 start timer on the thread th More...
 
void stop ()
 stop timer on the thread th More...
 

Private Member Functions

uint32_t getInterval ()
 
void increaseInterval ()
 Increase value of time interval by factor of 2. More...
 
void run ()
 run method for thread th More...
 

Private Attributes

std::condition_variable conditionVariable
 
std::atomic< uint32_t > runCount {0}
 number of utilisation events More...
 
std::atomic< bool > running {false}
 timer is running More...
 
uint32_t t
 time interval between per utilisation read More...
 
std::thread th
 thread timer runs on More...
 
std::mutex timerMutex
 

Detailed Description

Profile Timer.

Definition at line 178 of file ProfileEvent.h.

Constructor & Destructor Documentation

◆ ProfileTimer()

souffle::ProfileEventSingleton::ProfileTimer::ProfileTimer ( uint32_t  interval = 10)
inline

Definition at line 220 of file ProfileEvent.h.

Member Function Documentation

◆ getInterval()

uint32_t souffle::ProfileEventSingleton::ProfileTimer::getInterval ( )
inlineprivate

Definition at line 204 of file ProfileEvent.h.

204  :
205  /*
206  * @param interval the size of the timing interval in milliseconds

◆ increaseInterval()

void souffle::ProfileEventSingleton::ProfileTimer::increaseInterval ( )
inlineprivate

Increase value of time interval by factor of 2.

Definition at line 209 of file ProfileEvent.h.

211  {
212  if (running) {
213  return;
214  }

References run(), running, and th.

Here is the call graph for this function:

◆ resetTimerInterval()

void souffle::ProfileEventSingleton::ProfileTimer::resetTimerInterval ( uint32_t  interval = 10)
inline

Reset timer interval.

The timer interval increases as the program executes. Resetting the interval is useful to ensure that detailed usage information is gathered even in long running programs, if desired.

Parameters
intervalthe size of the timing interval in milliseconds

Definition at line 254 of file ProfileEvent.h.

◆ run()

void souffle::ProfileEventSingleton::ProfileTimer::run ( )
inlineprivate

run method for thread th

Definition at line 196 of file ProfileEvent.h.

197  {
198  // Don't increase time interval past 60 seconds
199  if (t < 60000) {
200  t = t * 2;
201  }
202  }

References t.

Referenced by increaseInterval().

◆ start()

void souffle::ProfileEventSingleton::ProfileTimer::start ( )
inline

start timer on the thread th

Definition at line 223 of file ProfileEvent.h.

227  {
228  running = false;
229  conditionVariable.notify_all();
230  if (th.joinable()) {
231  th.join();
232  }
233  }
234 
235  /** Reset timer interval.
236  *

Referenced by souffle::ProfileEventSingleton::dump().

◆ stop()

void souffle::ProfileEventSingleton::ProfileTimer::stop ( )
inline

stop timer on the thread th

Definition at line 239 of file ProfileEvent.h.

242  {
243  t = interval;
244  runCount = 0;
245  conditionVariable.notify_all();

References conditionVariable, runCount, and t.

Field Documentation

◆ conditionVariable

std::condition_variable souffle::ProfileEventSingleton::ProfileTimer::conditionVariable
private

Definition at line 189 of file ProfileEvent.h.

Referenced by stop().

◆ runCount

std::atomic<uint32_t> souffle::ProfileEventSingleton::ProfileTimer::runCount {0}
private

number of utilisation events

Definition at line 193 of file ProfileEvent.h.

Referenced by stop().

◆ running

std::atomic<bool> souffle::ProfileEventSingleton::ProfileTimer::running {false}
private

timer is running

Definition at line 184 of file ProfileEvent.h.

Referenced by increaseInterval().

◆ t

uint32_t souffle::ProfileEventSingleton::ProfileTimer::t
private

time interval between per utilisation read

Definition at line 181 of file ProfileEvent.h.

Referenced by run(), and stop().

◆ th

std::thread souffle::ProfileEventSingleton::ProfileTimer::th
private

thread timer runs on

Definition at line 187 of file ProfileEvent.h.

Referenced by increaseInterval().

◆ timerMutex

std::mutex souffle::ProfileEventSingleton::ProfileTimer::timerMutex
private

Definition at line 190 of file ProfileEvent.h.


The documentation for this class was generated from the following file:
souffle::ProfileEventSingleton::ProfileTimer::t
uint32_t t
time interval between per utilisation read
Definition: ProfileEvent.h:181
souffle::ProfileEventSingleton::ProfileTimer::th
std::thread th
thread timer runs on
Definition: ProfileEvent.h:187
souffle::ProfileEventSingleton::ProfileTimer::conditionVariable
std::condition_variable conditionVariable
Definition: ProfileEvent.h:189
souffle::ProfileEventSingleton::ProfileTimer::runCount
std::atomic< uint32_t > runCount
number of utilisation events
Definition: ProfileEvent.h:193
souffle::ProfileEventSingleton::ProfileTimer::running
std::atomic< bool > running
timer is running
Definition: ProfileEvent.h:184