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

#include <WPAStat.h>

Inheritance diagram for SVF::VersionedFlowSensitiveStat:
SVF::PTAStat SVF::SVFStat

Public Member Functions

 VersionedFlowSensitiveStat (VersionedFlowSensitive *pta)
 
virtual ~VersionedFlowSensitiveStat ()
 
virtual void performStat ()
 
- 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 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

VersionedFlowSensitivevfspta
 
- 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 clearStat ()
 
void versionStat (void)
 For all version-related statistics.
 
void ptsSizeStat (void)
 For all PTS size related statistics not handled by versionStat.
 

Private Attributes

u32_t _NumVersions
 Total number of versions across all objects.
 
u32_t _MaxVersions
 Most versions for a single object.
 
u32_t _NumUsedVersions
 Number of version PTSs actually used (sum of next two fields).
 
u32_t _NumNonEmptyVersions
 Number of versions with non-empty points-to sets (since versioning is over-approximate).
 
u32_t _NumEmptyVersions
 Number of versions with empty points-to sets (actually empty, not never-accessed).
 
u32_t _NumSingleVersion
 Number of objects which have a single version.
 
u32_t _MaxPtsSize
 Largest PTS size.
 
u32_t _MaxTopLvlPtsSize
 Max points-to set size in top-level pointers.
 
u32_t _MaxVersionPtsSize
 Max address-taken points-to set size.
 
u32_t _TotalPtsSize
 Total of points-to set sizes for calculating averages.
 
double _AvgPtsSize
 Average size across all points-to sets.
 
double _AvgTopLvlPtsSize
 Average points-to set size for top-level pointers.
 
double _AvgVersionPtsSize
 Average points-to set size for address-taken objects.
 

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

Definition at line 165 of file WPAStat.h.

Constructor & Destructor Documentation

◆ VersionedFlowSensitiveStat()

SVF::VersionedFlowSensitiveStat::VersionedFlowSensitiveStat ( VersionedFlowSensitive pta)
inline

Definition at line 170 of file WPAStat.h.

170 : PTAStat(pta)
171 {
172 vfspta = pta;
173 clearStat();
174 startClk();
175 }
PointerAnalysis * pta
Definition PTAStat.h:74
PTAStat(PointerAnalysis *p)
Definition PTAStat.cpp:39
virtual void startClk()
Definition SVFStat.h:58
VersionedFlowSensitive * vfspta
Definition WPAStat.h:168

◆ ~VersionedFlowSensitiveStat()

virtual SVF::VersionedFlowSensitiveStat::~VersionedFlowSensitiveStat ( )
inlinevirtual

Definition at line 177 of file WPAStat.h.

177{ }

Member Function Documentation

◆ clearStat()

void VersionedFlowSensitiveStat::clearStat ( )
private

Definition at line 18 of file VersionedFlowSensitiveStat.cpp.

19{
20 _NumVersions = 0;
21 _MaxVersions = 0;
26 _MaxPtsSize = 0;
29 _TotalPtsSize = 0;
30 _AvgPtsSize = 0.0;
33}
double _AvgVersionPtsSize
Average points-to set size for address-taken objects.
Definition WPAStat.h:218
u32_t _NumSingleVersion
Number of objects which have a single version.
Definition WPAStat.h:201
u32_t _NumEmptyVersions
Number of versions with empty points-to sets (actually empty, not never-accessed).
Definition WPAStat.h:199
u32_t _NumNonEmptyVersions
Number of versions with non-empty points-to sets (since versioning is over-approximate).
Definition WPAStat.h:197
u32_t _TotalPtsSize
Total of points-to set sizes for calculating averages.
Definition WPAStat.h:211
double _AvgPtsSize
Average size across all points-to sets.
Definition WPAStat.h:214
u32_t _NumVersions
Total number of versions across all objects.
Definition WPAStat.h:191
double _AvgTopLvlPtsSize
Average points-to set size for top-level pointers.
Definition WPAStat.h:216
u32_t _MaxVersionPtsSize
Max address-taken points-to set size.
Definition WPAStat.h:208
u32_t _MaxPtsSize
Largest PTS size.
Definition WPAStat.h:204
u32_t _MaxVersions
Most versions for a single object.
Definition WPAStat.h:193
u32_t _MaxTopLvlPtsSize
Max points-to set size in top-level pointers.
Definition WPAStat.h:206
u32_t _NumUsedVersions
Number of version PTSs actually used (sum of next two fields).
Definition WPAStat.h:195

