22 return frameStatistics;
33 , mStart(FrameStatistics::Clock::now())
70 mLastDuration = duration;
72 mMinDuration =
std::min(mMinDuration, duration);
73 mMaxDuration = std::max(mMaxDuration, duration);
76 mAvgAccum = mAvgAccum - mFilteringKernel[mNextIndex] + duration;
78 mFilteringKernel[mNextIndex] = duration;
80 mNextIndex = (mNextIndex + 1) % KERNEL_SIZE;
82 if (mKernelItems < KERNEL_SIZE)
85 mAvgDuration = mAvgAccum / mKernelItems;
Duration GetMaxDuration() const noexcept
All time maximum duration of the events in this section.
size_t GetEventsCount() const noexcept
Total number of the events in this section.
Duration GetAverageDuration() const noexcept
Average duration of the last KERNEL_SIZE events in this section.
Duration GetLastDuration() const noexcept
Duration of the last event.
void AddEvent(Duration duration) noexcept
Duration GetMinDuration() const noexcept
All time minimum duration of the events in this section.
RAII wrapper used to measure a section time.
Stopwatch(SectionID section) noexcept
A class to profile TrackPanel painting.
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.
void AddEvent(SectionID section, Duration duration)
UpdatePublisher mUpdatePublisher
static const Section & GetSection(SectionID section) noexcept
Get the section data.
Section mSections[size_t(SectionID::Count)]
static Stopwatch CreateStopwatch(SectionID section) noexcept
Create a Stopwatch for the section specified.
static Observer::Subscription Subscribe(UpdatePublisher::Callback callback)
Subscribe to sections update.
Subscription Subscribe(Callback callback)
Connect a callback to the Publisher; later-connected are called earlier.
std::function< CallbackReturn(const SectionID &) > Callback
Type of functions that can be connected to the Publisher.
A move-only handle representing a connection to a Publisher.
FrameStatistics & GetInstance() noexcept
void Invoke(SectionID id)