VTK  9.1.0
vtkOpenGLRenderTimerLog.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkOpenGLRenderTimerLog.h
5
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
15
16#ifndef vtkOpenGLRenderTimerLog_h
17#define vtkOpenGLRenderTimerLog_h
18
19#include "vtkRenderTimerLog.h"
20#include "vtkRenderingOpenGL2Module.h" // For export macros
21
22#include <deque> // for deque!
23#include <queue> // for queue!
24
26
30class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderTimerLog : public vtkRenderTimerLog
31{
32public:
33 struct OGLEvent
34 {
36 : Timer(nullptr)
37 {
38 }
39
42 std::vector<OGLEvent> Events;
43 };
44
45 struct OGLFrame
46 {
48 : ChildCount(0)
49 {
50 }
51
52 unsigned int ChildCount;
53 std::vector<OGLEvent> Events;
54 };
55
58 void PrintSelf(ostream& os, vtkIndent indent) override;
59
60 bool IsSupported() override;
61
65 bool GetLoggingEnabled() override { return this->DoLogging(); }
66
67 void MarkFrame() override;
68
69 void MarkStartEvent(const std::string& name) override;
70 void MarkEndEvent() override;
71
72 bool FrameReady() override;
73
75
79 void ReleaseGraphicsResources() override;
80
91 vtkSetMacro(MinTimerPoolSize, size_t);
92 vtkGetMacro(MinTimerPoolSize, size_t);
93
94protected:
96 // We use a deque since they are iterable. convention is push back, pop front
97 std::deque<OGLFrame> PendingFrames;
98 std::queue<Frame> ReadyFrames;
99
100 std::queue<vtkOpenGLRenderTimer*> TimerPool;
101
103
106
107 bool DoLogging();
108
109 Frame Convert(const OGLFrame& oglFrame);
110 Event Convert(const OGLEvent& oglEvent);
111
115
118
121
123
125 bool IsFrameReady(OGLFrame& frame);
126 bool IsEventReady(OGLEvent& event);
127
130
131private:
133 void operator=(const vtkOpenGLRenderTimerLog&) = delete;
134};
135
136#endif // vtkOpenGLRenderTimerLog_h
a simple class to control print indentation
Definition: vtkIndent.h:113
OpenGL2 override for vtkRenderTimerLog.
std::queue< Frame > ReadyFrames
bool IsEventReady(OGLEvent &event)
void ForceCloseEvent(OGLEvent &event)
Frame Convert(const OGLFrame &oglFrame)
OGLEvent & WalkOpenEvents(OGLEvent &event)
bool IsSupported() override
Returns true if stream timings are implemented for the current graphics backend.
bool IsFrameReady(OGLFrame &frame)
std::queue< vtkOpenGLRenderTimer * > TimerPool
vtkOpenGLRenderTimer * NewTimer()
static vtkOpenGLRenderTimerLog * New()
~vtkOpenGLRenderTimerLog() override
Event Convert(const OGLEvent &oglEvent)
void MarkFrame() override
Call to mark the start of a new frame, or the end of an old one.
bool GetLoggingEnabled() override
Overridden to do support check before returning.
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.
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.
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.
Asynchronously measures GPU execution times for a series of events.
@ name
Definition: vtkX3D.h:225
@ string
Definition: vtkX3D.h:496
Container for a single timed event.
Container for a frame's events.