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 class  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 40 of file PTAStat.cpp.

40 : SVFStat(),
41 pta(p),
46{
47 u32_t vmrss = 0;
48 u32_t vmsize = 0;
51}
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:183
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

◆ ~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 82 of file PTAStat.cpp.

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

◆ performStat()

void PTAStat::performStat ( )
overridevirtual

Implements SVF::SVFStat.

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

Definition at line 53 of file PTAStat.cpp.

54{
55
57
59
60 SVFIR* pag = SVFIR::getPAG();
61 for(SVFIR::iterator it = pag->begin(), eit = pag->end(); it!=eit; ++it)
62 {
63 PAGNode* node = it->second;
64 if(SVFUtil::isa<ObjVar>(node))
65 {
67 {
69 }
70 }
71 }
72 PTNumStatMap["LocalVarInRecur"] = localVarInRecursion.count();
73
74 u32_t vmrss = 0;
75 u32_t vmsize = 0;
78 timeStatMap["MemoryUsageVmrss"] = _vmrssUsageAfter - _vmrssUsageBefore;
79 timeStatMap["MemoryUsageVmsize"] = _vmsizeUsageAfter - _vmsizeUsageBefore;
80}
void setMemUsageAfter(u32_t vmrss, u32_t vmsize)
Definition PTAStat.h:62
NodeBS localVarInRecursion
Definition PTAStat.h:54
void callgraphStat() override
Definition PTAStat.cpp:82
bool isLocalVarInRecursiveFun(NodeID id) const
Whether a local variable is in function recursions.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition SVFIR.h:118
TIMEStatMap timeStatMap
Definition SVFStat.h:80
virtual void performStat()=0
Definition SVFStat.cpp:113
NodeID getId() const
Get ID.
Definition SVFValue.h:161
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: