Static Value-Flow Analysis
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Attributes | List of all members
SVF::PTAStat Class Reference

#include <PTAStat.h>

Inheritance diagram for SVF::PTAStat:
SVF::SVFStat SVF::AndersenStat SVF::CFLStat SVF::DDAStat SVF::FlowSensitiveStat SVF::ICFGStat SVF::MTAStat SVF::MemSSAStat SVF::SVFGStat SVF::VersionedFlowSensitiveStat

Public Member Functions

 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 printStat (std::string str="")
 
virtual void performStatPerQuery (NodeID)
 
virtual void printStatPerQuery (NodeID, const PointsTo &)
 

Public Attributes

NodeBS localVarInRecursion
 
- Public Attributes inherited from SVF::SVFStat
NUMStatMap generalNumMap
 
NUMStatMap PTNumStatMap
 
TIMEStatMap timeStatMap
 
double startTime
 
double endTime
 

Protected Attributes

PointerAnalysispta
 
u32_t _vmrssUsageBefore
 
u32_t _vmrssUsageAfter
 
u32_t _vmsizeUsageBefore
 
u32_t _vmsizeUsageAfter
 

Additional Inherited Members

- Public Types inherited from SVF::SVFStat
enum  ClockType { Wall , CPU }
 
typedef OrderedMap< std::string, u32_tNUMStatMap
 
typedef OrderedMap< std::string, doubleTIMEStatMap
 
- Static Public Member Functions inherited from SVF::SVFStat
static double getClk (bool mark=false)
 
- 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.
 
static double timeOfBuildingLLVMModule = 0
 
static double timeOfBuildingSymbolTable = 0
 
static double timeOfBuildingSVFIR = 0
 

Detailed Description

Pointer Analysis Statistics

Definition at line 48 of file PTAStat.h.

Constructor & Destructor Documentation

◆ PTAStat()

PTAStat::PTAStat ( PointerAnalysis p)

Definition at line 39 of file PTAStat.cpp.

39 : SVFStat(),
40 pta(p),
45{
46 u32_t vmrss = 0;
47 u32_t vmsize = 0;
50}
unsigned u32_t
Definition CommandLine.h:18
cJSON * p
Definition cJSON.cpp:2559
void setMemUsageBefore(u32_t vmrss, u32_t vmsize)
Definition PTAStat.h:56
u32_t _vmsizeUsageBefore
Definition PTAStat.h:77
PointerAnalysis * pta
Definition PTAStat.h:74
u32_t _vmsizeUsageAfter
Definition PTAStat.h:78
u32_t _vmrssUsageAfter
Definition PTAStat.h:76
u32_t _vmrssUsageBefore
Definition PTAStat.h:75
bool getMemoryUsageKB(u32_t *vmrss_kb, u32_t *vmsize_kb)
Get memory usage from system file. Return TRUE if succeed.
Definition SVFUtil.cpp:178
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~PTAStat()

virtual SVF::PTAStat::~PTAStat ( )
inlinevirtual

Definition at line 52 of file PTAStat.h.

52{}

Member Function Documentation

◆ callgraphStat()

void PTAStat::callgraphStat ( )
overridevirtual

Reimplemented from SVF::SVFStat.

Definition at line 81 of file PTAStat.cpp.

