Static Value-Flow Analysis
Public Types | Public Member Functions | Private Member Functions | Private Attributes | List of all members
SVF::SVFGStat Class Reference

#include <SVFGStat.h>

Inheritance diagram for SVF::SVFGStat:
SVF::PTAStat SVF::SVFStat

Public Types

typedef Set< const SVFGNode * > SVFGNodeSet
 
typedef OrderedSet< const SVFGEdge * > SVFGEdgeSet
 
typedef SCCDetection< SVFG * > SVFGSCC
 
- Public Types inherited from SVF::SVFStat
enum  ClockType { Wall , CPU }
 
typedef OrderedMap< std::string, u32_tNUMStatMap
 
typedef OrderedMap< std::string, double > TIMEStatMap
 

Public Member Functions

 SVFGStat (SVFG *g)
 
virtual ~SVFGStat ()
 
virtual void performStat () override
 
virtual void printStat (std::string str="") override
 
virtual void performSCCStat (SVFGEdgeSet insensitiveCalRetEdges)
 
void dirVFEdgeStart ()
 
void dirVFEdgeEnd ()
 
void indVFEdgeStart ()
 
void indVFEdgeEnd ()
 
void TLVFNodeStart ()
 
void TLVFNodeEnd ()
 
void ATVFNodeStart ()
 
void ATVFNodeEnd ()
 
void sfvgOptStart ()
 
void sfvgOptEnd ()
 
void addToSources (const SVFGNode *node)
 
void addToSinks (const SVFGNode *node)
 
void addToForwardSlice (const SVFGNode *node)
 
void addToBackwardSlice (const SVFGNode *node)
 
bool inForwardSlice (const SVFGNode *node) const
 
bool inBackwardSlice (const SVFGNode *node) const
 
bool isSource (const SVFGNode *node) const
 
bool isSink (const SVFGNode *node) const
 
- Public Member Functions inherited from SVF::PTAStat
 PTAStat (PointerAnalysis *p)
 
virtual ~PTAStat ()
 
void setMemUsageBefore (u32_t vmrss, u32_t vmsize)
 
void setMemUsageAfter (u32_t vmrss, u32_t vmsize)
 
void performStat () override
 
void callgraphStat () override
 
- Public Member Functions inherited from SVF::SVFStat
 SVFStat ()
 
virtual ~SVFStat ()
 
virtual void startClk ()
 
virtual void endClk ()
 
virtual void performStatPerQuery (NodeID)
 
virtual void printStatPerQuery (NodeID, const PointsTo &)
 

Private Member Functions

void clear ()
 
void processGraph ()
 
void calculateNodeDegrees (SVFGNode *node, NodeSet &nodeHasIndInEdge, NodeSet &nodeHasIndOutEdge)
 
NodeID getSCCRep (SVFGSCC *scc, NodeID id) const
 
NodeID nodeInCycle (SVFGSCC *scc, NodeID id) const
 

Private Attributes

SVFGgraph
 
int numOfNodes
 number of svfg nodes. More...
 
int numOfFormalIn
 number of formal in svfg nodes. More...
 
int numOfFormalOut
 number of formal out svfg nodes. More...
 
int numOfFormalParam
 
int numOfFormalRet
 
int numOfActualIn
 number of actual in svfg nodes. More...
 
int numOfActualOut
 number of actual out svfg nodes. More...
 
int numOfActualParam
 
int numOfActualRet
 
int numOfLoad
 number of load svfg nodes. More...
 
int numOfStore
 number of store svfg nodes. More...
 
int numOfCopy
 
int numOfGep
 
int numOfAddr
 
int numOfMSSAPhi
 number of mssa phi svfg nodes. More...
 
int numOfPhi
 
int totalInEdge
 Total number of incoming SVFG edges. More...
 
int totalOutEdge
 Total number of outgoing SVFG edges. More...
 
int totalIndInEdge
 Total number of indirect SVFG edges. More...
 
int totalIndOutEdge
 
int totalIndEdgeLabels
 Total number of l –o--> lp. More...
 
int totalIndCallEdge
 
int totalIndRetEdge
 
int totalDirCallEdge
 
int totalDirRetEdge
 
int avgWeight
 average weight. More...
 
int avgInDegree
 average in degrees of SVFG nodes. More...
 
int avgOutDegree
 average out degrees of SVFG nodes. More...
 
u32_t maxInDegree
 max in degrees of SVFG nodes. More...
 
u32_t maxOutDegree
 max out degrees of SVFG nodes. More...
 
int avgIndInDegree
 average indirect in degrees of SVFG nodes. More...
 
int avgIndOutDegree
 average indirect out degrees of SVFG nodes. More...
 
u32_t maxIndInDegree
 max indirect in degrees of SVFG nodes. More...
 
u32_t maxIndOutDegree
 max indirect out degrees of SVFG nodes. More...
 
double addTopLevelNodeTimeStart
 
double addTopLevelNodeTimeEnd
 
double addAddrTakenNodeTimeStart
 
