Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::ScopeTimer Class Reference

#include <scope_timer.h>

Inheritance diagram for dart::ScopeTimer:
dart::ValueObject

Public Member Functions

 ScopeTimer (const char *name, bool enabled=true)
 
int64_t GetElapsed () const
 
 ~ScopeTimer ()
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 16 of file scope_timer.h.

Constructor & Destructor Documentation

◆ ScopeTimer()

dart::ScopeTimer::ScopeTimer ( const char *  name,
bool  enabled = true 
)
inlineexplicit

Definition at line 18 of file scope_timer.h.

19 : enabled_(enabled), name_(name), start_(0) {
20 if (!enabled_) {
21 return;
22 }
24 }
static int64_t GetCurrentMonotonicMicros()
const char *const name

◆ ~ScopeTimer()

dart::ScopeTimer::~ScopeTimer ( )
inline

Definition at line 32 of file scope_timer.h.

32 {
33 if (!enabled_) {
34 return;
35 }
36 int64_t elapsed = GetElapsed();
37 double seconds = MicrosecondsToSeconds(elapsed);
38 OS::PrintErr("%s: %.2f seconds (%" Pd64 " \u00B5s)\n", name_, seconds,
39 elapsed);
40 }
static void static void PrintErr(const char *format,...) PRINTF_ATTRIBUTE(1
int64_t GetElapsed() const
Definition scope_timer.h:26
constexpr double MicrosecondsToSeconds(int64_t micros)
Definition globals.h:571
#define Pd64
Definition globals.h:416

Member Function Documentation

◆ GetElapsed()

int64_t dart::ScopeTimer::GetElapsed ( ) const
inline

Definition at line 26 of file scope_timer.h.

26 {
28 ASSERT(end >= start_);
29 return end - start_;
30 }
#define ASSERT(E)
glong glong end

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