◆ performStat()

void VersionedFlowSensitiveStat::performStat ( )
virtual

Reimplemented from SVF::PTAStat.

Definition at line 35 of file VersionedFlowSensitiveStat.cpp.

36{
37 // Largely based on that in FlowSensitiveStat. Would be better to split the FSStat version
38 // and reuse code rather than copy.
39 assert(SVFUtil::isa<VersionedFlowSensitive>(vfspta) && "VFSStat::performStat: not given VFSPTA.");
40 endClk();
41
42 clearStat();
43
44 SVFIR *pag = vfspta->getPAG();
45
48
51 Set<SymID> nodeSet;
52 for (SVFIR::const_iterator it = pag->begin(); it != pag->end(); ++it)
53 {
54 NodeID nodeId = it->first;
55 PAGNode* pagNode = it->second;
56 if (SVFUtil::isa<ObjVar>(pagNode))
57 {
58 const MemObj *memObj = pag->getBaseObj(nodeId);
60 if (nodeSet.insert(baseId).second)
61 {
62 if (memObj->isFieldInsensitive()) fiObjNumber++;
63 else fsObjNumber++;
64 }
65 }
66 }
67
68 PTNumStatMap["FIObjNum"] = fiObjNumber;
69 PTNumStatMap["FSObjNum"] = fsObjNumber;
70
71 unsigned numOfCopy = 0;
72 unsigned numOfStore = 0;
73 for (SVFG::iterator it = vfspta->svfg->begin(); it != vfspta->svfg->end(); ++it)
74 {
75 SVFGNode* svfgNode = it->second;
76 if (SVFUtil::isa<CopySVFGNode>(svfgNode)) numOfCopy++;
77 else if (SVFUtil::isa<StoreSVFGNode>(svfgNode)) numOfStore++;
78 }
79
81
82 timeStatMap["TotalTime"] = (endTime - startTime)/TIMEINTERVAL;
83 timeStatMap["SolveTime"] = vfspta->solveTime;
84 timeStatMap["SCCTime"] = vfspta->sccTime;
85 timeStatMap["ProcessTime"] = vfspta->processTime;
86 timeStatMap["PropagationTime"] = vfspta->propagationTime;
87 timeStatMap["DirectPropaTime"] = vfspta->directPropaTime;
88 timeStatMap["IndirectPropaTime"] = vfspta->indirectPropaTime;
89 timeStatMap["Strong/WeakUpdTime"] = vfspta->updateTime;
90 timeStatMap["AddrTime"] = vfspta->addrTime;
91 timeStatMap["CopyTime"] = vfspta->copyTime;
92 timeStatMap["GepTime"] = vfspta->gepTime;
93 timeStatMap["LoadTime"] = vfspta->loadTime;
94 timeStatMap["StoreTime"] = vfspta->storeTime;
95 timeStatMap["UpdateCGTime"] = vfspta->updateCallGraphTime;
96 timeStatMap["PhiTime"] = vfspta->phiTime;
97 timeStatMap["meldLabelingTime"] = vfspta->meldLabelingTime;
98 timeStatMap["PrelabelingTime"] = vfspta->prelabelingTime;
99 timeStatMap["VersionPropTime"] = vfspta->versionPropTime;
100
101 PTNumStatMap["TotalPointers"] = pag->getValueNodeNum() + pag->getFieldValNodeNum();
102 PTNumStatMap["TotalObjects"] = pag->getObjectNodeNum() + pag->getFieldObjNodeNum();
103
104 PTNumStatMap["Pointers"] = pag->getValueNodeNum();
105 PTNumStatMap["MemObjects"] = pag->getObjectNodeNum();
106 PTNumStatMap["DummyFieldPtrs"] = pag->getFieldValNodeNum();
107 PTNumStatMap["FieldObjs"] = pag->getFieldObjNodeNum();
108
109 PTNumStatMap["TotalVersions"] = _NumVersions;
110 PTNumStatMap["MaxVersionsForObj"] = _MaxVersions;
111 PTNumStatMap["TotalNonEmptyVPts"] = _NumNonEmptyVersions;
112 PTNumStatMap["TotalEmptyVPts"] = _NumEmptyVersions;
113 PTNumStatMap["TotalExistingVPts"] = _NumUsedVersions;
114 PTNumStatMap["TotalSingleVObjs"] = _NumSingleVersion;
115
116 PTNumStatMap["CopysNum"] = numOfCopy;
117 PTNumStatMap["StoresNum"] = numOfStore;
118
119 PTNumStatMap["SolveIterations"] = vfspta->numOfIteration;
120
121 PTNumStatMap["IndEdgeSolved"] = vfspta->getNumOfResolvedIndCallEdge();
122
123 PTNumStatMap["StrongUpdates"] = vfspta->svfgHasSU.count();
124
125 PTNumStatMap["MaxPtsSize"] = _MaxPtsSize;
126 PTNumStatMap["MaxTopLvlPtsSize"] = _MaxTopLvlPtsSize;
127 PTNumStatMap["MaxVersionPtsSize"] = _MaxVersionPtsSize;
128
129 timeStatMap["AvgPtsSize"] = _AvgPtsSize;
130 timeStatMap["AvgTopLvlPtsSize"] = _AvgTopLvlPtsSize;
131 timeStatMap["AvgVersionPtsSize"] = _AvgVersionPtsSize;
132
133 PTNumStatMap["ProcessedAddr"] = vfspta->numOfProcessedAddr;
134 PTNumStatMap["ProcessedCopy"] = vfspta->numOfProcessedCopy;
135 PTNumStatMap["ProcessedGep"] = vfspta->numOfProcessedGep;
136 PTNumStatMap["ProcessedLoad"] = vfspta->numOfProcessedLoad;
137 PTNumStatMap["ProcessedStore"] = vfspta->numOfProcessedStore;
138 PTNumStatMap["ProcessedPhi"] = vfspta->numOfProcessedPhi;
139 PTNumStatMap["ProcessedAParam"] = vfspta->numOfProcessedActualParam;
140 PTNumStatMap["ProcessedFRet"] = vfspta->numOfProcessedFormalRet;
141 PTNumStatMap["ProcessedMSSANode"] = vfspta->numOfProcessedMSSANode;
142
143 PTNumStatMap["NumOfNodesInSCC"] = vfspta->numOfNodesInSCC;
144 PTNumStatMap["MaxSCCSize"] = vfspta->maxSCCSize;
145 PTNumStatMap["NumOfSCC"] = vfspta->numOfSCC;
146 timeStatMap["AverageSCCSize"] = (vfspta->numOfSCC == 0) ? 0 :
147 ((double)vfspta->numOfNodesInSCC / vfspta->numOfSCC);
148
149 PTAStat::printStat("Versioned Flow-Sensitive Pointer Analysis Statistics");
150}
unsigned u32_t
Definition CommandLine.h:18
#define TIMEINTERVAL
Definition SVFType.h:512
u32_t numOfProcessedLoad
Number of processed Phi node.
u32_t numOfProcessedCopy
Number of processed Addr node.
double gepTime
time of handling gep edges
double indirectPropaTime
time of points-to propagation of top-level pointers
double addrTime
time of handling address edges
double solveTime
time of solve.
u32_t numOfProcessedStore
Number of processed Load node.
double storeTime
time of store edges
double copyTime
time of handling copy edges
u32_t numOfProcessedGep
Number of processed Copy node.
u32_t maxSCCSize
Number of processed mssa node.
double loadTime
time of load edges
u32_t numOfProcessedActualParam
Number of processed Store node.
u32_t numOfProcessedPhi
Number of processed Gep node.
double propagationTime
time of points-to propagation.
u32_t numOfProcessedFormalRet
Number of processed actual param node.
double directPropaTime
time of points-to propagation of address-taken objects
double processTime
time of processNode.
u32_t numOfProcessedAddr
Statistics.
double phiTime
time of phi nodes.
double sccTime
time of SCC detection.
double updateTime
time of strong/weak updates.
u32_t numOfProcessedMSSANode
Number of processed formal ret node.
double updateCallGraphTime
time of updating call graph
iterator begin()
Iterators.
IDToNodeMapTy::const_iterator const_iterator
IDToNodeMapTy::iterator iterator
Node Iterators.
u32_t getValueNodeNum() const
Definition IRGraph.h:186
u32_t getObjectNodeNum() const
Definition IRGraph.h:190
SymID getId() const
Get the memory object id.
void performStat() override
Definition PTAStat.cpp:52
SVFIR * getPAG() const
u32_t getNumOfResolvedIndCallEdge() const
Return number of resolved indirect call edges.
u32_t getFieldObjNodeNum() const
Definition SVFIR.h:339
const MemObj * getBaseObj(NodeID id) const
Definition SVFIR.h:481
u32_t getFieldValNodeNum() const
Node and edge statistics.
Definition SVFIR.h:335
NUMStatMap PTNumStatMap
Definition SVFStat.h:77
virtual void printStat(std::string str="")
Definition SVFStat.cpp:67
virtual void endClk()
Definition SVFStat.h:63
TIMEStatMap timeStatMap
Definition SVFStat.h:78
double endTime
Definition SVFStat.h:81
double startTime
Definition SVFStat.h:80
unsigned count() const
void ptsSizeStat(void)
For all PTS size related statistics not handled by versionStat.
void versionStat(void)
For all version-related statistics.
double meldLabelingTime
Time to meld label SVFG.
double prelabelingTime
Time to prelabel SVFG.
double versionPropTime
Time to propagate versions to versions which rely on them.
u32_t numOfIteration
num of iterations during constraint solving
Definition WPASolver.h:200
u32_t NodeID
Definition GeneralType.h:55
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
unsigned SymID
Definition GeneralType.h:57