double addAddrTakenNodeTimeEnd
 
double connectDirSVFGEdgeTimeStart
 
double connectDirSVFGEdgeTimeEnd
 
double connectIndSVFGEdgeTimeStart
 
double connectIndSVFGEdgeTimeEnd
 
double svfgOptTimeStart
 
double svfgOptTimeEnd
 
SVFGNodeSet forwardSlice
 
SVFGNodeSet backwardSlice
 
SVFGNodeSet sources
 
SVFGNodeSet sinks
 

Additional Inherited Members

- Static Public Member Functions inherited from SVF::SVFStat
static double getClk (bool mark=false)
 
- Public Attributes inherited from SVF::PTAStat
NodeBS localVarInRecursion
 
- Public Attributes inherited from SVF::SVFStat
NUMStatMap generalNumMap
 
NUMStatMap PTNumStatMap
 
TIMEStatMap timeStatMap
 
double startTime
 
double endTime
 
- Static Public Attributes inherited from SVF::SVFStat
static bool printGeneralStats = true
 SVF's general statistics are only printed once even if you run multiple anayses. More...
 
static double timeOfBuildingLLVMModule = 0
 
static double timeOfBuildingSymbolTable = 0
 
static double timeOfBuildingSVFIR = 0
 
- Protected Attributes inherited from SVF::PTAStat
PointerAnalysispta
 
u32_t _vmrssUsageBefore
 
u32_t _vmrssUsageAfter
 
u32_t _vmsizeUsageBefore
 
u32_t _vmsizeUsageAfter
 

Detailed Description

Definition at line 92 of file SVFGStat.h.

Member Typedef Documentation

◆ SVFGEdgeSet

Definition at line 96 of file SVFGStat.h.

◆ SVFGNodeSet

Definition at line 95 of file SVFGStat.h.

◆ SVFGSCC

Definition at line 97 of file SVFGStat.h.

Constructor & Destructor Documentation

◆ SVFGStat()

SVFGStat::SVFGStat ( SVFG g)

Constructor

Definition at line 136 of file SVFGStat.cpp.

136  : PTAStat(nullptr)
137 {
138  graph = g;
139  clear();
140  startClk();
146 }
PTAStat(PointerAnalysis *p)
Definition: PTAStat.cpp:39
double connectDirSVFGEdgeTimeStart
Definition: SVFGStat.h:222
double svfgOptTimeStart
Definition: SVFGStat.h:228
double connectIndSVFGEdgeTimeStart
Definition: SVFGStat.h:225
double addAddrTakenNodeTimeEnd
Definition: SVFGStat.h:220
double connectIndSVFGEdgeTimeEnd
Definition: SVFGStat.h:226
SVFG * graph
Definition: SVFGStat.h:170
void clear()
Definition: SVFGStat.cpp:148
double addTopLevelNodeTimeEnd
Definition: SVFGStat.h:217
double addAddrTakenNodeTimeStart
Definition: SVFGStat.h:219
double svfgOptTimeEnd
Definition: SVFGStat.h:229
double connectDirSVFGEdgeTimeEnd
Definition: SVFGStat.h:223
double addTopLevelNodeTimeStart
Definition: SVFGStat.h:216
virtual void startClk()
Definition: SVFStat.h:58

◆ ~SVFGStat()

virtual SVF::SVFGStat::~SVFGStat ( )
inlinevirtual

Definition at line 101 of file SVFGStat.h.

101 {}

Member Function Documentation

◆ addToBackwardSlice()

void SVF::SVFGStat::addToBackwardSlice ( const SVFGNode node)
inline

Definition at line 249 of file SVFGStat.h.

250  {
251  backwardSlice.insert(node);
252  }
SVFGNodeSet backwardSlice
Definition: SVFGStat.h:232

◆ addToForwardSlice()

void SVF::SVFGStat::addToForwardSlice ( const SVFGNode node)
inline

Definition at line 245 of file SVFGStat.h.

246  {
247  forwardSlice.insert(node);
248  }
SVFGNodeSet forwardSlice
Definition: SVFGStat.h:231

◆ addToSinks()

void SVF::SVFGStat::addToSinks ( const SVFGNode node)
inline

Definition at line 241 of file SVFGStat.h.

242  {
243  sinks.insert(node);
244  }
SVFGNodeSet sinks
Definition: SVFGStat.h:234

◆ addToSources()

void SVF::SVFGStat::addToSources ( const SVFGNode node)
inline

Definition at line 237 of file SVFGStat.h.

238  {
239  sources.insert(node);
240  }
SVFGNodeSet sources
Definition: SVFGStat.h:233

◆ ATVFNodeEnd()

void SVF::SVFGStat::ATVFNodeEnd ( )
inline

Definition at line 144 of file SVFGStat.h.

145  {
147  }
static double getClk(bool mark=false)
Definition: SVFStat.cpp:47

◆ ATVFNodeStart()

void SVF::SVFGStat::ATVFNodeStart ( )
inline

