16 using namespace SVFUtil;
22 _NumNonEmptyVersions = 0;
23 _NumSingleVersion = 0;
25 _NumEmptyVersions = 0;
27 _MaxTopLvlPtsSize = 0;
28 _MaxVersionPtsSize = 0;
31 _AvgTopLvlPtsSize = 0.0;
32 _AvgVersionPtsSize = 0.0;
39 assert(SVFUtil::isa<VersionedFlowSensitive>(vfspta) &&
"VFSStat::performStat: not given VFSPTA.");
49 u32_t fiObjNumber = 0;
50 u32_t fsObjNumber = 0;
56 if (SVFUtil::isa<ObjVar>(pagNode))
60 if (nodeSet.insert(baseId).second)
68 PTNumStatMap[
"FIObjNum"] = fiObjNumber;
69 PTNumStatMap[
"FSObjNum"] = fsObjNumber;
71 unsigned numOfCopy = 0;
72 unsigned numOfStore = 0;
73 for (
SVFG::iterator it = vfspta->svfg->begin(); it != vfspta->svfg->end(); ++it)
76 if (SVFUtil::isa<CopySVFGNode>(svfgNode)) numOfCopy++;
77 else if (SVFUtil::isa<StoreSVFGNode>(svfgNode)) numOfStore++;
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;
109 PTNumStatMap[
"TotalVersions"] = _NumVersions;
110 PTNumStatMap[
"MaxVersionsForObj"] = _MaxVersions;
111 PTNumStatMap[
"TotalNonEmptyVPts"] = _NumNonEmptyVersions;
112 PTNumStatMap[
"TotalEmptyVPts"] = _NumEmptyVersions;
113 PTNumStatMap[
"TotalExistingVPts"] = _NumUsedVersions;
114 PTNumStatMap[
"TotalSingleVObjs"] = _NumSingleVersion;
116 PTNumStatMap[
"CopysNum"] = numOfCopy;
117 PTNumStatMap[
"StoresNum"] = numOfStore;
119 PTNumStatMap[
"SolveIterations"] = vfspta->numOfIteration;
121 PTNumStatMap[
"IndEdgeSolved"] = vfspta->getNumOfResolvedIndCallEdge();
123 PTNumStatMap[
"StrongUpdates"] = vfspta->svfgHasSU.count();
125 PTNumStatMap[
"MaxPtsSize"] = _MaxPtsSize;
126 PTNumStatMap[
"MaxTopLvlPtsSize"] = _MaxTopLvlPtsSize;
127 PTNumStatMap[
"MaxVersionPtsSize"] = _MaxVersionPtsSize;
129 timeStatMap[
"AvgPtsSize"] = _AvgPtsSize;
130 timeStatMap[
"AvgTopLvlPtsSize"] = _AvgTopLvlPtsSize;
131 timeStatMap[
"AvgVersionPtsSize"] = _AvgVersionPtsSize;
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;
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);
155 _NumSingleVersion = 0;
158 u32_t totalVersionPtsSize = 0;
161 &vfspta->consume, &vfspta->yield
166 for (
const VersionedFlowSensitive::ObjToVersionMap::value_type &ov : lov)
168 const NodeID o = ov.first;
176 if (vfspta->vPtD->getPts(vfspta->atKey(o, v)).empty())
continue;
178 const PointsTo &ovPts = vfspta->vPtD->getPts(vfspta->atKey(o, v));
179 if (!ovPts.
empty()) ++_NumNonEmptyVersions;
180 else ++_NumEmptyVersions;
182 _TotalPtsSize += ovPts.
count();
183 totalVersionPtsSize += ovPts.
count();
184 if (ovPts.
count() > _MaxVersionPtsSize) _MaxVersionPtsSize = ovPts.
count();
189 _NumUsedVersions = _NumNonEmptyVersions + _NumEmptyVersions;
191 if (_NumNonEmptyVersions != 0) _AvgVersionPtsSize = (double)totalVersionPtsSize / (
double)_NumUsedVersions;
193 _TotalPtsSize += totalVersionPtsSize;
198 u32_t totalValidTopLvlPointers = 0;
199 u32_t totalTopLvlPtsSize = 0;
200 for (
SVFIR::iterator it = vfspta->getPAG()->begin(); it != vfspta->getPAG()->end(); ++it)
202 if (!vfspta->getPAG()->isValidTopLevelPtr(it->second))
continue;
206 totalValidTopLvlPointers++;
208 u32_t size = vfspta->getPts(
p).count();
209 totalTopLvlPtsSize += size;
210 if (size > _MaxTopLvlPtsSize) _MaxTopLvlPtsSize = size;
213 if (totalValidTopLvlPointers != 0) _AvgTopLvlPtsSize = (double)totalTopLvlPtsSize / (
double)totalValidTopLvlPointers;
215 _TotalPtsSize += totalTopLvlPtsSize;
217 if (_NumNonEmptyVersions + totalValidTopLvlPointers != 0)
219 _AvgPtsSize = (double)_TotalPtsSize / (
double)(_NumNonEmptyVersions + totalValidTopLvlPointers);
222 _MaxPtsSize = _MaxVersionPtsSize > _MaxTopLvlPtsSize ? _MaxVersionPtsSize : _MaxTopLvlPtsSize;
iterator begin()
Iterators.
IDToNodeMapTy::const_iterator const_iterator
IDToNodeMapTy::iterator iterator
Node Iterators.
u32_t getValueNodeNum() const
u32_t getObjectNodeNum() const
SymID getId() const
Get the memory object id.
bool isFieldInsensitive() const
Return true if its field limit is 0.
void performStat() override
bool empty() const
Returns true if set is empty.
u32_t count() const
Returns number of elements.
static SVFIR * getPAG(bool buildFromFile=false)
Singleton design here to make sure we only have one instance during any analysis.
u32_t getFieldObjNodeNum() const
u32_t getFieldValNodeNum() const
Node and edge statistics.
const MemObj * getBaseObj(NodeID id) const
virtual void printStat(std::string str="")
void ptsSizeStat(void)
For all PTS size related statistics not handled by versionStat.
void versionStat(void)
For all version-related statistics.
virtual void performStat()
std::vector< ObjToVersionMap > LocVersionMap
Map< NodeID, Version > ObjToVersionMap
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set