Static Value-Flow Analysis
Loading...
Searching...
No Matches
MTAStat.cpp
Go to the documentation of this file.
1//===- MTAStat.cpp -- Statistics for MTA-------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23/*
24 * MTAStat.cpp
25 *
26 * Created on: Jun 23, 2015
27 * Author: Yulei Sui, Peng Di
28 */
29
30#include "Util/Options.h"
31#include "MTA/MTAStat.h"
32#include "MTA/TCT.h"
33#include "MTA/MHP.h"
34#include "MTA/LockAnalysis.h"
36#include "Graphs/CallGraph.h"
37
38using namespace SVF;
39
40
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}
90
91
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}
106
u32_t getNumOfResolvedIndCallEdge() const
Definition CallGraph.h:351
u32_t getTotalNodeNum() const
Get total number of node/edge.
void performTCTStat(TCT *tct)
Statistics for thread creation tree.
Definition MTAStat.cpp:92
void performThreadCallGraphStat(ThreadCallGraph *tcg)
Statistics for thread call graph.
Definition MTAStat.cpp:44
double TCTTime
Statistics for annotation.
Definition MTAStat.h:64
NUMStatMap PTNumStatMap
Definition SVFStat.h:80
virtual void printStat(std::string str="")
Definition SVFStat.cpp:70
TIMEStatMap timeStatMap
Definition SVFStat.h:81
const FunSet & getMakredProcs() const
Get marked candidate functions.
Definition TCT.h:233
u32_t getMaxCxtSize() const
Definition TCT.h:254
ThreadCallGraph * getThreadCallGraph() const
Get TCG.
Definition TCT.h:193
u32_t getTCTEdgeNum() const
Definition TCT.h:250
u32_t getTCTNodeNum() const
Get Statistics.
Definition TCT.h:246
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
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:52
for isBitcode
Definition BasicTypes.h:70
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76
unsigned u32_t
Definition GeneralType.h:67