Definition at line 139 of file SVFGStat.h.

140  {
142  }

◆ calculateNodeDegrees()

void SVFGStat::calculateNodeDegrees ( SVFGNode node,
NodeSet nodeHasIndInEdge,
NodeSet nodeHasIndOutEdge 
)
private

Definition at line 302 of file SVFGStat.cpp.

303 {
304  // Incoming edge
305  const SVFGEdge::SVFGEdgeSetTy& inEdges = node->getInEdges();
306  // total in edge
307  if (inEdges.size() > maxInDegree)
308  maxInDegree = inEdges.size();
309  totalInEdge += inEdges.size();
310 
311  // indirect in edge
312  u32_t indInEdges = 0;
313  SVFGEdge::SVFGEdgeSetTy::const_iterator edgeIt = inEdges.begin();
314  SVFGEdge::SVFGEdgeSetTy::const_iterator edgeEit = inEdges.end();
315  for (; edgeIt != edgeEit; ++edgeIt)
316  {
317  if (IndirectSVFGEdge* edge = SVFUtil::dyn_cast<IndirectSVFGEdge>(*edgeIt))
318  {
319  indInEdges++;
320  nodeHasIndInEdge.insert(node->getId());
321  // get edge's weight
322  // TODO: try a new method to calculate weight.
323  const NodeBS& cpts = edge->getPointsTo();
324  avgWeight += cpts.count();
325  totalIndEdgeLabels += cpts.count();
326  }
327 
328  if (SVFUtil::isa<CallDirSVFGEdge>(*edgeIt))
330  else if (SVFUtil::isa<CallIndSVFGEdge>(*edgeIt))
332  else if (SVFUtil::isa<RetDirSVFGEdge>(*edgeIt))
333  totalDirRetEdge++;
334  else if (SVFUtil::isa<RetIndSVFGEdge>(*edgeIt))
335  totalIndRetEdge++;
336  }
337 
338  if (indInEdges > maxIndInDegree)
339  maxIndInDegree = indInEdges;
340  totalIndInEdge += indInEdges;
341 
342  /*-----------------------------------------------------*/
343 
344  // Outgoing edge
345  const SVFGEdge::SVFGEdgeSetTy& outEdges = node->getOutEdges();
346  // total out edge
347  if (outEdges.size() > maxOutDegree)
348  maxOutDegree = outEdges.size();
349  totalOutEdge += outEdges.size();
350 
351  // indirect out edge
352  u32_t indOutEdges = 0;
353  edgeIt = outEdges.begin();
354  edgeEit = outEdges.end();
355  for (; edgeIt != edgeEit; ++edgeIt)
356  {
357  if ((*edgeIt)->isIndirectVFGEdge())
358  {
359  indOutEdges++;
360  nodeHasIndOutEdge.insert(node->getId());
361  }
362  }
363 
364  if (indOutEdges > maxIndOutDegree)
365  maxIndOutDegree = indOutEdges;
366  totalIndOutEdge += indOutEdges;
367 }
unsigned u32_t
Definition: CommandLine.h:18
const GEdgeSetTy & getOutEdges() const
Definition: GenericGraph.h:430
const GEdgeSetTy & getInEdges() const
Definition: GenericGraph.h:434
NodeID getId() const
Get ID.
Definition: GenericGraph.h:260
int totalIndEdgeLabels
Total number of l –o--> lp.
Definition: SVFGStat.h:197
int totalIndCallEdge
Definition: SVFGStat.h:199
int totalOutEdge
Total number of outgoing SVFG edges.
Definition: SVFGStat.h:194
int totalDirCallEdge
Definition: SVFGStat.h:201
u32_t maxIndInDegree
max indirect in degrees of SVFG nodes.
Definition: SVFGStat.h:213
u32_t maxInDegree
max in degrees of SVFG nodes.
Definition: SVFGStat.h:208
int avgWeight
average weight.
Definition: SVFGStat.h:204
int totalDirRetEdge
Definition: SVFGStat.h:202
u32_t maxOutDegree
max out degrees of SVFG nodes.
Definition: SVFGStat.h:209
int totalInEdge
Total number of incoming SVFG edges.
Definition: SVFGStat.h:193
int totalIndInEdge
Total number of indirect SVFG edges.
Definition: SVFGStat.h:195
int totalIndOutEdge
Definition: SVFGStat.h:196
u32_t maxIndOutDegree
max indirect out degrees of SVFG nodes.
Definition: SVFGStat.h:214
int totalIndRetEdge
Definition: SVFGStat.h:200
unsigned count() const
VFGEdgeSetTy SVFGEdgeSetTy
Definition: VFGEdge.h:118

◆ clear()

void SVFGStat::clear ( )
private

Definition at line 148 of file SVFGStat.cpp.

