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

#include <DDAStat.h>

Inheritance diagram for SVF::DDAStat:
SVF::PTAStat SVF::SVFStat

Public Member Functions

 DDAStat (FlowDDA *pta)
 
 DDAStat (ContextDDA *pta)
 
void performStatPerQuery (NodeID ptr) override
 
void performStat () override
 
void printStat (std::string str="") override
 
void printStatPerQuery (NodeID ptr, const PointsTo &pts) override
 
void getNumOfOOBQuery ()
 
SVFGgetSVFG () const
 
PointerAnalysisgetPTA () const
 
NodeBSgetStrongUpdateStores ()
 
- 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 ()
 

Public Attributes

u32_t _NumOfDPM
 
u32_t _NumOfStrongUpdates
 
u32_t _NumOfMustAliases
 
u32_t _NumOfInfeasiblePath
 
u64_t _NumOfStep
 
u64_t _NumOfStepInCycle
 
double _AnaTimePerQuery
 
double _AnaTimeCyclePerQuery
 
double _TotalTimeOfQueries
 
double _TotalTimeOfBKCondition
 
NodeBS _StrongUpdateStores
 
- Public Attributes inherited from SVF::PTAStat
NodeBS localVarInRecursion
 
- Public Attributes inherited from SVF::SVFStat
NUMStatMap generalNumMap
 
NUMStatMap PTNumStatMap
 
TIMEStatMap timeStatMap
 
double startTime
 
double endTime
 

Private Member Functions

void initDefault ()
 

Private Attributes

FlowDDAflowDDA
 
ContextDDAcontextDDA
 
u32_t _TotalNumOfQuery
 
u32_t _TotalNumOfOutOfBudgetQuery
 
u32_t _TotalNumOfDPM
 
u32_t _TotalNumOfStrongUpdates
 
u32_t _TotalNumOfMustAliases
 
u32_t _TotalNumOfInfeasiblePath
 
u32_t _TotalNumOfStep
 
u32_t _TotalNumOfStepInCycle
 
u32_t _NumOfIndCallEdgeSolved
 
u32_t _MaxCPtsSize
 
u32_t _MaxPtsSize
 
u32_t _TotalCPtsSize
 
u32_t _TotalPtsSize
 
u32_t _NumOfNullPtr
 
u32_t _NumOfConstantPtr
 
u32_t _NumOfBlackholePtr
 
double _AvgNumOfDPMAtSVFGNode
 
u32_t _MaxNumOfDPMAtSVFGNode
 
NUMStatMap NumPerQueryStatMap
 

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
 
- Protected Attributes inherited from SVF::PTAStat
PointerAnalysispta
 
u32_t _vmrssUsageBefore
 
u32_t _vmrssUsageAfter
 
u32_t _vmsizeUsageBefore
 
u32_t _vmsizeUsageAfter
 

Detailed Description

Statistics of demand-driven analysis

Definition at line 47 of file DDAStat.h.

Constructor & Destructor Documentation

◆ DDAStat() [1/2]

DDAStat::DDAStat ( FlowDDA pta)

Definition at line 42 of file DDAStat.cpp.

42 : PTAStat(pta), flowDDA(pta), contextDDA(nullptr)
43{
45}
FlowDDA * flowDDA
Definition DDAStat.h:79
ContextDDA * contextDDA
Definition DDAStat.h:80
void initDefault()
Definition DDAStat.cpp:51
PointerAnalysis * pta
Definition PTAStat.h:74

◆ DDAStat() [2/2]

DDAStat::DDAStat ( ContextDDA pta)

Definition at line 46 of file DDAStat.cpp.

46 : PTAStat(pta), flowDDA(nullptr), contextDDA(pta)
47{
49}

Member Function Documentation

◆ getNumOfOOBQuery()

void DDAStat::getNumOfOOBQuery ( )

Definition at line 209 of file DDAStat.cpp.

210{
211 if (flowDDA)
213 else if (contextDDA)
215}
u32_t _TotalNumOfOutOfBudgetQuery
Definition DDAStat.h:83
DPTItemSet outOfBudgetDpms
out of budget dpm set

◆ getPTA()

PointerAnalysis * DDAStat::getPTA ( ) const

Definition at line 96 of file DDAStat.cpp.

97{
98 if(flowDDA)
99 return flowDDA;
100 else
101 return contextDDA;
102}

◆ getStrongUpdateStores()

NodeBS & SVF::DDAStat::getStrongUpdateStores ( )
inline

