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

AEStat: Statistic for AE. More...

#include <AbstractInterpretation.h>

Inheritance diagram for SVF::AEStat:
SVF::SVFStat

Public Member Functions

void countStateSize ()
 
 AEStat (AbstractInterpretation *ae)
 
 ~AEStat ()
 
std::string getMemUsage ()
 
void finializeStat ()
 
void performStat () override
 
u32_tgetFunctionTrace ()
 
u32_tgetBlockTrace ()
 
u32_tgetICFGNodeTrace ()
 
- 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 &)
 
virtual void callgraphStat ()
 

Public Attributes

AbstractInterpretation_ae
 
s32_t count {0}
 
std::string memory_usage
 
std::string memUsage
 
- Public Attributes inherited from SVF::SVFStat
NUMStatMap generalNumMap
 
NUMStatMap PTNumStatMap
 
TIMEStatMap timeStatMap
 
double startTime
 
double endTime
 

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
 

Detailed Description

AEStat: Statistic for AE.

Definition at line 50 of file AbstractInterpretation.h.

Constructor & Destructor Documentation

◆ AEStat()

SVF::AEStat::AEStat ( AbstractInterpretation ae)
inline

Definition at line 54 of file AbstractInterpretation.h.

54 : _ae(ae)
55 {
56 startTime = getClk(true);
57 }
AbstractInterpretation * _ae
double startTime
Definition SVFStat.h:80
static double getClk(bool mark=false)
Definition SVFStat.cpp:48
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

◆ ~AEStat()

SVF::AEStat::~AEStat ( )
inline

Definition at line 58 of file AbstractInterpretation.h.

59 {
60 }

Member Function Documentation

◆ countStateSize()

void AEStat::countStateSize ( )

Definition at line 1209 of file AbstractInterpretation.cpp.

1210{
1211 if (count == 0)
1212 {
1213 generalNumMap["ES_Var_AVG_Num"] = 0;
1214 generalNumMap["ES_Loc_AVG_Num"] = 0;
1215 generalNumMap["ES_Var_Addr_AVG_Num"] = 0;
1216 generalNumMap["ES_Loc_Addr_AVG_Num"] = 0;
1217 }
1218 ++count;
1219}
NUMStatMap generalNumMap
Definition SVFStat.h:76

◆ finializeStat()

void AEStat::finializeStat ( )

Definition at line 1221 of file AbstractInterpretation.cpp.

1222{
1224 if (count > 0)
1225 {
1226 generalNumMap["ES_Var_AVG_Num"] /= count;
1227 generalNumMap["ES_Loc_AVG_Num"] /= count;
1228 generalNumMap["ES_Var_Addr_AVG_Num"] /= count;
1229 generalNumMap["ES_Loc_Addr_AVG_Num"] /= count;
1230 }
1231 generalNumMap["SVF_STMT_NUM"] = count;
1232 generalNumMap["ICFG_Node_Num"] = _ae->svfir->getICFG()->nodeNum;
1233 u32_t callSiteNum = 0;
1236 for (const auto &it: *_ae->svfir->getICFG())
1237 {
1238 if (it.second->getFun())
1239 {
1240 funs.insert(it.second->getFun());
1241 }
1242 if (const CallICFGNode *callNode = dyn_cast<CallICFGNode>(it.second))
1243 {
1244 if (!isExtCall(callNode))
1245 {
1246 callSiteNum++;
1247 }
1248 else
1249 {
1251 }
1252 }
1253 }
1254 generalNumMap["Func_Num"] = funs.size();
1255 generalNumMap["EXT_CallSite_Num"] = extCallSiteNum;
1256 generalNumMap["NonEXT_CallSite_Num"] = callSiteNum;
1257 timeStatMap["Total_Time(sec)"] = (double)(endTime - startTime) / TIMEINTERVAL;
1258
1259}
unsigned u32_t
Definition CommandLine.h:18
#define TIMEINTERVAL
Definition SVFType.h:621
std::string getMemUsage()
SVFIR * svfir
protected data members, also used in subclasses
u32_t nodeNum
total num of edge
ICFG * getICFG() const
Definition SVFIR.h:163
TIMEStatMap timeStatMap
Definition SVFStat.h:78
double endTime
Definition SVFStat.h:81
bool isExtCall(const FunObjVar *fun)
Definition SVFUtil.cpp:437

