Audacity 3.2.0
Functions | Variables
Diags.cpp File Reference
#include "Diags.h"
#include <wx/defs.h>
#include <wx/hash.h>
#include <wx/log.h>
#include <wx/stopwatch.h>
Include dependency graph for Diags.cpp:

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

◆ diag_sample_test()

void diag_sample_test ( )

Definition at line 96 of file Diags.cpp.

96 {
97 DIAG("Flip counter");// Flip counter will show in log ten times, then just count.
98}
#define DIAG(message)
Definition: Diags.h:57

References DIAG.

◆ 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}
wxT("CloseDown"))
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 **  pRememberMe 
)

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:

Variable Documentation

◆ bStopWatchStarted

bool bStopWatchStarted = false
static

Definition at line 41 of file Diags.cpp.

Referenced by diagnostics_do_perfmon_start().

◆ MasterWatch

wxStopWatch MasterWatch
static

Definition at line 40 of file Diags.cpp.

Referenced by diagnostics_do_perfmon_start(), and diagnostics_do_perfmon_stop().