◆ ptsSizeStat()

void VersionedFlowSensitiveStat::ptsSizeStat ( void  )
private

For all PTS size related statistics not handled by versionStat.

Definition at line 196 of file VersionedFlowSensitiveStat.cpp.

197{
200 for (SVFIR::iterator it = vfspta->getPAG()->begin(); it != vfspta->getPAG()->end(); ++it)
201 {
202 if (!vfspta->getPAG()->isValidTopLevelPtr(it->second)) continue;
203
204 NodeID p = it->first;
205
207
208 u32_t size = vfspta->getPts(p).count();
209 totalTopLvlPtsSize += size;
210 if (size > _MaxTopLvlPtsSize) _MaxTopLvlPtsSize = size;
211 }
212
214
216
218 {
220 }
221
223}
cJSON * p
Definition cJSON.cpp:2559
const PointsTo & getPts(NodeID id) override
u32_t count() const
Returns number of elements.
Definition PointsTo.cpp:111
bool isValidTopLevelPtr(const SVFVar *node)
Definition SVFIR.cpp:685

◆ versionStat()

void VersionedFlowSensitiveStat::versionStat ( void  )
private

For all version-related statistics.

Definition at line 152 of file VersionedFlowSensitiveStat.cpp.

153{
154 // TODO! Need to merge yield/consume.
156 _MaxVersions = 0;
157
160 {
162 })
163 {
165 {
166 for (const VersionedFlowSensitive::ObjToVersionMap::value_type &ov : lov)
167 {
168 const NodeID o = ov.first;
169 const Version v = ov.second;
170
171 ++_NumVersions;
172
173 // If the version was just over-approximate and never accessed, ignore.
174 // TODO: with vPtD changed there is no interface to check if the PTS
175 // exists; an emptiness check is *not* an existence check.
176 if (vfspta->vPtD->getPts(vfspta->atKey(o, v)).empty()) continue;
177
178 const PointsTo &ovPts = vfspta->vPtD->getPts(vfspta->atKey(o, v));
179 if (!ovPts.empty()) ++_NumNonEmptyVersions;
180 else ++_NumEmptyVersions;
181
182 _TotalPtsSize += ovPts.count();
183 totalVersionPtsSize += ovPts.count();
184 if (ovPts.count() > _MaxVersionPtsSize) _MaxVersionPtsSize = ovPts.count();
185 }
186 }
187 }
188
190
192
194}
BVDataPTAImpl::VersionedPTDataTy * vPtD
Points-to DS for working with versions.
LocVersionMap yield
Actual yield map. Yield analogue to consume.
static VersionedVar atKey(NodeID, Version)
Return key into vPtD for address-taken var of a specific version.
std::vector< ObjToVersionMap > LocVersionMap
Map< NodeID, Version > ObjToVersionMap
unsigned Version

