Static Value-Flow Analysis
Loading...
Searching...
No Matches
svf
include
MTA
MTAStat.h
Go to the documentation of this file.
1
//===- MTAStat.h -- 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.h
25
*
26
* Created on: Jun 23, 2015
27
* Author: Yulei Sui, Peng Di
28
*/
29
30
#ifndef MTASTAT_H_
31
#define MTASTAT_H_
32
33
#include "
Util/PTAStat.h
"
34
#include "
Util/Options.h
"
35
#include "
Util/SVFUtil.h
"
36
37
#include <chrono>
38
#include <iomanip>
39
#include <sstream>
40
41
namespace
SVF
42
{
43
46
inline
bool
isMTAStatEnabled
()
47
{
48
return
Options::PStat
.
isSet
() &&
Options::PStat
();
49
}
50
51
class
ScopedPhaseTimer
52
{
53
public
:
54
explicit
ScopedPhaseTimer
(
const
char
*
phaseName
)
55
:
name
(
phaseName
),
enabled
(
isMTAStatEnabled
()),
56
start
(
enabled
? std::
chrono
::
steady_clock
::
now
()
57
: std::
chrono
::
steady_clock
::
time_point
())
58
{
59
if
(
enabled
)
60
{
61
SVFUtil::outs
() <<
"[TIMER] Phase: "
<<
name
<<
" - started\n"
;
62
SVFUtil::outs
().flush();
63
}
64
}
65
66
~ScopedPhaseTimer
()
67
{
68
if
(!
enabled
)
69
return
;
70
71
const
auto
end = std::chrono::steady_clock::now();
72
const
double
milliseconds
=
73
std::chrono::duration_cast<std::chrono::duration<double, std::milli>>(
74
end -
start
).
count
();
75
std::ostringstream
elapsed
;
76
elapsed
<< std::fixed << std::setprecision(2) <<
milliseconds
<<
" ms"
;
77
if
(
milliseconds
>= 1000.0)
78
elapsed
<<
" ("
<< std::fixed << std::setprecision(2)
79
<< (
milliseconds
/ 1000.0) <<
" s)"
;
80
SVFUtil::outs
() <<
"[TIMER] Phase: "
<<
name
<<
" - finished in "
81
<<
elapsed
.str() <<
"\n"
;
82
SVFUtil::outs
().flush();
83
}
84
85
private
:
86
const
char
*
name
;
87
const
bool
enabled
;
88
std::chrono::steady_clock::time_point
start
;
89
};
90
91
class
ThreadCallGraph
;
92
class
TCT
;
93
class
MHP
;
94
class
LockAnalysis
;
95
class
MTAAnnotator
;
99
class
MTAStat
:
public
PTAStat
100
{
101
102
public
:
104
MTAStat
() :
PTAStat
(
nullptr
),
TCTTime
(0),
MHPTime
(0),
AnnotationTime
(0)
105
{
106
}
108
void
performThreadCallGraphStat
(
ThreadCallGraph
* tcg);
110
void
performTCTStat
(
TCT
* tct);
111
112
double
TCTTime
;
113
double
MHPTime
;
114
double
AnnotationTime
;
115
};
116
117
}
// End namespace SVF
118
119
#endif
/* MTASTAT_H_ */
Options.h
PTAStat.h
SVFUtil.h
count
int count
Definition
cJSON.h:216
Option::isSet
bool isSet(void) const
Definition
CommandLine.h:356
SVF::LockAnalysis
Definition
LockAnalysis.h:51
SVF::MHP
Definition
MHP.h:52
SVF::MTAStat
Definition
MTAStat.h:100
SVF::MTAStat::MTAStat
MTAStat()
Constructor.
Definition
MTAStat.h:104
SVF::MTAStat::performTCTStat
void performTCTStat(TCT *tct)
Statistics for thread creation tree.
Definition
MTAStat.cpp:92
SVF::MTAStat::performThreadCallGraphStat
void performThreadCallGraphStat(ThreadCallGraph *tcg)
Statistics for thread call graph.
Definition
MTAStat.cpp:44
SVF::MTAStat::TCTTime
double TCTTime
Definition
MTAStat.h:112
SVF::MTAStat::AnnotationTime
double AnnotationTime
Definition
MTAStat.h:114
SVF::MTAStat::MHPTime
double MHPTime
Definition
MTAStat.h:113
SVF::Options::PStat
static const Option< bool > PStat
Definition
Options.h:115
SVF::PTAStat
Definition
PTAStat.h:48
SVF::ScopedPhaseTimer
Definition
MTAStat.h:52
SVF::ScopedPhaseTimer::~ScopedPhaseTimer
~ScopedPhaseTimer()
Definition
MTAStat.h:66
SVF::ScopedPhaseTimer::enabled
const bool enabled
Definition
MTAStat.h:87
SVF::ScopedPhaseTimer::ScopedPhaseTimer
ScopedPhaseTimer(const char *phaseName)
Definition
MTAStat.h:54
SVF::ScopedPhaseTimer::start
std::chrono::steady_clock::time_point start
Definition
MTAStat.h:88
SVF::ScopedPhaseTimer::name
const char * name
Definition
MTAStat.h:86
SVF::TCT
Definition
TCT.h:156
SVF::ThreadCallGraph
Definition
ThreadCallGraph.h:142
SVF::SVFUtil::outs
std::ostream & outs()
Overwrite llvm::outs()
Definition
SVFUtil.h:52
SVF
for isBitcode
Definition
BasicTypes.h:70
SVF::isMTAStatEnabled
bool isMTAStatEnabled()
Definition
MTAStat.h:46
SVF::IRBuilder
llvm::IRBuilder IRBuilder
Definition
BasicTypes.h:76
Generated by
1.9.8