149 {
150  numOfNodes = 0;
154  numOfMSSAPhi = numOfPhi = 0;
155  avgWeight = 0;
160 
163  totalIndEdgeLabels = 0;
164 
167 }
int numOfActualParam
Definition: SVFGStat.h:181
int numOfActualOut
number of actual out svfg nodes.
Definition: SVFGStat.h:180
int avgOutDegree
average out degrees of SVFG nodes.
Definition: SVFGStat.h:207
int numOfFormalParam
Definition: SVFGStat.h:176
int numOfFormalRet
Definition: SVFGStat.h:177
int avgIndInDegree
average indirect in degrees of SVFG nodes.
Definition: SVFGStat.h:211
int avgInDegree
average in degrees of SVFG nodes.
Definition: SVFGStat.h:206
int numOfStore
number of store svfg nodes.
Definition: SVFGStat.h:185
int numOfActualIn
number of actual in svfg nodes.
Definition: SVFGStat.h:179
int avgIndOutDegree
average indirect out degrees of SVFG nodes.
Definition: SVFGStat.h:212
int numOfLoad
number of load svfg nodes.
Definition: SVFGStat.h:184
int numOfMSSAPhi
number of mssa phi svfg nodes.
Definition: SVFGStat.h:190
int numOfFormalOut
number of formal out svfg nodes.
Definition: SVFGStat.h:175
int numOfNodes
number of svfg nodes.
Definition: SVFGStat.h:172
int numOfFormalIn
number of formal in svfg nodes.
Definition: SVFGStat.h:174
int numOfActualRet
Definition: SVFGStat.h:182

◆ dirVFEdgeEnd()

void SVF::SVFGStat::dirVFEdgeEnd ( )
inline

Definition at line 114 of file SVFGStat.h.

115  {
117  }

◆ dirVFEdgeStart()

void SVF::SVFGStat::dirVFEdgeStart ( )
inline

Definition at line 109 of file SVFGStat.h.

110  {
112  }

◆ getSCCRep()

NodeID SVFGStat::getSCCRep ( SVFGSCC scc,
NodeID  id 
) const
private

Definition at line 169 of file SVFGStat.cpp.

170 {
171  return scc->repNode(id);
172 }

◆ inBackwardSlice()

bool SVF::SVFGStat::inBackwardSlice ( const SVFGNode node) const
inline

Definition at line 257 of file SVFGStat.h.

258  {
259  return backwardSlice.find(node)!=backwardSlice.end();
260  }

◆ indVFEdgeEnd()

void SVF::SVFGStat::indVFEdgeEnd ( )
inline

Definition at line 124 of file SVFGStat.h.

125  {
127  }

◆ indVFEdgeStart()

void SVF::SVFGStat::indVFEdgeStart ( )
inline

Definition at line 119 of file SVFGStat.h.

120  {
122  }

◆ inForwardSlice()

bool SVF::SVFGStat::inForwardSlice ( const SVFGNode node) const
inline

Definition at line 253 of file SVFGStat.h.

254  {
255  return forwardSlice.find(node)!=forwardSlice.end();
256  }

◆ isSink()

bool SVF::SVFGStat::isSink ( const SVFGNode node) const
inline

Definition at line 265 of file SVFGStat.h.

266  {
267  return sinks.find(node)!=sinks.end();
268  }

◆ isSource()

bool SVF::SVFGStat::isSource ( const SVFGNode node) const
inline

Definition at line 261 of file SVFGStat.h.

262  {
263  return sources.find(node)!=sources.end();
264  }

◆ nodeInCycle()

NodeID SVFGStat::nodeInCycle ( SVFGSCC scc,
NodeID  id 
) const
private

Definition at line 173 of file SVFGStat.cpp.

174 {
175  return scc->isInCycle(id);
176 }

◆ performSCCStat()

void SVFGStat::performSCCStat ( SVFGEdgeSet  insensitiveCalRetEdges)
virtual

Definition at line 369 of file SVFGStat.cpp.

