souffle  2.0.2-371-g6315b36
Public Member Functions | Private Attributes
souffle::profile::ProgramRun Class Reference

#include <ProgramRun.h>

Collaboration diagram for souffle::profile::ProgramRun:
Collaboration graph

Public Member Functions

std::string formatNum (int precision, long number) const
 
std::vector< std::vector< std::string > > formatTable (Table &table, int precision) const
 
std::string formatTime (std::chrono::microseconds runtime) const
 
std::chrono::microseconds getEndtime () const
 
const RelationgetRelation (const std::string &name) const
 
const std::unordered_map< std::string, std::shared_ptr< Relation > > & getRelationMap () const
 
std::set< std::shared_ptr< Relation > > getRelationsAtTime (std::chrono::microseconds start, std::chrono::microseconds end) const
 
std::string getRuntime () const
 
std::chrono::microseconds getStarttime () const
 
std::chrono::microseconds getTotalCopyTime () const
 
std::chrono::microseconds getTotalLoadtime () const
 
size_t getTotalRecursiveSize () const
 
std::chrono::microseconds getTotalSavetime () const
 
size_t getTotalSize () const
 
std::chrono::microseconds getTotalTime () const
 
 ProgramRun ()
 
void setEndtime (std::chrono::microseconds time)
 
void setRelationMap (std::unordered_map< std::string, std::shared_ptr< Relation >> &relationMap)
 
void setStarttime (std::chrono::microseconds time)
 
std::string toString ()
 

Private Attributes

std::chrono::microseconds endTime {0}
 
std::unordered_map< std::string, std::shared_ptr< Relation > > relationMap
 
std::chrono::microseconds startTime {0}
 

Detailed Description

Definition at line 31 of file ProgramRun.h.

Constructor & Destructor Documentation

◆ ProgramRun()

souffle::profile::ProgramRun::ProgramRun ( )
inline

Definition at line 38 of file ProgramRun.h.

38 : relationMap() {}

Member Function Documentation

◆ formatNum()

std::string souffle::profile::ProgramRun::formatNum ( int  precision,
long  number 
) const
inline

Definition at line 150 of file ProgramRun.h.

150  {
151  return Tools::formatNum(precision, number);
152  }

References souffle::profile::Tools::formatNum().

Here is the call graph for this function:

◆ formatTable()

std::vector<std::vector<std::string> > souffle::profile::ProgramRun::formatTable ( Table table,
int  precision 
) const
inline

Definition at line 154 of file ProgramRun.h.

154  {
155  return Tools::formatTable(table, precision);
156  }

References souffle::profile::Tools::formatTable().

Here is the call graph for this function:

◆ formatTime()

std::string souffle::profile::ProgramRun::formatTime ( std::chrono::microseconds  runtime) const
inline

Definition at line 146 of file ProgramRun.h.

146  {
147  return Tools::formatTime(runtime);
148  }

References souffle::profile::Tools::formatTime().

Referenced by getRuntime().

Here is the call graph for this function:

◆ getEndtime()

std::chrono::microseconds souffle::profile::ProgramRun::getEndtime ( ) const
inline

Definition at line 76 of file ProgramRun.h.

76  {
77  return endTime;
78  }

References endTime.

◆ getRelation()

const Relation* souffle::profile::ProgramRun::getRelation ( const std::string &  name) const
inline

Definition at line 128 of file ProgramRun.h.

128  {
129  if (relationMap.find(name) != relationMap.end()) {
130  return &(*relationMap.at(name));
131  }
132  return nullptr;
133  }

References relationMap.

◆ getRelationMap()

const std::unordered_map<std::string, std::shared_ptr<Relation> >& souffle::profile::ProgramRun::getRelationMap ( ) const
inline

Definition at line 61 of file ProgramRun.h.

61  {
62  return relationMap;
63  }

References relationMap.

◆ getRelationsAtTime()

std::set<std::shared_ptr<Relation> > souffle::profile::ProgramRun::getRelationsAtTime ( std::chrono::microseconds  start,
std::chrono::microseconds  end 
) const
inline

Definition at line 135 of file ProgramRun.h.

136  {
137  std::set<std::shared_ptr<Relation>> result;
138  for (auto& cur : relationMap) {
139  if (cur.second->getStarttime() <= end && cur.second->getEndtime() >= start) {
140  result.insert(cur.second);
141  }
142  }
143  return result;
144  }

References relationMap.

◆ getRuntime()

std::string souffle::profile::ProgramRun::getRuntime ( ) const
inline

Definition at line 65 of file ProgramRun.h.

65  {
66  if (startTime == endTime) {
67  return "--";
68  }
69  return formatTime(endTime - startTime);
70  }

References endTime, formatTime(), and startTime.

Referenced by toString().

Here is the call graph for this function:

◆ getStarttime()

std::chrono::microseconds souffle::profile::ProgramRun::getStarttime ( ) const
inline

Definition at line 72 of file ProgramRun.h.

72  {
73  return startTime;
74  }

References startTime.

◆ getTotalCopyTime()

std::chrono::microseconds souffle::profile::ProgramRun::getTotalCopyTime ( ) const
inline

