Audacity  2.2.2
Functions | Variables
Diags.cpp File Reference
#include "Audacity.h"
#include <wx/defs.h>
#include <wx/hash.h>
#include <wx/intl.h>
#include <wx/log.h>
#include <wx/stopwatch.h>
#include "Diags.h"

Go to the source code of this file.

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 **pRememberMe)
 
void diagnostics_do_perfmon_stop (t_diag_struct **ppDiag)
 
void diag_sample_test ()
 

Variables

static wxStopWatch MasterWatch
 
static bool bStopWatchStarted = false
 

Function Documentation

void diag_sample_test ( )

Definition at line 96 of file Diags.cpp.

References DIAG.

96  {
97  DIAG("Flip counter");// Flip counter will show in log ten times, then just count.
98 }
#define DIAG(message)
Definition: Diags.h:57
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 **  pRememberMe 
)

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

Variable Documentation

bool bStopWatchStarted = false
static

Definition at line 41 of file Diags.cpp.

Referenced by diagnostics_do_perfmon_start().

wxStopWatch MasterWatch
static

Definition at line 40 of file Diags.cpp.

Referenced by diagnostics_do_perfmon_start(), and diagnostics_do_perfmon_stop().