15#ifndef ML_CALL_GRAPH_H 
   16#define ML_CALL_GRAPH_H 
   24#include <boost/unordered_map.hpp> 
   61  size_t hash = boost::hash_value(
key.function);
 
   62  boost::hash_combine(
hash, 
key.file);
 
   63  boost::hash_combine(
hash, 
key.line);
 
 
   98                  void* userData = 
nullptr,
 
  100                  const std::string& nodeInfo = 
"");
 
  110  const std::vector<MLCallGraphNode*>& 
children()
 const { 
return _children; }
 
  115  inline bool isRecursive(
const MLTimeProfile* timeProfile) 
const;
 
  118  inline bool isRecursive() 
const;
 
  137  const std::string& 
nodeInfo()
 const { 
return _nodeInfo; }
 
  146  std::vector<MLCallGraphNode*> _children;
 
  150  std::string                   _nodeInfo;
 
 
  164                      int linenumber, 
int type);
 
  168  int type()
 const { 
return _type; }
 
  170  const std::string& 
name()
 const { 
return _name; }
 
  172  const std::string& 
filename()
 const { 
return _filename; }
 
  181  const std::vector<MLCallGraphNode*>& 
callGraphNodes()
 const { 
return _callGraphNodes; }
 
  227  std::vector<MLCallGraphNode*> _callGraphNodes;
 
  229  std::string                   _filename;
 
  234  TimeStatisticsMap _statisticsByTimeProfile;
 
  236  CallGraphFunctionMap _callers;
 
  237  CallGraphFunctionMap _callees;
 
 
  248    if (_function == next->_function) {
 
  251    next = next->_parent;
 
 
  262    if ( (_function == next->_function) && (
timeProfile_ == next->_timeProfile) ) {
 
  265    next = next->_parent;
 
 
void addCallGraphNode(MLCallGraphNode *node)
Adds a call graph node that represents a function call to this function.
 
const std::string & name() const
Returns the name of the function.
 
int type() const
Returns the user ID.
 
const TimeStatisticsMap & statisticsByTimeProfile() const
 
const MLTimeStatistics * statisticsByCallee(MLCallGraphFunction *callee)
Returns the statistics of the given callee.
 
const MLTimeStatistics & statistics() const
 
const MLTimeStatistics * statisticsByCaller(MLCallGraphFunction *caller)
Returns the statistics of the given caller.
 
void addCaller(MLCallGraphFunction *function, MLProfilingTimeType elapsed, MLProfilingTimeType consumed)
Adds a caller function. If it is already added, then only the statistics are updated.
 
void removeCallGraphNode(MLCallGraphNode *node)
Removes a call graph node that represents a function call to this function.
 
MLTimeStatistics & statistics(const MLTimeProfile *timeProfile)
@
 
const std::string & filename() const
Returns the filename of the function.
 
std::vector< MLCallGraphNode * > & callGraphNodes()
Returns all call graph nodes.
 
MLCallGraphFunction * getCaller(MLCallGraphFunction *caller)
Returns the caller object for the given function.
 
int linenumber() const
Returns the line number of the function.
 
MLCallGraphFunction * getCallee(MLCallGraphFunction *callee)
Returns the callee object for the given function.
 
MLTimeStatistics & statistics()
Returns the time statistics.
 
const CallGraphFunctionMap & callees() const
Returns the IDs of the functions that are called by this function.
 
MLCallGraphFunction(const std::string &name, const std::string &filename, int linenumber, int type)
 
const std::vector< MLCallGraphNode * > & callGraphNodes() const
Returns all call graph nodes.
 
const CallGraphFunctionMap & callers() const
Returns the IDs of the functions that called this function.
 
boost::unordered_map< const MLTimeProfile *, MLTimeStatistics > TimeStatisticsMap
 
bool hasStatisticsForTimeProfile(const MLTimeProfile *timeProfile) const
@
 
boost::unordered_map< MLCallGraphFunction *, MLTimeStatistics > CallGraphFunctionMap
 
const MLTimeStatistics & statistics(const MLTimeProfile *timeProfile) const
 
MLCallGraphNode * createChild(MLTimeProfile *timeProfile, const MLCallGraphFunctionPtr &function, void *userData, const std::string &nodeInfo)
 
void printTrace(std::ostream &out) const
Prints the current call graph node for tracing.
 
const std::vector< MLCallGraphNode * > & children() const
 
const MLTimeStatistics & statistics() const
Returns the time statistics of the call graph node.
 
const MLTimer & timer() const
 
bool isRecursive() const
Returns true if the node is a recursive call of its function.
 
MLCallGraphNode(MLTimeProfile *timeProfile=nullptr, MLCallGraphNode *parent=nullptr, void *userData=nullptr, const MLCallGraphFunctionPtr &callGraphFunction=MLCallGraphFunctionPtr(), const std::string &nodeInfo="")
 
void removeFromParent()
Removes the node from its parent.
 
const std::string & nodeInfo() const
Returns the node information.
 
void print(std::ostream &out, const std::string &indent="") const
 
MLCallGraphNode * parent() const
 
void clearFunctionRecursive()
 
const MLCallGraphFunctionPtr & function() const
 
const MLTimeProfile * timeProfile() const
 
void clearUserData()
Clears the user data.
 
void * userData() const
Returns the user data.
 
MLGlobalFunctionKey()
Initializes line to 0.
 
MLGlobalFunctionKey(const std::string &function_, const std::string &file_, int line_)
Initializes internal variables with the given ones.
 
bool operator==(const MLGlobalFunctionKey &other) const
 
double MLProfilingTimeType
 
size_t hash_value(MLGlobalFunctionKey const &key)
Calculates the hash key from last string segment.
 
std::shared_ptr< MLCallGraphFunction > MLCallGraphFunctionPtr
 
#define MLPROFILINGMANAGER_EXPORT
 
Target mlrange_cast(Source arg)
Generic version of checked ML casts.
 
MLProfilingTimeType minimum
 
MLProfilingTimeType maximum
 
MLProfilingTimeType total
 
void add(MLProfilingTimeType time)
 
Values & operator+=(const Values &other)
 
Time is stored in seconds.
 
MLTimeStatistics & operator+=(const MLTimeStatistics &other)