370 {
371 
372  generalNumMap.clear();
373  PTNumStatMap.clear();
374  timeStatMap.clear();
375 
376  unsigned totalNode = 0;
377  unsigned totalCycle = 0;
378  unsigned nodeInCycle = 0;
379  unsigned maxNodeInCycle = 0;
380  unsigned totalEdge = 0;
381  unsigned edgeInCycle = 0;
382 
383  unsigned totalDirectEdge = 0;
384  unsigned directEdgeInCycle = 0;
385  unsigned totalIndirectEdge = 0;
386  unsigned indirectEdgeInCycle = 0;
387  unsigned totalCallEdge = 0;
388  unsigned callEdgeInCycle = 0;
389  unsigned insensitiveCallEdge = 0;
390  unsigned totalRetEdge = 0;
391  unsigned retEdgeInCycle = 0;
392  unsigned insensitiveRetEdge = 0;
393 
394  SVFGSCC* svfgSCC = new SVFGSCC(graph);
395  svfgSCC->find();
396 
397  NodeSet sccRepNodeSet;
398  SVFG::SVFGNodeIDToNodeMapTy::iterator it = graph->begin();
399  SVFG::SVFGNodeIDToNodeMapTy::iterator eit = graph->end();
400  for (; it != eit; ++it)
401  {
402  totalNode++;
403  if(svfgSCC->isInCycle(it->first))
404  {
405  nodeInCycle++;
406  sccRepNodeSet.insert(svfgSCC->repNode(it->first));
407  const NodeBS& subNodes = svfgSCC->subNodes(it->first);
408  if(subNodes.count() > maxNodeInCycle)
409  maxNodeInCycle = subNodes.count();
410  }
411 
412  SVFGEdge::SVFGEdgeSetTy::const_iterator edgeIt = it->second->InEdgeBegin();
413  SVFGEdge::SVFGEdgeSetTy::const_iterator edgeEit = it->second->InEdgeEnd();
414  for (; edgeIt != edgeEit; ++edgeIt)
415  {
416 
417  const SVFGEdge *edge = *edgeIt;
418  totalEdge++;
419  bool eCycle = false;
420  if(getSCCRep(svfgSCC,edge->getSrcID()) == getSCCRep(svfgSCC,edge->getDstID()))
421  {
422  edgeInCycle++;
423  eCycle = true;
424  }
425 
426  if (edge->isDirectVFGEdge())
427  {
428  totalDirectEdge++;
429  if(eCycle)
430  directEdgeInCycle++;
431 
432  }
433  if (edge->isIndirectVFGEdge())
434  {
435  totalIndirectEdge++;
436  if(eCycle)
437  indirectEdgeInCycle++;
438  }
439  if (edge->isCallVFGEdge())
440  {
441  totalCallEdge++;
442  if(eCycle)
443  {
444  callEdgeInCycle++;
445  }
446 
447  if(insensitiveCalRetEdges.find(edge)!=insensitiveCalRetEdges.end())
448  {
449  insensitiveCallEdge++;
450  }
451  }
452  if (edge->isRetVFGEdge())
453  {
454  totalRetEdge++;
455  if(eCycle)
456  {
457  retEdgeInCycle++;
458  }
459 
460  if(insensitiveCalRetEdges.find(edge)!=insensitiveCalRetEdges.end())
461  {
462  insensitiveRetEdge++;
463  }
464  }
465  }
466  }
467 
468 
469  totalCycle = sccRepNodeSet.size();
470 
471 
472  PTNumStatMap["TotalNode"] = totalNode;
473  PTNumStatMap["TotalCycle"] = totalCycle;
474  PTNumStatMap["NodeInCycle"] = nodeInCycle;
475  PTNumStatMap["MaxNodeInCycle"] = maxNodeInCycle;
476  PTNumStatMap["TotalEdge"] = totalEdge;
477  PTNumStatMap["EdgeInCycle"] = edgeInCycle;
478 
479  PTNumStatMap["TotalDirEdge"] = totalDirectEdge;
480  PTNumStatMap["DirEdgeInCycle"] = directEdgeInCycle;
481  PTNumStatMap["TotalIndEdge"] = totalIndirectEdge;
482  PTNumStatMap["IndEdgeInCycle"] = indirectEdgeInCycle;
483 
484  PTNumStatMap["TotalCallEdge"] = totalCallEdge;
485  PTNumStatMap["CallEdgeInCycle"] = callEdgeInCycle;
486  PTNumStatMap["InsenCallEdge"] = insensitiveCallEdge;
487 
488  PTNumStatMap["TotalRetEdge"] = totalRetEdge;
489  PTNumStatMap["RetEdgeInCycle"] = retEdgeInCycle;
490  PTNumStatMap["InsenRetEdge"] = insensitiveRetEdge;
491 
492 
493  PTAStat::printStat("SVFG SCC Stat");
494 
495  delete svfgSCC;
496 
497 }
NodeID getDstID() const
Definition: GenericGraph.h:85
NodeID getSrcID() const
get methods of the components
Definition: GenericGraph.h:81
iterator begin()
Iterators.
Definition: GenericGraph.h:627
SCCDetection< SVFG * > SVFGSCC
Definition: SVFGStat.h:97
NodeID nodeInCycle(SVFGSCC *scc, NodeID id) const
Definition: SVFGStat.cpp:173
NodeID getSCCRep(SVFGSCC *scc, NodeID id) const
Definition: SVFGStat.cpp:169
NUMStatMap generalNumMap
Definition: SVFStat.h:76
NUMStatMap PTNumStatMap
Definition: SVFStat.h:77
virtual void printStat(std::string str="")
Definition: SVFStat.cpp:66
TIMEStatMap timeStatMap
Definition: SVFStat.h:78
bool isRetVFGEdge() const
Definition: VFGEdge.h:88
bool isCallVFGEdge() const
Definition: VFGEdge.h:84
bool isDirectVFGEdge() const
Get methods of the components.
Definition: VFGEdge.h:76
bool isIndirectVFGEdge() const
Definition: VFGEdge.h:80
Set< NodeID > NodeSet
Definition: GeneralType.h:113

◆ performStat()

void SVFGStat::performStat ( )
overridevirtual

Implements SVF::SVFStat.