82{
83
84 PTACallGraph* graph = pta->getCallGraph();
86 callgraphSCC->find();
87
88 unsigned totalNode = 0;
89 unsigned totalCycle = 0;
90 unsigned nodeInCycle = 0;
91 unsigned maxNodeInCycle = 0;
92 unsigned totalEdge = 0;
93 unsigned edgeInCycle = 0;
94
98 for (; it != eit; ++it)
99 {
100 totalNode++;
101 if(callgraphSCC->isInCycle(it->first))
102 {
103 sccRepNodeSet.insert(callgraphSCC->repNode(it->first));
104 nodeInCycle++;
105 const NodeBS& subNodes = callgraphSCC->subNodes(it->first);
106 if(subNodes.count() > maxNodeInCycle)
107 maxNodeInCycle = subNodes.count();
108 }
109
110 PTACallGraphNode::const_iterator edgeIt = it->second->InEdgeBegin();
111 PTACallGraphNode::const_iterator edgeEit = it->second->InEdgeEnd();
112 for (; edgeIt != edgeEit; ++edgeIt)
113 {
115 totalEdge+= edge->getDirectCalls().size() + edge->getIndirectCalls().size();
116 if(callgraphSCC->repNode(edge->getSrcID()) == callgraphSCC->repNode(edge->getDstID()))
117 {
118 edgeInCycle+=edge->getDirectCalls().size() + edge->getIndirectCalls().size();
119 }
120 }
121 }
122
123 totalCycle = sccRepNodeSet.size();
124
125 PTNumStatMap["TotalNode"] = totalNode;
126 PTNumStatMap["TotalCycle"] = totalCycle;
127 PTNumStatMap["NodeInCycle"] = nodeInCycle;
128 PTNumStatMap["MaxNodeInCycle"] = maxNodeInCycle;
129 PTNumStatMap["TotalEdge"] = totalEdge;
130 PTNumStatMap["CalRetPairInCycle"] = edgeInCycle;
131
133 SVFStat::printStat("PTACallGraph Stats (Andersen analysis)");
135 SVFStat::printStat("PTACallGraph Stats (Flow-sensitive analysis)");
137 SVFStat::printStat("PTACallGraph Stats (CFL-R analysis)");
139 SVFStat::printStat("PTACallGraph Stats (DDA analysis)");
140 else
141 SVFStat::printStat("PTACallGraph Stats");
142
143 delete callgraphSCC;
144}
iterator begin()
Iterators.
IDToNodeMapTy::iterator iterator
Node Iterators.
GEdgeSetTy::const_iterator const_iterator
CallInstSet & getDirectCalls()
@ Cxt_DDA
context sensitive DDA
@ CFLFICI_WPA
Flow-, context-, insensitive CFL-reachability-based analysis.
@ FSCS_WPA
Flow-, context- sensitive WPA.
@ FSDATAFLOW_WPA
Traditional Dataflow-based flow sensitive WPA.
@ Andersen_BASE
Base Andersen PTA.
@ CFLFSCS_WPA
Flow-, context-, CFL-reachability-based analysis.
@ FieldS_DDA
Field sensitive DDA.
@ Steensgaard_WPA
Steensgaard PTA.
PTACallGraph * getCallGraph() const
Return call graph.
PTATY getAnalysisTy() const
Type of pointer analysis.
SCCDetection< PTACallGraph * > CallGraphSCC
NUMStatMap PTNumStatMap
Definition SVFStat.h:77
virtual void printStat(std::string str="")
Definition SVFStat.cpp:67
unsigned count() const
Set< NodeID > NodeSet

◆ performStat()

void PTAStat::performStat ( )
overridevirtual

Implements SVF::SVFStat.

Reimplemented in SVF::VersionedFlowSensitiveStat, and SVF::SVFGStat.

Definition at line 52 of file PTAStat.cpp.

53{
54
56
58
59 SVFIR* pag = SVFIR::getPAG();
60 for(SVFIR::iterator it = pag->begin(), eit = pag->end(); it!=eit; ++it)
61 {
62 PAGNode* node = it->second;
63 if(SVFUtil::isa<ObjVar>(node))
64 {
66 {
68 }
69 }
70 }
71 PTNumStatMap["LocalVarInRecur"] = localVarInRecursion.count();
72
73 u32_t vmrss = 0;
74 u32_t vmsize = 0;
77 timeStatMap["MemoryUsageVmrss"] = _vmrssUsageAfter - _vmrssUsageBefore;
78 timeStatMap["MemoryUsageVmsize"] = _vmsizeUsageAfter - _vmsizeUsageBefore;
79}
void setMemUsageAfter(u32_t vmrss, u32_t vmsize)
Definition PTAStat.h:62
NodeBS localVarInRecursion
Definition PTAStat.h:54
void callgraphStat() override
Definition PTAStat.cpp:81
bool isLocalVarInRecursiveFun(NodeID id) const
Whether a local variable is in function recursions.
NodeID getId() const
Get ID.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition SVFIR.h:116
TIMEStatMap timeStatMap
Definition SVFStat.h:78
virtual void performStat()=0
Definition SVFStat.cpp:110
void set(unsigned Idx)

◆ setMemUsageAfter()

void SVF::PTAStat::setMemUsageAfter ( u32_t  vmrss,
u32_t  vmsize 
)
inline

Definition at line 62 of file PTAStat.h.

◆ setMemUsageBefore()

void SVF::PTAStat::setMemUsageBefore ( u32_t  vmrss,
u32_t  vmsize 
)
inline

Definition at line 56 of file PTAStat.h.

Member Data Documentation

◆ _vmrssUsageAfter

u32_t SVF::PTAStat::_vmrssUsageAfter
protected

Definition at line 76 of file PTAStat.h.

◆ _vmrssUsageBefore

u32_t SVF::PTAStat::_vmrssUsageBefore
protected

Definition at line 75 of file PTAStat.h.

◆ _vmsizeUsageAfter

u32_t SVF::PTAStat::_vmsizeUsageAfter
protected

Definition at line 78 of file PTAStat.h.

◆ _vmsizeUsageBefore

u32_t SVF::PTAStat::_vmsizeUsageBefore
protected

Definition at line 77 of file PTAStat.h.

◆ localVarInRecursion

NodeBS SVF::PTAStat::localVarInRecursion

Definition at line 54 of file PTAStat.h.

◆ pta

PointerAnalysis* SVF::PTAStat::pta
protected

Definition at line 74 of file PTAStat.h.


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