Panda3D
 All Classes Functions Variables Enumerations
pStatGPUTimer.I
1 // Filename: pStatGPUTimer.I
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 
16 #ifdef DO_PSTATS
17 
18 ////////////////////////////////////////////////////////////////////
19 // Function: PStatGPUTimer::Constructor
20 // Access: Public
21 // Description:
22 ////////////////////////////////////////////////////////////////////
23 INLINE PStatGPUTimer::
24 PStatGPUTimer(GraphicsStateGuardian *gsg, PStatCollector &collector) :
25  PStatTimer(collector),
26  _gsg(gsg)
27 {
28  if (gsg->get_timer_queries_active() && collector.is_active()) {
29  gsg->issue_timer_query(collector.get_index());
30  //cerr << "issuing " << collector << " active " << collector.is_active() << "\n";
31  }
32 }
33 
34 ////////////////////////////////////////////////////////////////////
35 // Function: PStatGPUTimer::Constructor
36 // Access: Public
37 // Description:
38 ////////////////////////////////////////////////////////////////////
39 INLINE PStatGPUTimer::
40 PStatGPUTimer(GraphicsStateGuardian *gsg, PStatCollector &collector, Thread *current_thread) :
41  PStatTimer(collector, current_thread),
42  _gsg(gsg)
43 {
44  if (gsg->get_timer_queries_active() && collector.is_active()) {
45  gsg->issue_timer_query(collector.get_index());
46  }
47 }
48 
49 ////////////////////////////////////////////////////////////////////
50 // Function: PStatGPUTimer::Destructor
51 // Access: Public
52 // Description:
53 ////////////////////////////////////////////////////////////////////
54 INLINE PStatGPUTimer::
55 ~PStatGPUTimer() {
56  if (_gsg->get_timer_queries_active() && _collector.is_active()) {
57  _gsg->issue_timer_query(_collector.get_index() | 0x8000);
58  }
59 }
60 
61 #endif
A lightweight class that can be used to automatically start and stop a PStatCollector around a sectio...
Definition: pStatTimer.h:34
bool get_timer_queries_active() const
Returns true if timer queries are currently enabled on this GSG.
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...