21#include <wx/stattext.h>
34 S.Style(wxNO_BORDER | wxTAB_TRAVERSAL).Prop(
true).StartPanel();
36 S.StartVerticalLay(
true);
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"));
58 mSections[size_t(sectionID)].Dirty =
true;
63 [
this](wxIdleEvent& evt)
68 if (mSections[i].Dirty)
77 S.StartMultiColumn(2, wxEXPAND);
80 mSections[size_t(sectionID)].Last =
S.AddVariableText({});
83 mSections[size_t(sectionID)].Min =
S.AddVariableText({});
86 mSections[size_t(sectionID)].Max =
S.AddVariableText({});
89 mSections[size_t(sectionID)].Avg =
S.AddVariableText({});
92 mSections[size_t(sectionID)].Events =
S.AddVariableText({});
96 SectionUpdated(sectionID);
101 using namespace std::chrono;
103 const auto mcs = duration_cast<microseconds>(duration);
105 return std::to_string(mcs.count() / 1000.0) +
" ms";
110 Section& section = mSections[size_t(sectionID)];
113 if (profilerSection.GetEventsCount() > 0)
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()));
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");
128 section.
Events->SetLabel(std::to_string(profilerSection.GetEventsCount()));
130 section.
Dirty =
false;
std::unique_ptr< T, Destroyer< T > > Destroy_ptr
a convenience for using Destroyer
TranslatableString Verbatim(wxString str)
Require calls to the one-argument constructor to go through this distinct global function name.
static void Show(bool show)
Shows the dialog.
static void Destroy()
Destroys the dialog to prevent Audacity from hanging on exit.
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 const Section & GetSection(SectionID section) noexcept
Get the section data.
static Observer::Subscription Subscribe(UpdatePublisher::Callback callback)
Subscribe to sections update.
A move-only handle representing a connection to a Publisher.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Observer::Subscription mStatisticsUpdated
void AddSection(ShuttleGui &S, FrameStatistics::SectionID sectionID)
void SectionUpdated(FrameStatistics::SectionID sectionID)
wxString FormatTime(FrameStatistics::Duration duration)
Destroy_ptr< Dialog > sDialog