Audacity  2.2.2
Classes | Macros | Typedefs | Functions
Diags.h File Reference

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

#define DEFAULT_LOG_COUNT   (10)

Definition at line 37 of file Diags.h.

#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 )\
}
#define DEFAULT_LOG_COUNT
Definition: Diags.h:37
void diagnostics_do_diag(t_diag_struct *pDiag)
Definition: Diags.cpp:43
if(pTrack &&pTrack->GetDisplay()!=WaveTrack::Spectrum)

Definition at line 57 of file Diags.h.

Referenced by diag_sample_test().

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

Definition at line 50 of file Diags.h.

#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 );\
}
void diagnostics_do_perfmon_start(t_diag_struct *pDiag, t_diag_struct **ppRememberMe)
Definition: Diags.cpp:65
#define DEFAULT_LOG_COUNT
Definition: Diags.h:37
#define MAKE_TIMER(timername)
Definition: Diags.h:50
if(pTrack &&pTrack->GetDisplay()!=WaveTrack::Spectrum)

Definition at line 69 of file Diags.h.

#define TIMER_STOP (   timername)
Value:
{ \
if( timername != NULL )\
}
void diagnostics_do_perfmon_stop(t_diag_struct **ppDiag)
Definition: Diags.cpp:76
if(pTrack &&pTrack->GetDisplay()!=WaveTrack::Spectrum)

Definition at line 76 of file Diags.h.

#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 );\
}
#define DEFAULT_LOG_COUNT
Definition: Diags.h:37
if(pTrack &&pTrack->GetDisplay()!=WaveTrack::Spectrum)
void diagnostics_do_diag_mem(t_diag_struct *pDiag, long amount)
Definition: Diags.cpp:49

Definition at line 63 of file Diags.h.

Typedef Documentation

typedef long t_diag_timer

Definition at line 18 of file Diags.h.

Function Documentation

void diagnostics_do_diag ( t_diag_struct pDiag)

Definition at line 43 of file Diags.cpp.

References t_diag_struct::pMessage.

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
void diagnostics_do_diag_mem ( t_diag_struct pDiag,
long  amount 
)

Definition at line 49 of file Diags.cpp.

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, and t_diag_struct::total.

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 most_recent
Definition: Diags.h:24
const wchar_t * pMessage
Definition: Diags.h:27
long initial_count
Definition: Diags.h:22
long countdown
Definition: Diags.h:21
long total
Definition: Diags.h:23
long most
Definition: Diags.h:26
long least
Definition: Diags.h:25
void diagnostics_do_perfmon_start ( t_diag_struct pDiag,
t_diag_struct **  ppRememberMe 
)

Definition at line 65 of file Diags.cpp.

References bStopWatchStarted, MasterWatch, and t_diag_struct::most_recent.

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 }
long most_recent
Definition: Diags.h:24
static wxStopWatch MasterWatch
Definition: Diags.cpp:40
static bool bStopWatchStarted
Definition: Diags.cpp:41
void diagnostics_do_perfmon_stop ( t_diag_struct **  ppDiag)

Definition at line 76 of file Diags.cpp.

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, and t_diag_struct::total.

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 }
long most_recent
Definition: Diags.h:24
const wchar_t * pMessage
Definition: Diags.h:27
long initial_count
Definition: Diags.h:22
long countdown
Definition: Diags.h:21
long total
Definition: Diags.h:23
long most
Definition: Diags.h:26
long least
Definition: Diags.h:25
static wxStopWatch MasterWatch
Definition: Diags.cpp:40