Definition at line 113 of file DDAStat.h.

114 {
115 return _StrongUpdateStores;
116 }
NodeBS _StrongUpdateStores
Definition DDAStat.h:66

◆ getSVFG()

SVFG * DDAStat::getSVFG ( ) const

Definition at line 87 of file DDAStat.cpp.

88{
89 if(flowDDA)
90 return flowDDA->getSVFG();
91 else
92 return contextDDA->getSVFG();
93
94}
SVFG * getSVFG() const
Return SVFG.

◆ initDefault()

void DDAStat::initDefault ( )
private

Definition at line 51 of file DDAStat.cpp.

52{
61
65 _NumOfNullPtr = 0;
73
74
75 _NumOfDPM = 0;
79
80 _NumOfStep = 0;
85}
u32_t _TotalNumOfStep
Definition DDAStat.h:89
u32_t _NumOfMustAliases
Definition DDAStat.h:56
u32_t _TotalNumOfInfeasiblePath
Definition DDAStat.h:87
u32_t _TotalPtsSize
Definition DDAStat.h:96
u32_t _MaxPtsSize
Definition DDAStat.h:94
double _AnaTimePerQuery
Definition DDAStat.h:61
double _AvgNumOfDPMAtSVFGNode
Definition DDAStat.h:101
u32_t _TotalNumOfMustAliases
Definition DDAStat.h:86
u32_t _TotalNumOfDPM
Definition DDAStat.h:84
u32_t _TotalCPtsSize
Definition DDAStat.h:95
u32_t _NumOfDPM
Definition DDAStat.h:54
u32_t _NumOfStrongUpdates
Definition DDAStat.h:55
u32_t _NumOfInfeasiblePath
Definition DDAStat.h:57
u32_t _TotalNumOfStrongUpdates
Definition DDAStat.h:85
u64_t _NumOfStep
Definition DDAStat.h:59
u32_t _MaxNumOfDPMAtSVFGNode
Definition DDAStat.h:102
u32_t _TotalNumOfQuery
Definition DDAStat.h:82
u32_t _NumOfConstantPtr
Definition DDAStat.h:98
u64_t _NumOfStepInCycle
Definition DDAStat.h:60
u32_t _NumOfNullPtr
Definition DDAStat.h:97
double _AnaTimeCyclePerQuery
Definition DDAStat.h:62
double _TotalTimeOfQueries
Definition DDAStat.h:63
u32_t _TotalNumOfStepInCycle
Definition DDAStat.h:90
u32_t _MaxCPtsSize
Definition DDAStat.h:93
u32_t _NumOfIndCallEdgeSolved
Definition DDAStat.h:92
u32_t _NumOfBlackholePtr
Definition DDAStat.h:99

◆ performStat()

void DDAStat::performStat ( )
overridevirtual

Implements SVF::SVFStat.

Definition at line 217 of file DDAStat.cpp.

