souffle  2.0.2-371-g6315b36
Data Structures | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes
souffle::ProfileEventSingleton Class Reference

Profile Event Singleton. More...

#include <ProfileEvent.h>

Collaboration diagram for souffle::ProfileEventSingleton:
Collaboration graph

Data Structures

class  ProfileTimer
 Profile Timer. More...
 

Public Member Functions

void dump ()
 Dump all events. More...
 
const profile::ProfileDatabase & getDB () const
 
void makeConfigRecord (const std::string &key, const std::string &value)
 create config record More...
 
void makeQuantityEvent (const std::string &txt, size_t number, int iteration)
 create quantity event More...
 
void makeTimeEvent (const std::string &txt)
 create time event More...
 
void makeTimingEvent (const std::string &txt, time_point start, time_point end, size_t startMaxRSS, size_t endMaxRSS, size_t size, size_t iteration)
 create an event for recording start and end times More...
 
void makeUtilisationEvent (const std::string &txt)
 create utilisation event More...
 
void resetTimerInterval (uint32_t interval=1)
 
void setDBFromFile (const std::string &databaseFilename)
 
void setOutputFile (std::string outputFilename)
 
void startTimer ()
 Start timer. More...
 
void stopTimer ()
 Stop timer. More...
 
 ~ProfileEventSingleton ()
 

Static Public Member Functions

static ProfileEventSingletoninstance ()
 get instance More...
 

Private Member Functions

 ProfileEventSingleton ()=default
 

Private Attributes

profile::ProfileDatabase database
 profile database More...
 
std::string filename {""}
 
ProfileTimer timer
 

Detailed Description

Profile Event Singleton.

Definition at line 50 of file ProfileEvent.h.

Constructor & Destructor Documentation

◆ ProfileEventSingleton()

souffle::ProfileEventSingleton::ProfileEventSingleton ( )
privatedefault

◆ ~ProfileEventSingleton()

souffle::ProfileEventSingleton::~ProfileEventSingleton ( )
inline

Definition at line 64 of file ProfileEvent.h.

64  {
65  profile::EventProcessorSingleton::instance().process(database, "@config", key.c_str(), value.c_str());
66  }
67 

References database, souffle::profile::EventProcessorSingleton::instance(), and souffle::profile::EventProcessorSingleton::process().

Here is the call graph for this function:

Member Function Documentation

◆ dump()

void souffle::ProfileEventSingleton::dump ( )
inline

Dump all events.

Definition at line 144 of file ProfileEvent.h.

