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

#include <MTAStat.h>

Inheritance diagram for SVF::MTAStat:
SVF::PTAStat SVF::SVFStat

Public Types

typedef Set< const Instruction * > InstSet
 
- Public Types inherited from SVF::SVFStat
enum  ClockType { Wall , CPU }
 
typedef OrderedMap< std::string, u32_tNUMStatMap
 
typedef OrderedMap< std::string, doubleTIMEStatMap
 

Public Member Functions

 MTAStat ()
 Constructor.
 
void performThreadCallGraphStat (ThreadCallGraph *tcg)
 Statistics for thread call graph.
 
void performTCTStat (TCT *tct)
 Statistics for thread creation tree.
 
void performMHPPairStat (MHP *mhp, LockAnalysis *lsa)
 Statistics for MHP statement pairs.
 
- 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 ()
 
virtual void printStat (std::string str="")
 
virtual void performStatPerQuery (NodeID)
 
virtual void printStatPerQuery (NodeID, const PointsTo &)
 

Public Attributes

double TCTTime
 Statistics for annotation.
 
double MHPTime
 
double AnnotationTime
 
- Public Attributes inherited from SVF::PTAStat
NodeBS localVarInRecursion
 
- Public Attributes inherited from SVF::SVFStat
NUMStatMap generalNumMap
 
NUMStatMap PTNumStatMap
 
TIMEStatMap timeStatMap
 
double startTime
 
double endTime
 

Additional Inherited Members

- 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 for MTA

Definition at line 47 of file MTAStat.h.

Member Typedef Documentation

◆ InstSet

Definition at line 51 of file MTAStat.h.

Constructor & Destructor Documentation

◆ MTAStat()

SVF::MTAStat::MTAStat ( )
inline

Constructor.

Definition at line 54 of file MTAStat.h.

54 :PTAStat(nullptr),TCTTime(0),MHPTime(0),AnnotationTime(0)
55 {
56 }
double TCTTime
Statistics for annotation.
Definition MTAStat.h:66
double AnnotationTime
Definition MTAStat.h:68
double MHPTime
Definition MTAStat.h:67
PTAStat(PointerAnalysis *p)
Definition PTAStat.cpp:39

Member Function Documentation

◆ performMHPPairStat()

void MTAStat::performMHPPairStat ( MHP mhp,
LockAnalysis lsa 
)

Statistics for MHP statement pairs.

Iterate every memory access pairs write vs read write vs write

Definition at line 112 of file MTAStat.cpp.

113{
114
115 SVFIR* pag = SVFIR::getPAG();
117 {
120 SVFModule* mod = mhp->getTCT()->getSVFModule();
121 for (const SVFFunction* fun : mod->getFunctionSet())
122 {
123 if(SVFUtil::isExtCall(fun))
124 continue;
125 if(!mhp->isConnectedfromMain(fun))
126 continue;
127 for (SVFFunction::const_iterator bit = fun->begin(), ebit = fun->end(); bit != ebit; ++bit)
128 {
129 const SVFBasicBlock* bb = *bit;
130 for (const auto& icfgNode : bb->getICFGNodeList())
131 {
132 for(const SVFStmt* stmt : pag->getSVFStmtList(icfgNode))
133 {
134 if(SVFUtil::isa<LoadStmt>(stmt))
135 {
136 instSet1.insert(stmt->getICFGNode());
137 }
138 else if(SVFUtil::isa<StoreStmt>(stmt))
139 {
140 instSet1.insert(stmt->getICFGNode());
141 instSet2.insert(stmt->getICFGNode());
142 }
143 }
144 }
145 }
146 }
147
148
150 {
152 {
154 }
155 }
156 }
157
158
159 generalNumMap.clear();
160 PTNumStatMap.clear();
161 timeStatMap.clear();
162 PTNumStatMap["TotalMHPQueries"] = mhp->numOfTotalQueries;
163 PTNumStatMap["NumOfMHPPairs"] = mhp->numOfMHPQueries;
164 PTNumStatMap["TotalLockQueries"] = lsa->numOfTotalQueries;
165 PTNumStatMap["NumOfLockedPairs"] = lsa->numOfLockedQueries;
166 PTNumStatMap["NumOfCxtLocks"] = lsa->getNumOfCxtLocks();
167 timeStatMap["InterlevAnaTime"] = mhp->interleavingTime;
168 timeStatMap["LockAnaTime"] = lsa->lockTime;
169 timeStatMap["InterlevQueryTime"] = mhp->interleavingQueriesTime;
170 timeStatMap["LockQueryTime"] = lsa->lockQueriesTime;
171 timeStatMap["MHPAnalysisTime"] = MHPTime;
172
173 SVFUtil::outs() << "\n****MHP Stmt Pairs Statistics****\n";
175}
u32_t numOfTotalQueries
Total number of queries.
Definition MHP.h:262
virtual bool mayHappenInParallel(const ICFGNode *i1, const ICFGNode *i2)
Interface to query whether two instructions may happen-in-parallel.
Definition MHP.cpp:614
bool isConnectedfromMain(const SVFFunction *fun)
Whether the function is connected from main function in thread call graph.
Definition MHP.cpp:521
double interleavingQueriesTime
Definition MHP.h:265
u32_t numOfMHPQueries
Number of queries are answered as may-happen-in-parallel.
Definition MHP.h:263
double interleavingTime
Definition MHP.h:264
TCT * getTCT() const
Get Thread Creation Tree.
Definition MHP.h:80
static const Option< bool > AllPairMHP
Definition Options.h:163
std::vector< constSVFBasicBlock * >::const_iterator const_iterator
Definition SVFValue.h:305
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
virtual void printStat(std::string str="")
Definition SVFStat.cpp:67
TIMEStatMap timeStatMap
Definition SVFStat.h:78
SVFModule * getSVFModule() const
Get SVFFModule.
Definition TCT.h:190
bool isExtCall(const SVFFunction *fun)
Definition SVFUtil.h:278
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:50
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Definition GeneralType.h:96