Definition at line 112 of file ProgramRun.h.

112  {
113  std::chrono::microseconds result{0};
114  for (auto& item : relationMap) {
115  result += item.second->getCopyTime();
116  }
117  return result;
118  }

References relationMap.

◆ getTotalLoadtime()

std::chrono::microseconds souffle::profile::ProgramRun::getTotalLoadtime ( ) const
inline

Definition at line 80 of file ProgramRun.h.

80  {
81  std::chrono::microseconds result{0};
82  for (auto& item : relationMap) {
83  result += item.second->getLoadtime();
84  }
85  return result;
86  }

References relationMap.

◆ getTotalRecursiveSize()

size_t souffle::profile::ProgramRun::getTotalRecursiveSize ( ) const
inline

Definition at line 104 of file ProgramRun.h.

104  {
105  size_t result = 0;
106  for (auto& item : relationMap) {
107  result += item.second->getTotalRecursiveRuleSize();
108  }
109  return result;
110  }

References relationMap.

◆ getTotalSavetime()

std::chrono::microseconds souffle::profile::ProgramRun::getTotalSavetime ( ) const
inline

Definition at line 88 of file ProgramRun.h.

88  {
89  std::chrono::microseconds result{0};
90  for (auto& item : relationMap) {
91  result += item.second->getSavetime();
92  }
93  return result;
94  }

References relationMap.

◆ getTotalSize()

size_t souffle::profile::ProgramRun::getTotalSize ( ) const
inline

Definition at line 96 of file ProgramRun.h.

96  {
97  size_t result = 0;
98  for (auto& item : relationMap) {
99  result += item.second->size();
100  }
101  return result;
102  }

References relationMap.

◆ getTotalTime()

std::chrono::microseconds souffle::profile::ProgramRun::getTotalTime ( ) const
inline

Definition at line 120 of file ProgramRun.h.

120  {
121  std::chrono::microseconds result{0};
122  for (auto& item : relationMap) {
123  result += item.second->getRecTime();
124  }
125  return result;
126  }

References relationMap.

◆ setEndtime()

void souffle::profile::ProgramRun::setEndtime ( std::chrono::microseconds  time)
inline

Definition at line 44 of file ProgramRun.h.

44  {
45  endTime = time;
46  }

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

Here is the call graph for this function:

◆ setRelationMap()

void souffle::profile::ProgramRun::setRelationMap ( std::unordered_map< std::string, std::shared_ptr< Relation >> &  relationMap)
inline

Definition at line 48 of file ProgramRun.h.

48  {
49  this->relationMap = relationMap;
50  }

References relationMap.

◆ setStarttime()

void souffle::profile::ProgramRun::setStarttime ( std::chrono::microseconds  time)
inline

Definition at line 40 of file ProgramRun.h.

40  {
41  startTime = time;
42  }

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

Here is the call graph for this function:

◆ toString()

std::string souffle::profile::ProgramRun::toString ( )
inline

Definition at line 52 of file ProgramRun.h.

52  {
53  std::ostringstream output;
54  output << "ProgramRun:" << getRuntime() << "\nRelations:\n";
55  for (auto& r : relationMap) {
56  output << r.second->toString() << "\n";
57  }
58  return output.str();
59  }

References getRuntime(), and relationMap.

Here is the call graph for this function:

Field Documentation

◆ endTime

std::chrono::microseconds souffle::profile::ProgramRun::endTime {0}
private

Definition at line 35 of file ProgramRun.h.

Referenced by getEndtime(), getRuntime(), and setEndtime().

◆ relationMap

std::unordered_map<std::string, std::shared_ptr<Relation> > souffle::profile::ProgramRun::relationMap
private

◆ startTime

std::chrono::microseconds souffle::profile::ProgramRun::startTime {0}
private

Definition at line 34 of file ProgramRun.h.

Referenced by getRuntime(), getStarttime(), and setStarttime().


The documentation for this class was generated from the following file:
souffle::profile::Tools::formatTable
std::vector< std::vector< std::string > > formatTable(Table table, int precision)
Definition: StringUtils.h:145
souffle::profile::ProgramRun::formatTime
std::string formatTime(std::chrono::microseconds runtime) const
Definition: ProgramRun.h:146
souffle::profile::ProgramRun::endTime
std::chrono::microseconds endTime
Definition: ProgramRun.h:35
souffle::profile::Tools::formatNum
std::string formatNum(double amount)
Definition: StringUtils.h:40
souffle::profile::Tools::formatTime
std::string formatTime(std::chrono::microseconds number)
Definition: StringUtils.h:108
souffle::test::time
long time(const std::string &name, const Op &operation)
Definition: btree_multiset_test.cpp:411
souffle::profile::ProgramRun::startTime
std::chrono::microseconds startTime
Definition: ProgramRun.h:34
souffle::ast::DirectiveType::output
@ output
souffle::profile::ProgramRun::getRuntime
std::string getRuntime() const
Definition: ProgramRun.h:65
souffle::profile::ProgramRun::relationMap
std::unordered_map< std::string, std::shared_ptr< Relation > > relationMap
Definition: ProgramRun.h:33