Member Data Documentation

◆ _AvgPtsSize

double SVF::VersionedFlowSensitiveStat::_AvgPtsSize
private

Average size across all points-to sets.

Definition at line 214 of file WPAStat.h.

◆ _AvgTopLvlPtsSize

double SVF::VersionedFlowSensitiveStat::_AvgTopLvlPtsSize
private

Average points-to set size for top-level pointers.

Definition at line 216 of file WPAStat.h.

◆ _AvgVersionPtsSize

double SVF::VersionedFlowSensitiveStat::_AvgVersionPtsSize
private

Average points-to set size for address-taken objects.

Definition at line 218 of file WPAStat.h.

◆ _MaxPtsSize

u32_t SVF::VersionedFlowSensitiveStat::_MaxPtsSize
private

Largest PTS size.

Definition at line 204 of file WPAStat.h.

◆ _MaxTopLvlPtsSize

u32_t SVF::VersionedFlowSensitiveStat::_MaxTopLvlPtsSize
private

Max points-to set size in top-level pointers.

Definition at line 206 of file WPAStat.h.

◆ _MaxVersionPtsSize

u32_t SVF::VersionedFlowSensitiveStat::_MaxVersionPtsSize
private

Max address-taken points-to set size.

Definition at line 208 of file WPAStat.h.

