VTK  9.6.20260202
vtkOpenGLRenderTimerLog.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
3
4#ifndef vtkOpenGLRenderTimerLog_h
5#define vtkOpenGLRenderTimerLog_h
6
7#include "vtkRenderTimerLog.h"
8#include "vtkRenderingOpenGL2Module.h" // For export macros
9
10#include <deque> // for deque!
11#include <queue> // for queue!
12
13VTK_ABI_NAMESPACE_BEGIN
16
20class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderTimerLog : public vtkRenderTimerLog
21{
22public:
23 struct OGLEvent
24 {
26 : Timer(nullptr)
27 {
28 }
29
30 std::string Name;
32 std::vector<OGLEvent> Events;
33 };
34
35 struct OGLFrame
36 {
38 : ChildCount(0)
39 {
40 }
41
42 unsigned int ChildCount;
43 std::vector<OGLEvent> Events;
44 };
45
50 void PrintSelf(ostream& os, vtkIndent indent) override;
51
52 bool IsSupported() VTK_FUTURE_CONST override;
53
57 bool GetLoggingEnabled() VTK_FUTURE_CONST override { return this->DoLogging(); }
58
59 void MarkFrame() override;
60
61 void MarkStartEvent(const std::string& name) override;
62 void MarkEndEvent() override;
63
64 bool FrameReady() override;
65
67
71 void ReleaseGraphicsResources() override;
72
83 vtkSetMacro(MinTimerPoolSize, size_t);
84 vtkGetMacro(MinTimerPoolSize, size_t);
85
86protected:
88 // We use a deque since they are iterable. convention is push back, pop front
89 std::deque<OGLFrame> PendingFrames;
90 std::queue<Frame> ReadyFrames;
91
92 std::queue<vtkOpenGLRenderTimer*> TimerPool;
93
95
98
99 bool DoLogging() VTK_FUTURE_CONST;
100
101 Frame Convert(const OGLFrame& oglFrame);
102 Event Convert(const OGLEvent& oglEvent);
103
107
110
113
115
117 bool IsFrameReady(OGLFrame& frame);
118 bool IsEventReady(OGLEvent& event);
119
122
123private:
125 void operator=(const vtkOpenGLRenderTimerLog&) = delete;
126};
127
128#define vtkOpenGLRenderTimerLog_OVERRIDE_ATTRIBUTES \
129 vtkOpenGLRenderTimerLog::CreateOverrideAttributes()
130VTK_ABI_NAMESPACE_END
131#endif // vtkOpenGLRenderTimerLog_h
a simple class to control print indentation
Definition vtkIndent.h:108
bool IsEventReady(OGLEvent &event)
void ForceCloseEvent(OGLEvent &event)
Frame Convert(const OGLFrame &oglFrame)
OGLEvent & WalkOpenEvents(OGLEvent &event)
bool DoLogging() VTK_FUTURE_CONST
bool IsFrameReady(OGLFrame &frame)
std::queue< vtkOpenGLRenderTimer * > TimerPool
vtkOpenGLRenderTimer * NewTimer()
static vtkOpenGLRenderTimerLog * New()
~vtkOpenGLRenderTimerLog() override
void MarkFrame() override
Call to mark the start of a new frame, or the end of an old one.
static vtkOverrideAttribute * CreateOverrideAttributes()
void ReleaseOGLFrame(OGLFrame &frame)
OGLEvent * DeepestOpenEvent()
void MarkEndEvent() override
Mark the beginning or end of an event.
Frame PopFirstReadyFrame() override
Retrieve the first available frame's timing info.
bool GetLoggingEnabled() VTK_FUTURE_CONST override
Overridden to do support check before returning.
std::deque< OGLFrame > PendingFrames
void ReleaseTimer(vtkOpenGLRenderTimer *timer)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void ReleaseGraphicsResources() override
Releases any resources allocated on the graphics device.
bool IsSupported() VTK_FUTURE_CONST override
Returns true if stream timings are implemented for the current graphics backend.
void ReleaseOGLEvent(OGLEvent &event)
void ForceCloseFrame(OGLFrame &frame)
void MarkStartEvent(const std::string &name) override
Mark the beginning or end of an event.
bool FrameReady() override
Returns true if there are any frames ready with complete timing info.
Asynchronously measures GPU execution time for a single event.
Attribute for vtkObjectFactory overrides.
Container for a single timed event.
Container for a frame's events.
#define VTK_NEWINSTANCE