Definition at line 178 of file SVFGStat.cpp.

179 {
180  endClk();
181 
182  clear();
183 
184  processGraph();
185 
186  timeStatMap["TotalTime"] = (endTime - startTime)/TIMEINTERVAL;
187 
189 
191 
193 
195 
197 
198  PTNumStatMap["TotalNode"] = numOfNodes;
199 
200  PTNumStatMap["FormalIn"] = numOfFormalIn;
201  PTNumStatMap["FormalOut"] = numOfFormalOut;
202  PTNumStatMap["FormalParam"] = numOfFormalParam;
203  PTNumStatMap["FormalRet"] = numOfFormalRet;
204 
205  PTNumStatMap["ActualIn"] = numOfActualIn;
206  PTNumStatMap["ActualOut"] = numOfActualOut;
207  PTNumStatMap["ActualParam"] = numOfActualParam;
208  PTNumStatMap["ActualRet"] = numOfActualRet;
209 
210  PTNumStatMap["Addr"] = numOfAddr;
211  PTNumStatMap["Copy"] = numOfCopy;
212  PTNumStatMap["Gep"] = numOfGep;
213  PTNumStatMap["Store"] = numOfStore;
214  PTNumStatMap["Load"] = numOfLoad;
215 
216  PTNumStatMap["PHI"] = numOfPhi;
217  PTNumStatMap["MSSAPhi"] = numOfMSSAPhi;
218 
219  timeStatMap["AvgWeight"] = (totalIndInEdge == 0) ? 0 : ((double)avgWeight / totalIndInEdge);
220 
221  PTNumStatMap["TotalEdge"] = totalInEdge;
222  PTNumStatMap["DirectEdge"] = totalInEdge - totalIndInEdge;
223  PTNumStatMap["IndirectEdge"] = totalIndInEdge;
224  PTNumStatMap["IndirectEdgeLabels"] = totalIndEdgeLabels;
225 
226  PTNumStatMap["IndCallEdge"] = totalIndCallEdge;
227  PTNumStatMap["IndRetEdge"] = totalIndRetEdge;
228  PTNumStatMap["DirectCallEdge"] = totalDirCallEdge;
229  PTNumStatMap["DirectRetEdge"] = totalDirRetEdge;
230 
231  PTNumStatMap["AvgInDegree"] = avgInDegree;
232  PTNumStatMap["AvgOutDegree"] = avgOutDegree;
233  PTNumStatMap["MaxInDegree"] = maxInDegree;
234  PTNumStatMap["MaxOutDegree"] = maxOutDegree;
235 
236  PTNumStatMap["AvgIndInDeg"] = avgIndInDegree;
237  PTNumStatMap["AvgIndOutDeg"] = avgIndOutDegree;
238  PTNumStatMap["MaxIndInDeg"] = maxIndInDegree;
239  PTNumStatMap["MaxIndOutDeg"] = maxIndOutDegree;
240 
241  printStat();
242 }
#define TIMEINTERVAL
Definition: SVFType.h:512
virtual void printStat(std::string str="") override
Definition: SVFGStat.cpp:499
void processGraph()
Definition: SVFGStat.cpp:244
virtual void endClk()
Definition: SVFStat.h:63
double endTime
Definition: SVFStat.h:81
double startTime
Definition: SVFStat.h:80

◆ printStat()

void SVFGStat::printStat ( std::string  str = "")
overridevirtual

Reimplemented from SVF::SVFStat.

Definition at line 499 of file SVFGStat.cpp.

500 {
501  PTAStat::printStat("SVFG Statistics");
502 }

◆ processGraph()

void SVFGStat::processGraph ( )
private

Definition at line 244 of file SVFGStat.cpp.

