LLDB mainline
Public Member Functions | Public Attributes | List of all members
lldb_private::ElapsedTime Class Reference

A class that measures elapsed time in an exception safe way. More...

#include <Statistics.h>

Public Member Functions

 ElapsedTime (StatsDuration &opt_time)
 
 ~ElapsedTime ()
 

Public Attributes

StatsTimepoint m_start_time
 Set to the start time when the object is created.
 
StatsDurationm_elapsed_time
 Elapsed time in seconds to increment when this object goes out of scope.
 

Detailed Description

A class that measures elapsed time in an exception safe way.

This is a RAII class is designed to help gather timing statistics within LLDB where objects have optional Duration variables that get updated with elapsed times. This helps LLDB measure statistics for many things that are then reported in LLDB commands.

Objects that need to measure elapsed times should have a variable of type "StatsDuration m_time_xxx;" which can then be used in the constructor of this class inside a scope that wants to measure something:

ElapsedTime elapsed(m_time_xxx); // Do some work

This class will increment the m_time_xxx variable with the elapsed time when the object goes out of scope. The "m_time_xxx" variable will be incremented when the class goes out of scope. This allows a variable to measure something that might happen in stages at different times, like resolving a breakpoint each time a new shared library is loaded.

Definition at line 69 of file Statistics.h.

Constructor & Destructor Documentation

◆ ElapsedTime()

lldb_private::ElapsedTime::ElapsedTime ( StatsDuration opt_time)
inline

Definition at line 77 of file Statistics.h.

References m_start_time.

◆ ~ElapsedTime()

lldb_private::ElapsedTime::~ElapsedTime ( )
inline

Definition at line 80 of file Statistics.h.

References elapsed(), m_elapsed_time, and m_start_time.

Member Data Documentation

◆ m_elapsed_time

StatsDuration& lldb_private::ElapsedTime::m_elapsed_time

Elapsed time in seconds to increment when this object goes out of scope.

Definition at line 74 of file Statistics.h.

Referenced by ~ElapsedTime().

◆ m_start_time

StatsTimepoint lldb_private::ElapsedTime::m_start_time

Set to the start time when the object is created.

Definition at line 72 of file Statistics.h.

Referenced by ElapsedTime(), and ~ElapsedTime().


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