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

#include <MTAStat.h>

Public Member Functions

 ScopedPhaseTimer (const char *phaseName)
 
 ~ScopedPhaseTimer ()
 

Private Attributes

const charname
 
const bool enabled
 
std::chrono::steady_clock::time_point start
 

Detailed Description

Definition at line 51 of file MTAStat.h.

Constructor & Destructor Documentation

◆ ScopedPhaseTimer()

SVF::ScopedPhaseTimer::ScopedPhaseTimer ( const char phaseName)
inlineexplicit

Definition at line 54 of file MTAStat.h.

56 start(enabled ? std::chrono::steady_clock::now()
58 {
59 if (enabled)
60 {
61 SVFUtil::outs() << "[TIMER] Phase: " << name << " - started\n";
62 SVFUtil::outs().flush();
63 }
64 }
const bool enabled
Definition MTAStat.h:87
std::chrono::steady_clock::time_point start
Definition MTAStat.h:88
const char * name
Definition MTAStat.h:86
std::ostream & outs()
Overwrite llvm::outs()
Definition SVFUtil.h:52
bool isMTAStatEnabled()
Definition MTAStat.h:46
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76

◆ ~ScopedPhaseTimer()

SVF::ScopedPhaseTimer::~ScopedPhaseTimer ( )
inline

Definition at line 66 of file MTAStat.h.

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 }
int count
Definition cJSON.h:216

Member Data Documentation

◆ enabled

const bool SVF::ScopedPhaseTimer::enabled
private

Definition at line 87 of file MTAStat.h.

◆ name

const char* SVF::ScopedPhaseTimer::name
private

Definition at line 86 of file MTAStat.h.

◆ start

std::chrono::steady_clock::time_point SVF::ScopedPhaseTimer::start
private

Definition at line 88 of file MTAStat.h.


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