◆ performTCTStat()

void MTAStat::performTCTStat ( TCT tct)

Statistics for thread creation tree.

Definition at line 92 of file MTAStat.cpp.

93{
94
95 PTNumStatMap.clear();
96 timeStatMap.clear();
97 PTNumStatMap["NumOfCandidateFun"] = tct->getMakredProcs().size();
98 PTNumStatMap["NumOfTotalFun"] = tct->getThreadCallGraph()->getTotalNodeNum();
99 PTNumStatMap["NumOfTCTNode"] = tct->getTCTNodeNum();
100 PTNumStatMap["NumOfTCTEdge"] = tct->getTCTEdgeNum();
101 PTNumStatMap["MaxCxtSize"] = tct->getMaxCxtSize();
102 timeStatMap["BuildingTCTTime"] = TCTTime;
103 SVFUtil::outs() << "\n****Thread Creation Tree Statistics****\n";
105}
u32_t getTotalNodeNum() const
Get total number of node/edge.
const FunSet & getMakredProcs() const
Get marked candidate functions.
Definition TCT.h:236
u32_t getMaxCxtSize() const
Definition TCT.h:257
ThreadCallGraph * getThreadCallGraph() const
Get TCG.
Definition TCT.h:196
u32_t getTCTEdgeNum() const
Definition TCT.h:253
u32_t getTCTNodeNum() const
Get Statistics.
Definition TCT.h:249

◆ performThreadCallGraphStat()

void MTAStat::performThreadCallGraphStat ( ThreadCallGraph tcg)

Statistics for thread call graph.

Statistics for thread call graph

Definition at line 44 of file MTAStat.cpp.

45{
50 for (ThreadCallGraph::CallSiteSet::const_iterator it = tcg->forksitesBegin(), eit = tcg->forksitesEnd(); it != eit; ++it)
51 {
52 bool indirectfork = false;
53 const ValVar* pValVar = tcg->getThreadAPI()->getForkedFun(*it);
54 if(!SVFUtil::isa<FunValVar>(pValVar))
55 {
57 indirectfork = true;
58 }
59 for (ThreadCallGraph::ForkEdgeSet::const_iterator cgIt = tcg->getForkEdgeBegin(*it), ecgIt =
60 tcg->getForkEdgeEnd(*it); cgIt != ecgIt; ++cgIt)
61 {
63 if(indirectfork)
65 }
66 }
67
68 for (ThreadCallGraph::CallSiteSet::const_iterator it = tcg->joinsitesBegin(), eit = tcg->joinsitesEnd(); it != eit; ++it)
69 {
70 for (ThreadCallGraph::JoinEdgeSet::const_iterator cgIt = tcg->getJoinEdgeBegin(*it), ecgIt =
71 tcg->getJoinEdgeEnd(*it); cgIt != ecgIt; ++cgIt)
72 {
74 }
75 }
76
77
78 PTNumStatMap.clear();
79 PTNumStatMap["NumOfForkSite"] = tcg->getNumOfForksite();
80 PTNumStatMap["NumOfForkEdge"] = numOfForkEdge;
81 PTNumStatMap["NumOfJoinEdge"] = numOfJoinEdge;
82 PTNumStatMap["NumOfJoinSite"] = tcg->getNumOfJoinsite();
83 PTNumStatMap["NumOfIndForkSite"] = numOfIndForksite;
84 PTNumStatMap["NumOfIndForkEdge"] = numOfIndForkEdge;
85 PTNumStatMap["NumOfIndCallEdge"] = tcg->getNumOfResolvedIndCallEdge();
86
87 SVFUtil::outs() << "\n****Thread Call Graph Statistics****\n";
89}
unsigned u32_t
Definition CommandLine.h:18
u32_t getNumOfResolvedIndCallEdge() const
const ValVar * getForkedFun(const CallICFGNode *inst) const
CallSiteSet::const_iterator forksitesEnd() const
CallSiteSet::const_iterator forksitesBegin() const
Fork sites iterators.
CallSiteSet::const_iterator joinsitesEnd() const
u32_t getNumOfJoinsite() const
JoinEdgeSet::const_iterator getJoinEdgeEnd(const CallICFGNode *cs) const
ForkEdgeSet::const_iterator getForkEdgeEnd(const CallICFGNode *cs) const
ForkEdgeSet::const_iterator getForkEdgeBegin(const CallICFGNode *cs) const
CallSiteSet::const_iterator joinsitesBegin() const
Join sites iterators.
u32_t getNumOfForksite() const
Num of fork/join sites.
ThreadAPI * getThreadAPI() const
Thread API.
JoinEdgeSet::const_iterator getJoinEdgeBegin(const CallICFGNode *cs) const

Member Data Documentation

◆ AnnotationTime

double SVF::MTAStat::AnnotationTime

Definition at line 68 of file MTAStat.h.

◆ MHPTime

double SVF::MTAStat::MHPTime

Definition at line 67 of file MTAStat.h.

◆ TCTTime

double SVF::MTAStat::TCTTime

Statistics for annotation.

Definition at line 66 of file MTAStat.h.


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