218{
219
220 generalNumMap.clear();
221 PTNumStatMap.clear();
222 timeStatMap.clear();
223
225
227
229 {
230 PAGNode* pagNode = nodeIt->second;
231 if(SVFUtil::isa<ObjVar>(pagNode))
232 {
233 if(getPTA()->isLocalVarInRecursiveFun(nodeIt->first))
234 {
236 }
237 }
238 }
239
240 timeStatMap["TotalQueryTime"] = _TotalTimeOfQueries/TIMEINTERVAL;
242 timeStatMap["TotalBKCondTime"] = (_TotalTimeOfBKCondition/TIMEINTERVAL);
243
244 PTNumStatMap["NumOfQuery"] = _TotalNumOfQuery;
245 PTNumStatMap["NumOfOOBQuery"] = _TotalNumOfOutOfBudgetQuery;
246 PTNumStatMap["NumOfDPM"] = _TotalNumOfDPM;
248 PTNumStatMap["NumOfStoreSU"] = _StrongUpdateStores.count();
249 PTNumStatMap["NumOfStep"] = _TotalNumOfStep;
250 PTNumStatMap["NumOfStepInCycle"] = _TotalNumOfStepInCycle;
252 PTNumStatMap["MaxDPMAtLoc"] = _MaxNumOfDPMAtSVFGNode;
253 PTNumStatMap["MaxPathPerQuery"] = ContextCond::maximumPath;
254 PTNumStatMap["MaxCxtPerQuery"] = ContextCond::maximumCxt;
255 PTNumStatMap["MaxCPtsSize"] = _MaxCPtsSize;
256 PTNumStatMap["MaxPtsSize"] = _MaxPtsSize;
259 PTNumStatMap["IndEdgeSolved"] = getPTA()->getNumOfResolvedIndCallEdge();
260 PTNumStatMap["NumOfNullPtr"] = _NumOfNullPtr;
261 PTNumStatMap["PointsToConstPtr"] = _NumOfConstantPtr;
262 PTNumStatMap["PointsToBlkPtr"] = _NumOfBlackholePtr;
263 PTNumStatMap["NumOfMustAA"] = _TotalNumOfMustAliases;
264 PTNumStatMap["NumOfInfePath"] = _TotalNumOfInfeasiblePath;
266 timeStatMap["MemoryUsageVmrss"] = _vmrssUsageAfter - _vmrssUsageBefore;
267 timeStatMap["MemoryUsageVmsize"] = _vmsizeUsageAfter - _vmsizeUsageBefore;
268
269 printStat();
270}
#define TIMEINTERVAL
Definition SVFType.h:512
static u32_t maximumCxt
Definition DPItem.h:378
static u32_t maximumPath
Definition DPItem.h:379
PointerAnalysis * getPTA() const
Definition DDAStat.cpp:96
double _TotalTimeOfBKCondition
Definition DDAStat.h:64
void getNumOfOOBQuery()
Definition DDAStat.cpp:209
void printStat(std::string str="") override
Definition DDAStat.cpp:295
IDToNodeMapTy::const_iterator const_iterator
u32_t _vmsizeUsageBefore
Definition PTAStat.h:77
NodeBS localVarInRecursion
Definition PTAStat.h:54
u32_t _vmsizeUsageAfter
Definition PTAStat.h:78
u32_t _vmrssUsageAfter
Definition PTAStat.h:76
u32_t _vmrssUsageBefore
Definition PTAStat.h:75
void callgraphStat() override
Definition PTAStat.cpp:81
u32_t getNumOfResolvedIndCallEdge() const
Return number of resolved indirect call edges.
SVFStmt::SVFStmtSetTy & getPTASVFStmtSet(SVFStmt::PEDGEK kind)
Get PTA edges set according to its kind.
Definition SVFIR.h:207
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
Definition SVFIR.h:116
NUMStatMap generalNumMap
Definition SVFStat.h:76
NUMStatMap PTNumStatMap
Definition SVFStat.h:77
TIMEStatMap timeStatMap
Definition SVFStat.h:78
void set(unsigned Idx)
unsigned count() const
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ performStatPerQuery()

void DDAStat::performStatPerQuery ( NodeID  ptr)
overridevirtual

reset numbers for next query

Reimplemented from SVF::SVFStat.

Definition at line 104 of file DDAStat.cpp.

105{
106
107 u32_t NumOfDPM = 0;
108 u32_t NumOfLoc = 0;
110 u32_t cptsSize = 0;
112 if(flowDDA)
113 {
114 for(FlowDDA::LocToDPMVecMap::const_iterator it = flowDDA->getLocToDPMVecMap().begin(),
115 eit = flowDDA->getLocToDPMVecMap().end(); it!=eit; ++it)
116 {
117 NumOfLoc++;
118 u32_t num = it->second.size();
119 NumOfDPM += num;
122 }
124 pts = flowDDA->getPts(ptr);
125 }
126 else if(contextDDA)
127 {
128 for(ContextDDA::LocToDPMVecMap::const_iterator it = contextDDA->getLocToDPMVecMap().begin(),
129 eit = contextDDA->getLocToDPMVecMap().end(); it!=eit; ++it)
130 {
131 NumOfLoc++;
132 u32_t num = it->second.size();
133 NumOfDPM += num;
136 }
137 ContextCond cxt;
138 CxtVar var(cxt,ptr);
141 }
143
144 double avgDPMAtLoc = NumOfLoc!=0 ? (double)NumOfDPM/NumOfLoc : 0;
148
152
154 if(_MaxPtsSize < ptsSize)
156
157 if(cptsSize == 0)
159
160 if(getPTA()->containBlackHoleNode(pts))
161 {
163 }
164 if(getPTA()->containConstantNode(pts))
165 {
167 }
168
174
177
178 timeStatMap.clear();
179 NumPerQueryStatMap.clear();
180
181 timeStatMap["TimePerQuery"] = _AnaTimePerQuery/TIMEINTERVAL;
182 timeStatMap["CyleTimePerQuery"] = _AnaTimeCyclePerQuery/TIMEINTERVAL;
183
184 NumPerQueryStatMap["CPtsSize"] = cptsSize;
185 NumPerQueryStatMap["PtsSize"] = ptsSize;
186 NumPerQueryStatMap["NumOfStep"] = _NumOfStep;
187 NumPerQueryStatMap["NumOfStepInCycle"] = _NumOfStepInCycle;
188 NumPerQueryStatMap["NumOfDPM"] = _NumOfDPM;
191 NumPerQueryStatMap["AvgDPMAtLoc"] = avgDPMAtLoc;
192 NumPerQueryStatMap["MaxDPMAtLoc"] = maxNumOfDPMPerLoc;
193 NumPerQueryStatMap["MaxPathPerQuery"] = ContextCond::maximumPath;
195 NumPerQueryStatMap["NumOfMustAA"] = _NumOfMustAliases;
196 NumPerQueryStatMap["NumOfInfePath"] = _NumOfInfeasiblePath;
197
199 _NumOfStep = 0;
201 _NumOfDPM = 0;
207}
unsigned u32_t
Definition CommandLine.h:18
const PointsTo & getPts(NodeID id) override
virtual PointsTo getBVPointsTo(const CPtSet &cpts) const
Given a conditional pts return its bit vector points-to.
virtual const CPtSet & getPts(CVar id)
unsigned count() const
NUMStatMap NumPerQueryStatMap
Definition DDAStat.h:104
const LocToDPMVecMap & getLocToDPMVecMap() const
Map a SVFGNode to its dpms for handling value-flow cycles.
u32_t count() const
Returns number of elements.
Definition PointsTo.cpp:111