◆ _MaxVersions

u32_t SVF::VersionedFlowSensitiveStat::_MaxVersions
private

Most versions for a single object.

Definition at line 193 of file WPAStat.h.

◆ _NumEmptyVersions

u32_t SVF::VersionedFlowSensitiveStat::_NumEmptyVersions
private

Number of versions with empty points-to sets (actually empty, not never-accessed).

Definition at line 199 of file WPAStat.h.

◆ _NumNonEmptyVersions

u32_t SVF::VersionedFlowSensitiveStat::_NumNonEmptyVersions
private

Number of versions with non-empty points-to sets (since versioning is over-approximate).

Definition at line 197 of file WPAStat.h.

◆ _NumSingleVersion

u32_t SVF::VersionedFlowSensitiveStat::_NumSingleVersion
private

Number of objects which have a single version.

Definition at line 201 of file WPAStat.h.

◆ _NumUsedVersions

u32_t SVF::VersionedFlowSensitiveStat::_NumUsedVersions
private

Number of version PTSs actually used (sum of next two fields).

Definition at line 195 of file WPAStat.h.

◆ _NumVersions

u32_t SVF::VersionedFlowSensitiveStat::_NumVersions
private

Total number of versions across all objects.

Definition at line 191 of file WPAStat.h.

◆ _TotalPtsSize

u32_t SVF::VersionedFlowSensitiveStat::_TotalPtsSize
private

Total of points-to set sizes for calculating averages.

Definition at line 211 of file WPAStat.h.

◆ vfspta

VersionedFlowSensitive* SVF::VersionedFlowSensitiveStat::vfspta

Definition at line 168 of file WPAStat.h.


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