Nebula
Loading...
Searching...
No Matches
Debug::DebugCounter Class Reference

#include <debugcounter.h>

Detailed Description

A debug counter for counting events.

Inherits Core::RefCounted.

Public Member Functions

 DebugCounter ()
 constructor
 
virtual ~DebugCounter ()
 destructor
 
void Setup (const Util::StringAtom &name, const Util::StringAtom &group=Util::StringAtom("Ungrouped"))
 setup the counter
 
void Discard ()
 discard the counter
 
bool IsValid () const
 return true if object has been setup
 
void Begin (bool reset=true)
 begin counting, optionally reset the counter
 
void Reset ()
 manually reset the counter to zero
 
void Incr (int amount)
 increment the counter by a specific value
 
void Decr (int amount)
 decrement the counter by a specific value
 
void Set (int val)
 set the counter directly
 
void End ()
 end counting, write current value to history
 
const Util::StringAtomGetName () const
 get the counter's name
 
const Util::StringAtomGetGroup () const
 get the timer group
 
int GetSample () const
 get the most recent sample
 
Util::Array< int > GetHistory () const
 get the counter's history
 
- Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
 
int GetRefCount () const
 get the current refcount
 
void AddRef ()
 increment refcount by one
 
void Release ()
 decrement refcount and destroy object if refcount is zero
 
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
 
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
 
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
 
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
 
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
 
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
 
const Util::StringGetClassName () const
 get the class name
 
Util::FourCC GetClassFourCC () const
 get the class FourCC code
 

Private Member Functions

 __DeclareClass (DebugCounter)
 

Private Attributes

Threading::CriticalSection critSect
 
Util::StringAtom name
 
Util::StringAtom group
 
int value
 
Util::RingBuffer< int > history
 

Additional Inherited Members

- Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
 
- Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)
 

Constructor & Destructor Documentation

◆ DebugCounter()

Debug::DebugCounter::DebugCounter ( )

constructor

◆ ~DebugCounter()

Debug::DebugCounter::~DebugCounter ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Debug::DebugCounter::__DeclareClass ( DebugCounter )
private

◆ Begin()

void Debug::DebugCounter::Begin ( bool reset = true)
inline

begin counting, optionally reset the counter

◆ Decr()

void Debug::DebugCounter::Decr ( int amount)
inline

decrement the counter by a specific value

◆ Discard()

void Debug::DebugCounter::Discard ( )

discard the counter

◆ End()

void Debug::DebugCounter::End ( )
inline

end counting, write current value to history

◆ GetGroup()

const Util::StringAtom & Debug::DebugCounter::GetGroup ( ) const
inline

get the timer group

◆ GetHistory()

Array< int > Debug::DebugCounter::GetHistory ( ) const

get the counter's history

◆ GetName()

const Util::StringAtom & Debug::DebugCounter::GetName ( ) const
inline

get the counter's name

◆ GetSample()

int Debug::DebugCounter::GetSample ( ) const

get the most recent sample

◆ Incr()

void Debug::DebugCounter::Incr ( int amount)
inline

increment the counter by a specific value

◆ IsValid()

bool Debug::DebugCounter::IsValid ( ) const
inline

return true if object has been setup

◆ Reset()

void Debug::DebugCounter::Reset ( )
inline

manually reset the counter to zero

◆ Set()

void Debug::DebugCounter::Set ( int val)
inline

set the counter directly

◆ Setup()

void Debug::DebugCounter::Setup ( const Util::StringAtom & name,
const Util::StringAtom & group = Util::StringAtom("Ungrouped") )

setup the counter

Member Data Documentation

◆ critSect

Threading::CriticalSection Debug::DebugCounter::critSect
private

◆ group

Util::StringAtom Debug::DebugCounter::group
private

◆ history

Util::RingBuffer<int> Debug::DebugCounter::history
private

◆ name

Util::StringAtom Debug::DebugCounter::name
private

◆ value

int Debug::DebugCounter::value
private

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