◆ printStat()

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

Reimplemented from SVF::SVFStat.

Definition at line 295 of file DDAStat.cpp.

296{
297
298 if(flowDDA)
299 {
302 }
303 else if(contextDDA)
304 {
306 }
307
308 SVFUtil::outs() << "\n****Demand-Driven Pointer Analysis Statistics****\n";
310}
ConstSVFGEdgeSet & getInsensitiveEdgeSet()
Return insensitive edge set.
Definition ContextDDA.h:207
OrderedSet< const SVFGEdge * > ConstSVFGEdgeSet
Definition DDAVFSolver.h:60
virtual void performSCCStat(SVFGEdgeSet insensitiveCalRetEdges)
Definition SVFGStat.cpp:369
SVFGStat * getStat() const
Return statistics.
Definition SVFG.h:126
virtual void printStat(std::string str="")
Definition SVFStat.cpp:67
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:50

◆ printStatPerQuery()

void DDAStat::printStatPerQuery ( NodeID  ptr,
const PointsTo pts 
)
overridevirtual

Reimplemented from SVF::SVFStat.

Definition at line 272 of file DDAStat.cpp.

273{
274
275 if (timeStatMap.empty() == false && NumPerQueryStatMap.empty() == false)
276 {
277 SVFUtil::outs().flags(std::ios::left);
278 unsigned field_width = 20;
279 SVFUtil::outs() << "---------------------Stat Per Query--------------------------------\n";
280 for (TIMEStatMap::iterator it = timeStatMap.begin(), eit = timeStatMap.end(); it != eit; ++it)
281 {
282 // format out put with width 20 space
283 SVFUtil::outs() << std::setw(field_width) << it->first << it->second << "\n";
284 }
285 for (NUMStatMap::iterator it = NumPerQueryStatMap.begin(), eit = NumPerQueryStatMap.end(); it != eit; ++it)
286 {
287 // format out put with width 20 space
288 SVFUtil::outs() << std::setw(field_width) << it->first << it->second << "\n";
289 }
290 }
291 getPTA()->dumpPts(ptr, pts);
292}
virtual void dumpPts(NodeID ptr, const PointsTo &pts)

Member Data Documentation

◆ _AnaTimeCyclePerQuery

double SVF::DDAStat::_AnaTimeCyclePerQuery

Definition at line 62 of file DDAStat.h.

◆ _AnaTimePerQuery

double SVF::DDAStat::_AnaTimePerQuery

Definition at line 61 of file DDAStat.h.

◆ _AvgNumOfDPMAtSVFGNode

double SVF::DDAStat::_AvgNumOfDPMAtSVFGNode
private

Definition at line 101 of file DDAStat.h.

◆ _MaxCPtsSize

u32_t SVF::DDAStat::_MaxCPtsSize
private