144  {
145  timer.start();
146  }
147 
148  /** Stop timer */
149  void stopTimer() {
150  timer.stop();
151  }
152 
153  void resetTimerInterval(uint32_t interval = 1) {

References souffle::ProfileEventSingleton::ProfileTimer::start(), and timer.

Here is the call graph for this function:

◆ getDB()

const profile::ProfileDatabase& souffle::ProfileEventSingleton::getDB ( ) const
inline

Definition at line 168 of file ProfileEvent.h.

Referenced by genJsonConfiguration(), getUsageStats(), and top().

◆ instance()

static ProfileEventSingleton& souffle::ProfileEventSingleton::instance ( )
inlinestatic

get instance

Definition at line 70 of file ProfileEvent.h.

Referenced by configuration(), genJsonConfiguration(), getUsageStats(), souffle::profile::Reader::Reader(), and top().

◆ makeConfigRecord()

void souffle::ProfileEventSingleton::makeConfigRecord ( const std::string &  key,
const std::string &  value 
)
inline

create config record

Definition at line 76 of file ProfileEvent.h.

76  {
77  microseconds start_ms = std::chrono::duration_cast<microseconds>(start.time_since_epoch());
78  microseconds end_ms = std::chrono::duration_cast<microseconds>(end.time_since_epoch());

References database, souffle::profile::EventProcessorSingleton::instance(), iteration, souffle::profile::EventProcessorSingleton::process(), and TCB_SPAN_NAMESPACE_NAME::detail::size().

Here is the call graph for this function:

◆ makeQuantityEvent()

void souffle::ProfileEventSingleton::makeQuantityEvent ( const std::string &  txt,
size_t  number,
int  iteration 
)
inline

create quantity event

Definition at line 96 of file ProfileEvent.h.

114  {};

◆ makeTimeEvent()

void souffle::ProfileEventSingleton::makeTimeEvent ( const std::string &  txt)
inline

create time event

Definition at line 81 of file ProfileEvent.h.

84  {

◆ makeTimingEvent()

void souffle::ProfileEventSingleton::makeTimingEvent ( const std::string &  txt,
time_point  start,
time_point  end,
size_t  startMaxRSS,
size_t  endMaxRSS,
size_t  size,
size_t  iteration 
)
inline

create an event for recording start and end times

Definition at line 87 of file ProfileEvent.h.

89  {
90  /* current time */
91  microseconds time = std::chrono::duration_cast<microseconds>(now().time_since_epoch());
92 
93 #ifdef WIN32

References souffle::now(), and souffle::test::time().

Here is the call graph for this function:

◆ makeUtilisationEvent()

void souffle::ProfileEventSingleton::makeUtilisationEvent ( const std::string &  txt)
inline

create utilisation event

Definition at line 101 of file ProfileEvent.h.

114  {};
115  getrusage(RUSAGE_SELF, &ru);
116  /* system CPU time used */
117  uint64_t systemTime = ru.ru_stime.tv_sec * 1000000 + ru.ru_stime.tv_usec;
118  /* user CPU time used */
119  uint64_t userTime = ru.ru_utime.tv_sec * 1000000 + ru.ru_utime.tv_usec;
120  /* Maximum resident set size (kb) */
121  size_t maxRSS = ru.ru_maxrss;
122 #endif // WIN32
123 
125  database, txt.c_str(), time, systemTime, userTime, maxRSS);
126  }
127 
128  void setOutputFile(std::string outputFilename) {
129  filename = outputFilename;
130  }
131  /** Dump all events */
132  void dump() {
133  if (!filename.empty()) {
134  std::ofstream os(filename);
135  if (!os.is_open()) {
136  std::cerr << "Cannot open profile log file <" + filename + ">";
137  } else {
138  database.print(os);

◆ resetTimerInterval()

void souffle::ProfileEventSingleton::resetTimerInterval ( uint32_t  interval = 1)
inline

Definition at line 165 of file ProfileEvent.h.

166  {
167  private:

◆ setDBFromFile()

void souffle::ProfileEventSingleton::setDBFromFile ( const std::string &  databaseFilename)
inline

Definition at line 172 of file ProfileEvent.h.

172  {false};
173 
174  /** thread timer runs on */

Referenced by souffle::profile::Reader::Reader().

◆ setOutputFile()

void souffle::ProfileEventSingleton::setOutputFile ( std::string  outputFilename)
inline

Definition at line 140 of file ProfileEvent.h.

144  {

◆ startTimer()

void souffle::ProfileEventSingleton::startTimer ( )
inline

Start timer.

Definition at line 156 of file ProfileEvent.h.

156  {
157  return database;
158  }

References database.

◆ stopTimer()

void souffle::ProfileEventSingleton::stopTimer ( )
inline

Stop timer.

Definition at line 161 of file ProfileEvent.h.

164  :
165  /** Profile Timer */

Field Documentation

◆ database

profile::ProfileDatabase souffle::ProfileEventSingleton::database
private

profile database

Definition at line 58 of file ProfileEvent.h.

Referenced by makeConfigRecord(), startTimer(), and ~ProfileEventSingleton().

◆ filename

std::string souffle::ProfileEventSingleton::filename {""}
private

Definition at line 59 of file ProfileEvent.h.

◆ timer

ProfileTimer souffle::ProfileEventSingleton::timer
private

Definition at line 261 of file ProfileEvent.h.

Referenced by dump().


The documentation for this class was generated from the following file:
souffle::profile::EventProcessorSingleton::process
void process(ProfileDatabase &db, const char *txt,...)
process a profile event
Definition: EventProcessor.h:81
souffle::ProfileEventSingleton::filename
std::string filename
Definition: ProfileEvent.h:59
souffle::ProfileEventSingleton::stopTimer
void stopTimer()
Stop timer.
Definition: ProfileEvent.h:161
souffle::ProfileEventSingleton::ProfileTimer::start
void start()
start timer on the thread th
Definition: ProfileEvent.h:223
souffle::now
time_point now()
Definition: MiscUtil.h:89
souffle::ProfileEventSingleton::timer
ProfileTimer timer
Definition: ProfileEvent.h:261
souffle::ProfileEventSingleton::setOutputFile
void setOutputFile(std::string outputFilename)
Definition: ProfileEvent.h:140
souffle::ProfileEventSingleton::resetTimerInterval
void resetTimerInterval(uint32_t interval=1)
Definition: ProfileEvent.h:165
souffle::test::time
long time(const std::string &name, const Op &operation)
Definition: btree_multiset_test.cpp:411
souffle::ProfileEventSingleton::database
profile::ProfileDatabase database
profile database
Definition: ProfileEvent.h:58
souffle::ProfileEventSingleton::ProfileTimer::stop
void stop()
stop timer on the thread th
Definition: ProfileEvent.h:239
souffle::profile::EventProcessorSingleton::instance
static EventProcessorSingleton & instance()
get instance
Definition: EventProcessor.h:70
souffle::ProfileEventSingleton::dump
void dump()
Dump all events.
Definition: ProfileEvent.h:144