◆ getBlockTrace()

u32_t & SVF::AEStat::getBlockTrace ( )
inline

Definition at line 85 of file AbstractInterpretation.h.

86 {
87 if (generalNumMap.count("Block_Trace") == 0)
88 {
89 generalNumMap["Block_Trace"] = 0;
90 }
91 return generalNumMap["Block_Trace"];
92 }

◆ getFunctionTrace()

u32_t & SVF::AEStat::getFunctionTrace ( )
inline

Definition at line 77 of file AbstractInterpretation.h.

78 {
79 if (generalNumMap.count("Function_Trace") == 0)
80 {
81 generalNumMap["Function_Trace"] = 0;
82 }
83 return generalNumMap["Function_Trace"];
84 }

◆ getICFGNodeTrace()

u32_t & SVF::AEStat::getICFGNodeTrace ( )
inline

Definition at line 93 of file AbstractInterpretation.h.

94 {
95 if (generalNumMap.count("ICFG_Node_Trace") == 0)
96 {
97 generalNumMap["ICFG_Node_Trace"] = 0;
98 }
99 return generalNumMap["ICFG_Node_Trace"];
100 }

◆ getMemUsage()

std::string SVF::AEStat::getMemUsage ( )
inline

Definition at line 61 of file AbstractInterpretation.h.

62 {
64 return SVFUtil::getMemoryUsageKB(&vmrss, &vmsize) ? std::to_string(vmsize) + "KB" : "cannot read memory usage";
65 }
bool getMemoryUsageKB(u32_t *vmrss_kb, u32_t *vmsize_kb)
Get memory usage from system file. Return TRUE if succeed.
Definition SVFUtil.cpp:179

◆ performStat()

void AEStat::performStat ( )
overridevirtual

Implements SVF::SVFStat.

Definition at line 1261 of file AbstractInterpretation.cpp.

1262{
1263 std::string fullName(_ae->moduleName);
1264 std::string name;
1265 std::string moduleName;
1266 if (fullName.find('/') == std::string::npos)
1267 {
1268 std::string name = fullName;
1269 moduleName = name.substr(0, fullName.find('.'));
1270 }
1271 else
1272 {
1273 std::string name = fullName.substr(fullName.find('/'), fullName.size());
1274 moduleName = name.substr(0, fullName.find('.'));
1275 }
1276
1277 SVFUtil::outs() << "\n************************\n";
1278 SVFUtil::outs() << "################ (program : " << moduleName << ")###############\n";
1279 SVFUtil::outs().flags(std::ios::left);
1280 unsigned field_width = 30;
1281 for (NUMStatMap::iterator it = generalNumMap.begin(), eit = generalNumMap.end(); it != eit; ++it)
1282 {
1283 // format out put with width 20 space
1284 std::cout << std::setw(field_width) << it->first << it->second << "\n";
1285 }
1286 SVFUtil::outs() << "-------------------------------------------------------\n";
1287 for (TIMEStatMap::iterator it = timeStatMap.begin(), eit = timeStatMap.end(); it != eit; ++it)
1288 {
1289 // format out put with width 20 space
1290 SVFUtil::outs() << std::setw(field_width) << it->first << it->second << "\n";
1291 }
1292 SVFUtil::outs() << "Memory usage: " << memUsage << "\n";
1293
1294 SVFUtil::outs() << "#######################################################" << std::endl;
1295 SVFUtil::outs().flush();
1296}
const char *const name
Definition cJSON.h:264
std::string moduleName
Definition SVFStat.h:99
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:52

Member Data Documentation

◆ _ae

AbstractInterpretation* SVF::AEStat::_ae

Definition at line 71 of file AbstractInterpretation.h.

◆ count

s32_t SVF::AEStat::count {0}

Definition at line 72 of file AbstractInterpretation.h.

72{0};

◆ memory_usage

std::string SVF::AEStat::memory_usage

Definition at line 73 of file AbstractInterpretation.h.

◆ memUsage

std::string SVF::AEStat::memUsage

Definition at line 74 of file AbstractInterpretation.h.


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