245 {
246  NodeSet nodeHasIndInEdge;
247  NodeSet nodeHasIndOutEdge;
248 
249  SVFG::SVFGNodeIDToNodeMapTy::iterator it = graph->begin();
250  SVFG::SVFGNodeIDToNodeMapTy::iterator eit = graph->end();
251  for (; it != eit; ++it)
252  {
253  numOfNodes++;
254  if (SVFUtil::isa<FormalINSVFGNode>(it->second))
255  numOfFormalIn++;
256  else if (SVFUtil::isa<FormalOUTSVFGNode>(it->second))
257  numOfFormalOut++;
258  else if (SVFUtil::isa<FormalParmSVFGNode>(it->second))
260  else if (SVFUtil::isa<FormalRetSVFGNode>(it->second))
261  numOfFormalRet++;
262  else if (SVFUtil::isa<ActualINSVFGNode>(it->second))
263  numOfActualIn++;
264  else if (SVFUtil::isa<ActualOUTSVFGNode>(it->second))
265  numOfActualOut++;
266  else if (SVFUtil::isa<ActualParmSVFGNode>(it->second))
268  else if (SVFUtil::isa<ActualRetSVFGNode>(it->second))
269  numOfActualRet++;
270  else if (SVFUtil::isa<AddrSVFGNode>(it->second))
271  numOfAddr++;
272  else if (SVFUtil::isa<CopySVFGNode>(it->second))
273  numOfCopy++;
274  else if (SVFUtil::isa<GepSVFGNode>(it->second))
275  numOfGep++;
276  else if (SVFUtil::isa<LoadSVFGNode>(it->second))
277  numOfLoad++;
278  else if (SVFUtil::isa<StoreSVFGNode>(it->second))
279  numOfStore++;
280  else if (SVFUtil::isa<PHISVFGNode>(it->second))
281  numOfPhi++;
282  else if (SVFUtil::isa<MSSAPHISVFGNode>(it->second))
283  numOfMSSAPhi++;
284 
285  SVFGNode* node = it->second;
286  calculateNodeDegrees(node, nodeHasIndInEdge, nodeHasIndOutEdge);
287  }
288 
289  if (numOfNodes > 0)
290  {
293  }
294 
295  if (!nodeHasIndInEdge.empty())
296  avgIndInDegree = totalIndInEdge / nodeHasIndInEdge.size();
297 
298  if (!nodeHasIndOutEdge.empty())
299  avgIndOutDegree = totalIndOutEdge / nodeHasIndOutEdge.size();
300 }
void calculateNodeDegrees(SVFGNode *node, NodeSet &nodeHasIndInEdge, NodeSet &nodeHasIndOutEdge)
Definition: SVFGStat.cpp:302

◆ sfvgOptEnd()

void SVF::SVFGStat::sfvgOptEnd ( )
inline

Definition at line 154 of file SVFGStat.h.

155  {
157  }

◆ sfvgOptStart()

void SVF::SVFGStat::sfvgOptStart ( )
inline

Definition at line 149 of file SVFGStat.h.

150  {
152  }

◆ TLVFNodeEnd()

void SVF::SVFGStat::TLVFNodeEnd ( )
inline

Definition at line 134 of file SVFGStat.h.

135  {
137  }

◆ TLVFNodeStart()

void SVF::SVFGStat::TLVFNodeStart ( )
inline

Definition at line 129 of file SVFGStat.h.

130  {
132  }

Member Data Documentation

◆ addAddrTakenNodeTimeEnd

double SVF::SVFGStat::addAddrTakenNodeTimeEnd
private

Definition at line 220 of file SVFGStat.h.

◆ addAddrTakenNodeTimeStart

double SVF::SVFGStat::addAddrTakenNodeTimeStart
private

Definition at line 219 of file SVFGStat.h.

◆ addTopLevelNodeTimeEnd

double SVF::SVFGStat::addTopLevelNodeTimeEnd
private

Definition at line 217 of file SVFGStat.h.

◆ addTopLevelNodeTimeStart

double SVF::SVFGStat::addTopLevelNodeTimeStart
private

Definition at line 216 of file SVFGStat.h.

◆ avgInDegree

int SVF::SVFGStat::avgInDegree
private

average in degrees of SVFG nodes.

Definition at line 206 of file SVFGStat.h.

◆ avgIndInDegree

int SVF::SVFGStat::avgIndInDegree
private

average indirect in degrees of SVFG nodes.

Definition at line 211 of file SVFGStat.h.

◆ avgIndOutDegree

int SVF::SVFGStat::avgIndOutDegree
private

average indirect out degrees of SVFG nodes.

Definition at line 212 of file SVFGStat.h.

◆ avgOutDegree

int SVF::SVFGStat::avgOutDegree
private

average out degrees of SVFG nodes.

Definition at line 207 of file SVFGStat.h.

◆ avgWeight

int SVF::SVFGStat::avgWeight
private

average weight.

Definition at line 204 of file SVFGStat.h.

◆ backwardSlice

SVFGNodeSet SVF::SVFGStat::backwardSlice
private

Definition at line 232 of file SVFGStat.h.

◆ connectDirSVFGEdgeTimeEnd

double SVF::SVFGStat::connectDirSVFGEdgeTimeEnd
private

Definition at line 223 of file SVFGStat.h.

◆ connectDirSVFGEdgeTimeStart

double SVF::SVFGStat::connectDirSVFGEdgeTimeStart
private

Definition at line 222 of file SVFGStat.h.

◆ connectIndSVFGEdgeTimeEnd

double SVF::SVFGStat::connectIndSVFGEdgeTimeEnd
private

Definition at line 226 of file SVFGStat.h.

◆ connectIndSVFGEdgeTimeStart

double SVF::SVFGStat::connectIndSVFGEdgeTimeStart
private

Definition at line 225 of file SVFGStat.h.

◆ forwardSlice

SVFGNodeSet SVF::SVFGStat::forwardSlice
private

Definition at line 231 of file SVFGStat.h.

◆ graph

SVFG* SVF::SVFGStat::graph
private

Definition at line 170 of file SVFGStat.h.

◆ maxInDegree

u32_t SVF::SVFGStat::maxInDegree
private

max in degrees of SVFG nodes.

