Panda3D
pStatGPUTimer.h
1 // Filename: pStatGPUTimer.h
2 // Created by: rdb (21Aug14)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #ifndef PSTATGPUTIMER_H
16 #define PSTATGPUTIMER_H
17 
18 #include "pandabase.h"
19 #include "pStatTimer.h"
20 #include "pStatCollector.h"
21 #include "config_pstats.h"
22 #include "timerQueryContext.h"
23 
24 class Thread;
26 
27 ////////////////////////////////////////////////////////////////////
28 // Class : PStatGPUTimer
29 // Description : This is a special type of PStatTimer that also
30 // uses a timer query on the GSG to measure how long
31 // a task actually takes to execute on the GPU, rather
32 // than how long it took for the API commands to be
33 // queued up.
34 //
35 // This class may only be used on the draw thread.
36 //
37 // At present, it tracks both the CPU time (like a
38 // regular PStatTimer does) and the GPU time, which
39 // is recorded using a special PStatThread.
40 ////////////////////////////////////////////////////////////////////
41 class EXPCL_PANDA_DISPLAY PStatGPUTimer : public PStatTimer {
42 public:
43 #ifdef DO_PSTATS
45  PStatCollector &collector);
46  INLINE PStatGPUTimer(GraphicsStateGuardian *gsg,
47  PStatCollector &collector,
48  Thread *current_thread);
49  INLINE ~PStatGPUTimer();
50 
52 
53 private:
54 #else // DO_PSTATS
55 
56  INLINE PStatGPUTimer(GraphicsStateGuardian *, PStatCollector &col)
57  : PStatTimer(col) { }
58  INLINE PStatGPUTimer(GraphicsStateGuardian *, PStatCollector &col, Thread *)
59  : PStatTimer(col) { }
60  INLINE ~PStatGPUTimer() { }
61 
62 #endif // DO_PSTATS
63 };
64 
65 #include "pStatGPUTimer.I"
66 
67 #endif
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
Definition: pStatTimer.h:34
This is a special type of PStatTimer that also uses a timer query on the GSG to measure how long a ta...
Definition: pStatGPUTimer.h:41
A lightweight class that represents a single element that may be timed and/or counted via stats...
A thread; that is, a lightweight process.
Definition: thread.h:51
Encapsulates all the communication with a particular instance of a given rendering backend...