Definition at line 93 of file DDAStat.h.

◆ _MaxNumOfDPMAtSVFGNode

u32_t SVF::DDAStat::_MaxNumOfDPMAtSVFGNode
private

Definition at line 102 of file DDAStat.h.

◆ _MaxPtsSize

u32_t SVF::DDAStat::_MaxPtsSize
private

Definition at line 94 of file DDAStat.h.

◆ _NumOfBlackholePtr

u32_t SVF::DDAStat::_NumOfBlackholePtr
private

Definition at line 99 of file DDAStat.h.

◆ _NumOfConstantPtr

u32_t SVF::DDAStat::_NumOfConstantPtr
private

Definition at line 98 of file DDAStat.h.

◆ _NumOfDPM

u32_t SVF::DDAStat::_NumOfDPM

Definition at line 54 of file DDAStat.h.

◆ _NumOfIndCallEdgeSolved

u32_t SVF::DDAStat::_NumOfIndCallEdgeSolved
private

Definition at line 92 of file DDAStat.h.

◆ _NumOfInfeasiblePath

u32_t SVF::DDAStat::_NumOfInfeasiblePath

Definition at line 57 of file DDAStat.h.

◆ _NumOfMustAliases

u32_t SVF::DDAStat::_NumOfMustAliases

Definition at line 56 of file DDAStat.h.

◆ _NumOfNullPtr

u32_t SVF::DDAStat::_NumOfNullPtr
private

Definition at line 97 of file DDAStat.h.

◆ _NumOfStep

u64_t SVF::DDAStat::_NumOfStep

Definition at line 59 of file DDAStat.h.

◆ _NumOfStepInCycle

u64_t SVF::DDAStat::_NumOfStepInCycle

Definition at line 60 of file DDAStat.h.

◆ _NumOfStrongUpdates

u32_t SVF::DDAStat::_NumOfStrongUpdates

Definition at line 55 of file DDAStat.h.

◆ _StrongUpdateStores

NodeBS SVF::DDAStat::_StrongUpdateStores

Definition at line 66 of file DDAStat.h.

◆ _TotalCPtsSize

u32_t SVF::DDAStat::_TotalCPtsSize
private

Definition at line 95 of file DDAStat.h.

◆ _TotalNumOfDPM

u32_t SVF::DDAStat::_TotalNumOfDPM
private

Definition at line 84 of file DDAStat.h.

◆ _TotalNumOfInfeasiblePath

u32_t SVF::DDAStat::_TotalNumOfInfeasiblePath
private

Definition at line 87 of file DDAStat.h.

◆ _TotalNumOfMustAliases

u32_t SVF::DDAStat::_TotalNumOfMustAliases
private

Definition at line 86 of file DDAStat.h.

◆ _TotalNumOfOutOfBudgetQuery

u32_t SVF::DDAStat::_TotalNumOfOutOfBudgetQuery
private

Definition at line 83 of file DDAStat.h.

◆ _TotalNumOfQuery

u32_t SVF::DDAStat::_TotalNumOfQuery
private

Definition at line 82 of file DDAStat.h.

◆ _TotalNumOfStep

u32_t SVF::DDAStat::_TotalNumOfStep
private

Definition at line 89 of file DDAStat.h.

◆ _TotalNumOfStepInCycle

u32_t SVF::DDAStat::_TotalNumOfStepInCycle
private

Definition at line 90 of file DDAStat.h.

◆ _TotalNumOfStrongUpdates

u32_t SVF::DDAStat::_TotalNumOfStrongUpdates
private

Definition at line 85 of file DDAStat.h.

◆ _TotalPtsSize

u32_t SVF::DDAStat::_TotalPtsSize
private

Definition at line 96 of file DDAStat.h.

◆ _TotalTimeOfBKCondition

double SVF::DDAStat::_TotalTimeOfBKCondition

Definition at line 64 of file DDAStat.h.

◆ _TotalTimeOfQueries

double SVF::DDAStat::_TotalTimeOfQueries

Definition at line 63 of file DDAStat.h.

◆ contextDDA

ContextDDA* SVF::DDAStat::contextDDA
private

Definition at line 80 of file DDAStat.h.

◆ flowDDA

FlowDDA* SVF::DDAStat::flowDDA
private

Definition at line 79 of file DDAStat.h.

◆ NumPerQueryStatMap

NUMStatMap SVF::DDAStat::NumPerQueryStatMap
private

Definition at line 104 of file DDAStat.h.


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