Audacity 3.2.0
Classes | Macros | Typedefs | Functions
Diags.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  t_diag_struct
 

Macros

#define DEFAULT_LOG_COUNT   (10)
 
#define MAKE_TIMER(timername)    static t_diag_struct * timername = NULL;
 
#define DIAG(message)
 
#define TRACK_MEM(message, amount)
 
#define TIMER_START(message, timername)
 
#define TIMER_STOP(timername)
 

Typedefs

typedef long t_diag_timer
 

Functions

void diagnostics_do_diag (t_diag_struct *pDiag)
 
void diagnostics_do_diag_mem (t_diag_struct *pDiag, long amount)
 
void diagnostics_do_perfmon_start (t_diag_struct *pDiag, t_diag_struct **ppRememberMe)
 
void diagnostics_do_perfmon_stop (t_diag_struct **ppDiag)
 

Macro Definition Documentation

◆ DEFAULT_LOG_COUNT

#define DEFAULT_LOG_COUNT   (10)

Definition at line 37 of file Diags.h.

◆ DIAG

#define DIAG (   message)
Value:
{ \
static t_diag_struct diag = { DEFAULT_LOG_COUNT, DEFAULT_LOG_COUNT, 0,0,0,0,wxT(message)};\
if( --diag.countdown >=0 )\
diagnostics_do_diag( &diag );\
}
wxT("CloseDown"))
#define DEFAULT_LOG_COUNT
Definition: Diags.h:37

Definition at line 57 of file Diags.h.

◆ MAKE_TIMER

#define MAKE_TIMER (   timername)     static t_diag_struct * timername = NULL;

Definition at line 50 of file Diags.h.

◆ TIMER_START

#define TIMER_START (   message,
  timername 
)
Value:
MAKE_TIMER( timername ); { \
static t_diag_struct diag = { DEFAULT_LOG_COUNT, DEFAULT_LOG_COUNT, 0,0,0,0,wxT(message)};\
if( --diag.countdown >=0 )\
diagnostics_do_perfmon_start( &diag, &timername );\
}
#define MAKE_TIMER(timername)
Definition: Diags.h:50

Definition at line 69 of file Diags.h.

◆ TIMER_STOP

#define TIMER_STOP (   timername)
Value:
{ \
if( timername != NULL )\
diagnostics_do_perfmon_stop( &timername );\
}

Definition at line 76 of file Diags.h.

◆ TRACK_MEM

#define TRACK_MEM (   message,
  amount 
)
Value:
{ \
static t_diag_struct diag = { DEFAULT_LOG_COUNT, DEFAULT_LOG_COUNT, 0,0,0,0,wxT(message)};\
if( --diag.countdown >=0 )\
diagnostics_do_diag_mem( &diag, amount );\
}

Definition at line 63 of file Diags.h.

Typedef Documentation

◆ t_diag_timer

typedef long t_diag_timer

Definition at line 18 of file Diags.h.

Function Documentation

◆ diagnostics_do_diag()

void diagnostics_do_diag ( t_diag_struct pDiag)

Definition at line 43 of file Diags.cpp.

43 {
44 wxLog * pLog = wxLog::SetActiveTarget(NULL);
45 // this macro is empty if wxWidgets is not compiled in debug mode
46 wxLogDebug( wxT("%s"), pDiag->pMessage );
47 wxLog::SetActiveTarget(pLog);
48}
const wchar_t * pMessage
Definition: Diags.h:27

References t_diag_struct::pMessage, and wxT().

Here is the call graph for this function:

◆ diagnostics_do_diag_mem()

void diagnostics_do_diag_mem ( t_diag_struct pDiag,
long  amount 
)

Definition at line 49 of file Diags.cpp.

49 {
50 wxLog * pLog = wxLog::SetActiveTarget(NULL);
51 wxLogDebug( wxT("%s %l"), pDiag->pMessage, amount );
52 wxLog::SetActiveTarget(pLog);
53 pDiag->total += amount;
54 pDiag->most_recent = amount;
55 if( pDiag->countdown == (pDiag->initial_count -1 )){
56 pDiag->most = amount;
57 pDiag->least = amount;
58 }
59 else if( amount > pDiag->most )
60 pDiag->most = amount;
61 else if( amount < pDiag->least )
62 pDiag->least = amount;
63}
long least
Definition: Diags.h:25
long most_recent
Definition: Diags.h:24
long countdown
Definition: Diags.h:21
long initial_count
Definition: Diags.h:22
long most
Definition: Diags.h:26
long total
Definition: Diags.h:23

References t_diag_struct::countdown, t_diag_struct::initial_count, t_diag_struct::least, t_diag_struct::most, t_diag_struct::most_recent, t_diag_struct::pMessage, t_diag_struct::total, and wxT().

Here is the call graph for this function:

◆ diagnostics_do_perfmon_start()

void diagnostics_do_perfmon_start ( t_diag_struct pDiag,
t_diag_struct **  ppRememberMe 
)

Definition at line 65 of file Diags.cpp.

65 {
66 if( *pRememberMe == NULL ){
67 *pRememberMe = pDiag;
68 if( !bStopWatchStarted ){
69 bStopWatchStarted = true;
70 MasterWatch.Start();
71 }
72 }
73 pDiag->most_recent = MasterWatch.Time();
74}
static bool bStopWatchStarted
Definition: Diags.cpp:41
static wxStopWatch MasterWatch
Definition: Diags.cpp:40

References bStopWatchStarted, MasterWatch, and t_diag_struct::most_recent.

◆ diagnostics_do_perfmon_stop()

void diagnostics_do_perfmon_stop ( t_diag_struct **  ppDiag)

Definition at line 76 of file Diags.cpp.

76 {
77 t_diag_struct * pDiag = *ppDiag;
78 *ppDiag = NULL;
79 long amount = MasterWatch.Time() - pDiag->most_recent;
80 pDiag->total += amount;
81 pDiag->most_recent = amount;
82 if( pDiag->countdown == (pDiag->initial_count -1 )){
83 pDiag->most = amount;
84 pDiag->least = amount;
85 }
86 else if( amount > pDiag->most )
87 pDiag->most = amount;
88 else if( amount < pDiag->least )
89 pDiag->least = amount;
90 wxLog * pLog = wxLog::SetActiveTarget(NULL);
91 wxLogDebug( wxT("%s %f seconds"), pDiag->pMessage, ((float)amount)/1000.0f );
92 wxLog::SetActiveTarget(pLog);
93}

References t_diag_struct::countdown, t_diag_struct::initial_count, t_diag_struct::least, MasterWatch, t_diag_struct::most, t_diag_struct::most_recent, t_diag_struct::pMessage, t_diag_struct::total, and wxT().

Here is the call graph for this function: