Audacity 3.2.0
Classes | Public Member Functions | Private Member Functions | Private Attributes | List of all members
anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog Class Reference
Inheritance diagram for anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog:
[legend]
Collaboration diagram for anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog:
[legend]

Classes

struct  Section
 

Public Member Functions

 Dialog ()
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&... args)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

Private Member Functions

void AddSection (ShuttleGui &S, FrameStatistics::SectionID sectionID)
 
wxString FormatTime (FrameStatistics::Duration duration)
 
void SectionUpdated (FrameStatistics::SectionID sectionID)
 

Private Attributes

Section mSections [size_t(FrameStatistics::SectionID::Count)]
 
Observer::Subscription mStatisticsUpdated
 

Detailed Description

Definition at line 25 of file FrameStatisticsDialog.cpp.

Constructor & Destructor Documentation

◆ Dialog()

anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::Dialog ( )
inline

Definition at line 29 of file FrameStatisticsDialog.cpp.

30 : wxDialogWrapper(nullptr, wxID_ANY, Verbatim("Frame Statistics"))
31 {
33
34 S.Style(wxNO_BORDER | wxTAB_TRAVERSAL).Prop(true).StartPanel();
35 {
36 S.StartVerticalLay(true);
37 {
38 S.AddFixedText(Verbatim("Track Panel Rendering"));
40 S.AddFixedText(Verbatim("Waveform Rendering (per clip)"));
42 S.AddFixedText(Verbatim("WaveDataCache Lookups"));
44 S.AddFixedText(Verbatim("WaveBitmapCache Preprocess"));
46 S.AddFixedText(Verbatim("WaveBitmapCache Lookups"));
48 }
49 S.EndVerticalLay();
50 }
51 S.EndPanel();
52
53 Layout();
54 Fit();
55
57 [this](FrameStatistics::SectionID sectionID) {
58 mSections[size_t(sectionID)].Dirty = true;
59 });
60
61 Bind(
62 wxEVT_IDLE,
63 [this](wxIdleEvent& evt)
64 {
65 for (size_t i = 0; i < size_t(FrameStatistics::SectionID::Count);
66 ++i)
67 {
68 if (mSections[i].Dirty)
70 }
71 });
72 }
@ eIsCreating
Definition: ShuttleGui.h:37
#define S(N)
Definition: ToChars.cpp:64
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
SectionID
ID of the profiling section.
@ WaveformView
Time required to draw a single clip.
@ WaveBitmapCachePreprocess
Time required to build the structures required for the bitmap cache population.
@ TrackPanel
Full repaint time of the TrackPanel.
@ Count
Number of the sections.
@ WaveDataCache
Time required to access the data cache.
@ WaveBitmapCache
Time required to access the wave bitmaps cache.
static Observer::Subscription Subscribe(UpdatePublisher::Callback callback)
Subscribe to sections update.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:640
Section mSections[size_t(FrameStatistics::SectionID::Count)]
void AddSection(ShuttleGui &S, FrameStatistics::SectionID sectionID)
void SectionUpdated(FrameStatistics::SectionID sectionID)

References FrameStatistics::Count, eIsCreating, S, FrameStatistics::Subscribe(), FrameStatistics::TrackPanel, Verbatim(), FrameStatistics::WaveBitmapCache, FrameStatistics::WaveBitmapCachePreprocess, FrameStatistics::WaveDataCache, and FrameStatistics::WaveformView.

Here is the call graph for this function:

Member Function Documentation

◆ AddSection()

void anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::AddSection ( ShuttleGui S,
FrameStatistics::SectionID  sectionID 
)
inlineprivate

Definition at line 75 of file FrameStatisticsDialog.cpp.

76 {
77 S.StartMultiColumn(2, wxEXPAND);
78 {
79 S.AddFixedText(Verbatim("Last:"));
80 mSections[size_t(sectionID)].Last = S.AddVariableText({});
81
82 S.AddFixedText(Verbatim("Min:"));
83 mSections[size_t(sectionID)].Min = S.AddVariableText({});
84
85 S.AddFixedText(Verbatim("Max:"));
86 mSections[size_t(sectionID)].Max = S.AddVariableText({});
87
88 S.AddFixedText(Verbatim("Avg:"));
89 mSections[size_t(sectionID)].Avg = S.AddVariableText({});
90
91 S.AddFixedText(Verbatim("Events:"));
92 mSections[size_t(sectionID)].Events = S.AddVariableText({});
93 }
94 S.EndMultiColumn();
95
96 SectionUpdated(sectionID);
97 }

References S, and Verbatim().

Here is the call graph for this function:

◆ FormatTime()

wxString anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::FormatTime ( FrameStatistics::Duration  duration)
inlineprivate

Definition at line 99 of file FrameStatisticsDialog.cpp.

100 {
101 using namespace std::chrono;
102
103 const auto mcs = duration_cast<microseconds>(duration);
104
105 return std::to_string(mcs.count() / 1000.0) + " ms";
106 }

◆ SectionUpdated()

void anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::SectionUpdated ( FrameStatistics::SectionID  sectionID)
inlineprivate

Definition at line 108 of file FrameStatisticsDialog.cpp.

109 {
110 Section& section = mSections[size_t(sectionID)];
111 const auto& profilerSection = FrameStatistics::GetSection(sectionID);
112
113 if (profilerSection.GetEventsCount() > 0)
114 {
115 section.Last->SetLabel(FormatTime(profilerSection.GetLastDuration()));
116 section.Min->SetLabel(FormatTime(profilerSection.GetMinDuration()));
117 section.Max->SetLabel(FormatTime(profilerSection.GetMaxDuration()));
118 section.Avg->SetLabel(FormatTime(profilerSection.GetAverageDuration()));
119 }
120 else
121 {
122 section.Last->SetLabel(L"n/a");
123 section.Min->SetLabel(L"n/a");
124 section.Max->SetLabel(L"n/a");
125 section.Avg->SetLabel(L"n/a");
126 }
127
128 section.Events->SetLabel(std::to_string(profilerSection.GetEventsCount()));
129
130 section.Dirty = false;
131 }
static const Section & GetSection(SectionID section) noexcept
Get the section data.
wxString FormatTime(FrameStatistics::Duration duration)
constexpr auto Section
Definition: MenuRegistry.h:436

References anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::Section::Avg, anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::Section::Dirty, anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::Section::Events, FrameStatistics::GetSection(), anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::Section::Last, anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::Section::Max, and anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::Section::Min.

Here is the call graph for this function:

Member Data Documentation

◆ mSections

Section anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::mSections[size_t(FrameStatistics::SectionID::Count)]
private

Definition at line 144 of file FrameStatisticsDialog.cpp.

◆ mStatisticsUpdated

Observer::Subscription anonymous_namespace{FrameStatisticsDialog.cpp}::Dialog::mStatisticsUpdated
private

Definition at line 146 of file FrameStatisticsDialog.cpp.


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