Definition at line 208 of file SVFGStat.h.

◆ maxIndInDegree

u32_t SVF::SVFGStat::maxIndInDegree
private

max indirect in degrees of SVFG nodes.

Definition at line 213 of file SVFGStat.h.

◆ maxIndOutDegree

u32_t SVF::SVFGStat::maxIndOutDegree
private

max indirect out degrees of SVFG nodes.

Definition at line 214 of file SVFGStat.h.

◆ maxOutDegree

u32_t SVF::SVFGStat::maxOutDegree
private

max out degrees of SVFG nodes.

Definition at line 209 of file SVFGStat.h.

◆ numOfActualIn

int SVF::SVFGStat::numOfActualIn
private

number of actual in svfg nodes.

Definition at line 179 of file SVFGStat.h.

◆ numOfActualOut

int SVF::SVFGStat::numOfActualOut
private

number of actual out svfg nodes.

Definition at line 180 of file SVFGStat.h.

◆ numOfActualParam

int SVF::SVFGStat::numOfActualParam
private

Definition at line 181 of file SVFGStat.h.

◆ numOfActualRet

int SVF::SVFGStat::numOfActualRet
private

Definition at line 182 of file SVFGStat.h.

◆ numOfAddr

int SVF::SVFGStat::numOfAddr
private

Definition at line 188 of file SVFGStat.h.

◆ numOfCopy

int SVF::SVFGStat::numOfCopy
private

Definition at line 186 of file SVFGStat.h.

◆ numOfFormalIn

int SVF::SVFGStat::numOfFormalIn
private

number of formal in svfg nodes.

Definition at line 174 of file SVFGStat.h.

◆ numOfFormalOut

int SVF::SVFGStat::numOfFormalOut
private

number of formal out svfg nodes.

Definition at line 175 of file SVFGStat.h.

◆ numOfFormalParam

int SVF::SVFGStat::numOfFormalParam
private

Definition at line 176 of file SVFGStat.h.

◆ numOfFormalRet

int SVF::SVFGStat::numOfFormalRet
private

Definition at line 177 of file SVFGStat.h.

◆ numOfGep

int SVF::SVFGStat::numOfGep
private

Definition at line 187 of file SVFGStat.h.

◆ numOfLoad

int SVF::SVFGStat::numOfLoad
private

number of load svfg nodes.

Definition at line 184 of file SVFGStat.h.

◆ numOfMSSAPhi

int SVF::SVFGStat::numOfMSSAPhi
private

number of mssa phi svfg nodes.

Definition at line 190 of file SVFGStat.h.

◆ numOfNodes

int SVF::SVFGStat::numOfNodes
private

number of svfg nodes.

Definition at line 172 of file SVFGStat.h.

◆ numOfPhi

int SVF::SVFGStat::numOfPhi
private

Definition at line 191 of file SVFGStat.h.

◆ numOfStore

int SVF::SVFGStat::numOfStore
private

number of store svfg nodes.

Definition at line 185 of file SVFGStat.h.

◆ sinks

SVFGNodeSet SVF::SVFGStat::sinks
private

Definition at line 234 of file SVFGStat.h.

◆ sources

SVFGNodeSet SVF::SVFGStat::sources
private

Definition at line 233 of file SVFGStat.h.

◆ svfgOptTimeEnd

double SVF::SVFGStat::svfgOptTimeEnd
private

Definition at line 229 of file SVFGStat.h.

◆ svfgOptTimeStart

double SVF::SVFGStat::svfgOptTimeStart
private

Definition at line 228 of file SVFGStat.h.

◆ totalDirCallEdge

int SVF::SVFGStat::totalDirCallEdge
private

Definition at line 201 of file SVFGStat.h.

◆ totalDirRetEdge

int SVF::SVFGStat::totalDirRetEdge
private

Definition at line 202 of file SVFGStat.h.

◆ totalIndCallEdge

int SVF::SVFGStat::totalIndCallEdge
private

Definition at line 199 of file SVFGStat.h.

◆ totalIndEdgeLabels

int SVF::SVFGStat::totalIndEdgeLabels
private

Total number of l –o--> lp.

Definition at line 197 of file SVFGStat.h.

◆ totalIndInEdge

int SVF::SVFGStat::totalIndInEdge
private

Total number of indirect SVFG edges.

Definition at line 195 of file SVFGStat.h.

◆ totalIndOutEdge

int SVF::SVFGStat::totalIndOutEdge
private

Definition at line 196 of file SVFGStat.h.

◆ totalIndRetEdge

int SVF::SVFGStat::totalIndRetEdge
private

Definition at line 200 of file SVFGStat.h.

◆ totalInEdge

int SVF::SVFGStat::totalInEdge
private

Total number of incoming SVFG edges.

Definition at line 193 of file SVFGStat.h.

◆ totalOutEdge

int SVF::SVFGStat::totalOutEdge
private

Total number of outgoing SVFG edges.

Definition at line 194 of file SVFGStat.h.


The documentation for this class was generated from the following files: