VTK
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 
30 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderTimerLog
31  : public vtkRenderTimerLog
32 {
33 public:
34  struct OGLEvent
35  {
36  OGLEvent() : Timer(nullptr) {}
37 
40  std::vector<OGLEvent> Events;
41  };
42 
43  struct OGLFrame
44  {
45  OGLFrame() : ChildCount(0) {}
46 
47  unsigned int ChildCount;
48  std::vector<OGLEvent> Events;
49  };
50 
51  static vtkOpenGLRenderTimerLog* New();
53  void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE;
54 
55  bool IsSupported() VTK_OVERRIDE;
56 
57  void MarkFrame() VTK_OVERRIDE;
58 
59  void MarkStartEvent(const std::string &name) VTK_OVERRIDE;
60  void MarkEndEvent() VTK_OVERRIDE;
61 
62  bool FrameReady() VTK_OVERRIDE;
63 
64  Frame PopFirstReadyFrame() VTK_OVERRIDE;
65 
69  void ReleaseGraphicsResources() VTK_OVERRIDE;
70 
81  vtkSetMacro(MinTimerPoolSize, size_t)
82  vtkGetMacro(MinTimerPoolSize, size_t)
83 
84 protected:
85  OGLFrame CurrentFrame;
86  // We use a deque since they are iterable. convention is push back, pop front
87  std::deque<OGLFrame> PendingFrames;
88  std::queue<Frame> ReadyFrames;
89 
90  std::queue<vtkOpenGLRenderTimer*> TimerPool;
91 
92  size_t MinTimerPoolSize;
93 
96 
97  bool DoLogging();
98 
99  Frame Convert(const OGLFrame &oglFrame);
100  Event Convert(const OGLEvent &oglEvent);
101 
102  OGLEvent& NewEvent();
103  OGLEvent* DeepestOpenEvent();
104  OGLEvent& WalkOpenEvents(OGLEvent &event);
105 
106  vtkOpenGLRenderTimer* NewTimer();
107  void ReleaseTimer(vtkOpenGLRenderTimer *timer);
108 
109  void ReleaseOGLFrame(OGLFrame &frame);
110  void ReleaseOGLEvent(OGLEvent &event);
111 
112  void TrimTimerPool();
113 
114  void CheckPendingFrames();
115  bool IsFrameReady(OGLFrame &frame);
116  bool IsEventReady(OGLEvent &event);
117 
118  void ForceCloseFrame(OGLFrame &frame);
119  void ForceCloseEvent(OGLEvent &event);
120 
121 private:
122  vtkOpenGLRenderTimerLog(const vtkOpenGLRenderTimerLog&) VTK_DELETE_FUNCTION;
123  void operator=(const vtkOpenGLRenderTimerLog&) VTK_DELETE_FUNCTION;
124 };
125 
126 #endif // vtkOpenGLRenderTimerLog_h
OpenGL2 override for vtkRenderTimerLog.
static vtkRenderTimerLog * New()
a simple class to control print indentation
Definition: vtkIndent.h:33
Container for a frame&#39;s events.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Container for a single timed event.
Asynchronously measures GPU execution time for a single event.
Asynchronously measures GPU execution times for a series of events.
VTKACCELERATORSVTKM_EXPORT vtkm::cont::Field Convert(vtkDataArray *input, int association)